Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
T 客邦技術架構分享
Search
Sheng-Je Lin
November 06, 2012
Programming
1.1k
9
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
T 客邦技術架構分享
Sheng-Je Lin
November 06, 2012
More Decks by Sheng-Je Lin
See All by Sheng-Je Lin
Build full-stack installer for Ruby Application with Omnibus.
v1nc3ntlaw
0
680
Ruby on Rails Intro
v1nc3ntlaw
0
130
diff puppet chef
v1nc3ntlaw
2
190
T 客邦網站上線實務分享
v1nc3ntlaw
3
270
Other Decks in Programming
See All in Programming
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
190
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
490
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
140
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
190
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
170
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.4k
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
140
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
210
霧の中の代数的エフェクト
funnyycat
1
440
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
420
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
1.1k
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
400
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
270
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Design in an AI World
tapps
1
270
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
3
370
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
We Have a Design System, Now What?
morganepeng
55
8.2k
For a Future-Friendly Web
brad_frost
183
10k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4k
Transcript
T 客邦技術架構分享 Rails Tuesday Sharing #2
• 林聖哲 ◦ Vincent ◦ v1nc3ntlaw • T 客邦 ◦
Ruby on Rails Developer ◦ Linux Server Administrator about.me/v1nc3ntlaw
T 客邦網站上線實務 2011/03/01 Ruby Tuesday #17
不只 T 客邦 • Single Sign-On 單一登入 ◦ 科技 -
T 客邦 ◦ 電玩 - 打電動 ◦ 攝影 - DIGIPHOTO ◦ 討論 - T17 ◦ 廣告系統、活動 Events All Powered by Rails
伺服器架構 Load Balancer (F5 BIG-IP) Web Front Server Farm Database
• Debian Stable Release • Nginx + Passenger • Percona MySQL • DRBD + Heartbeat = High Availability S M Redis
分流的好處:分散伺服器壓力、HA T T、G G D D、17 D、17 17 T、G role
app • delayed_job • cron job • sphinx • upload content role web SSO ADS Redis SSO ADS Redis Events Redmine Gitlab Nagios Cacti Staging 其它
團隊協作工具 • Redmine 專案管理系統 • SkyPE • IRC Channel ◦
deploy 訊息 ◦ git push 訊息 ◦ redmine ticket 動態
專案開發流程 • Git • Github and Gitlab • A feature
or bug a git branch • Deploy branch to staging for test • Pull Request • Master is always stable
前端 Performance • Yahoo! YSlow • Google Chrome - PageSpeed
Insights
Single Sign-On • rubycas-server • devise ◦ rememberable ◦ trackable
• devise_cas_authenticatable • omniauth-facebook
ryanb/cancan EppO/rolify • cancan 權限控管 • rolify 賦予使用者角色和可管理項目 • 討論區的板主權限
user.add_role(:moderator, Board.first) can :manage, Board do |board| user.has_role?(:moderator, board) end
delayed_job delayed_job_admin • 背景作業:寄信通知、圖片壓浮水印
pat/thinking-sphinx • Ruby library that connects ActiveRecord to the Sphinx
search engine daemon • 站內搜尋
thoughtbot/paperclip • 上傳圖片 • 縮圖時減少圖片的 size,清除圖片上不需要的 資訊和無損壓縮 has_attached_file :avatar, :styles
=> { :medium => { :geometry => "300x300>", :convert_options => "-strip -quality 90" } }
joshfrench/rakismet • 過濾廣告留言
cherring/connection_ninja 設定跨資料庫的 Model 討論區 Topic T 客邦 Forum::Topic
flyerhzm/chinese_permalink • 翻譯文章的中文標題加強 SEO 的文章連結 http://www.techbang.com/posts/11242-facebook-official- said-excessive-use-of-social-networking-sites-is-not- healthy
remvee/exifr • 擷取會員上傳的攝影照片 exif 資訊
javan/whenever • writing and deploying cron jobs • require "whenever/capistrano"
• 定時備份、跑 rake task 統計資料 every 1.hour, :at => 30 do rake "sitemap:refresh" end 30 * * * * /bin/bash -l -c 'cd /techbang/releases/20121101065201 && RAILS_ENV=production bundle exec rake sitemap:refresh'
meskyanichi/backup • 設定檔、網站圖檔備份 • 遠端備份至 AWS S3
Techbang Gems 整理出各專案重複使用的程式碼
• https://github.com/techbang ◦ google_plus_helper ◦ open_graph_helper ◦ cdn_image_helper ◦ seo_helper
Public Gems
Private Gems • techbang-core 文章的草稿、審稿、發佈流程 • techbang-fronted 前端相關的 assets or
helper • techbang-authentication 連接 SSO、Facebook 會員註冊、登入的功能
Private Gem Server Geminabox - Simple rubygem hosting
如果 techbang-authentication 裡最新的 git commit gemspect 版本號是 0.6.0 Gemfile 1.
bundle install clone git repo 後無法切換到正確的 gemspec 版本 gem "techbang-authentication", "0.4.0", :github => "techbang-authentication" 2. 指定 git tag 或 git ref gem "techbang-authentication", :tag => "0.4.0", :github => "techbang-authentication" gem "techbang-authentication", :ref => "4aded", :github => "techbang-authentication" 3. 使用 private gem server 管理 gem 版本 source "https://private.gem.server" gem "techbang-authentication", "~> 0.4.0"
快速建立新專案 必須結合 T 客邦 SSO、Facebook 註冊登入
Rails Composer 專案產生器 • An application template that creates a
Rails starter app. Devise, OmniAuth, CanCan, Twitter Bootstrap...
techbang-authentication • $ rails g techbang:authentication ◦ add migrations #
change users table for our needed ◦ add techbang gems ◦ add sso & facebook settings • $ rake db:create && rake db:migrate • $ rails s 立刻可使用 T 客邦 SSO 登入的新專案
使用到的各種服務
AWS 雲端服務 • Route 53 for DNS Management • SES
for sending mail • S3 for remote backup
監控 (雲端服務) • Pingdom 網站存活 EMail、簡訊通知 • Airbrake Rails app
錯誤偵測
監控 (自行架設) • Nagios 警訊通知 EMail、IRC 伺服器 ping、nginx、memcached、disk usage、cpu loading
資料收集 (雲端服務) • Google Webmaster Tools 檢查 SEO • Google
Analytics 網站流量、訪客人數 • New Relic Rails app 效能
資料收集 (自行架設) • Cacti 圖表報表 伺服器 cpu loading、memory usage、memcached usage、
disk io、TCP connections、mysql usage、redis usage
Q & A And Thanks For Listening