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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
230
A2UI という光を覗いてみる
satohjohn
1
170
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
820
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
200
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
1
170
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
820
Contextとはなにか
chiroruxx
1
390
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
190
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
970
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.7k
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
The untapped power of vector embeddings
frankvandijk
2
1.8k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
230
Technical Leadership for Architectural Decision Making
baasie
3
430
Being A Developer After 40
akosma
91
590k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
220
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Designing for Performance
lara
611
70k
Are puppies a ranking factor?
jonoalderson
1
3.7k
Unsuck your backbone
ammeep
672
58k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
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