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
260
Other Decks in Programming
See All in Programming
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
240
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
190
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
170
Creating Composable Callables in Contemporary C++
rollbear
0
180
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
210
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
230
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
14
6.6k
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
120
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
330
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
190
A2UI という光を覗いてみる
satohjohn
1
170
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
130
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
180
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
320
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
250
The Limits of Empathy - UXLibs8
cassininazir
1
380
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
360
Automating Front-end Workflow
addyosmani
1370
210k
The Curious Case for Waylosing
cassininazir
1
420
A designer walks into a library…
pauljervisheath
211
24k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
320
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Mind Mapping
helmedeiros
PRO
1
270
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