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
120
diff puppet chef
v1nc3ntlaw
2
190
T 客邦網站上線實務分享
v1nc3ntlaw
3
250
Other Decks in Programming
See All in Programming
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
190
スマートグラスで並列バイブコーディング
hyshu
0
120
CSC307 Lecture 17
javiergs
PRO
0
320
A2UI という光を覗いてみる
satohjohn
1
130
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
530
Claspは野良GASの夢をみるか
takter00
0
180
ふつうのFeature Flag実践入門
irof
7
3.7k
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
160
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
技術記事、 専門家としてのプログラマ、 言語化
mizchi
4
2.3k
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
150
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
560
Featured
See All Featured
Music & Morning Musume
bryan
47
7.2k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
710
Fireside Chat
paigeccino
42
3.9k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Skip the Path - Find Your Career Trail
mkilby
1
140
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
ラッコキーワード サービス紹介資料
rakko
1
3.6M
Side Projects
sachag
455
43k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
How GitHub (no longer) Works
holman
316
150k
A Tale of Four Properties
chriscoyier
163
24k
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