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
March 01, 2011
Programming
260
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
T 客邦網站上線實務分享
Sheng-Je Lin
March 01, 2011
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
9
1.1k
Other Decks in Programming
See All in Programming
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
270
Vite+ Unified Toolchain for the Web
naokihaba
0
410
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
200
symfony/aiとlaravel/boost
77web
0
110
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
190
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
280
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
430
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
230
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
270
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
100
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
160
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
880
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Speed Design
sergeychernyshev
33
1.9k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.7k
A better future with KSS
kneath
240
18k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
340
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Transcript
T客邦網站上線實務 網站上線前,不做會死的工作。 2011/03/01 Ruby Tuesday #17
about.me/v1nc3ntlaw • 林聖哲 Vincent • T客邦 Rails Developer • Ruby
on Rails Developer Since 2010.05
網站上線大作戰 • 開發時的準備 • production server 的佈署 • 上線前的預備 •
上線時的流程 • 上線後的觀察
Redmine 開票紀錄必要的設定 • 開發時註解起來,上線時需要打開的 code • if Rails.env == ?
• daemon $ script/delayed_job -n 3 start $ rake thinking_sphinx:start • /etc/crontab $ rake sitemap:refresh $ rake thinking_sphinx:rebuild
利用 capistrano 讓 deploy 自動化 • https://github.com/capistrano • gem "capistrano"
• config/deploy.rb $ cap deploy
架設 staging server • 相似 production server 的環境 提早發現開發環境無法發現的問題 •
利用 capistrano 拆分 ◦ gem "capistrano-ext" ◦ config/deploy/production.rb ◦ config/deploy/staging.rb $ cap staging deploy
production 環境的佈署 • deploy code to production server $ cd
projects/playgame $ cap production deploy:setup $ cap production deploy
production 環境的佈署 • 設定檔 ◦ /srv/playgame/shared/config/database.yml ◦ /srv/playgame/shared/config/api_key.yml ◦ /srv/playgame/shared/config/nginx.conf
wrong, it's rack_env
production 環境的佈署 • 在 nginx 主要設定檔 /opt/nginx/conf/nginx.conf 加入 ◦ include
/srv/*/shared/config/nginx.conf ◦ 讀取每個網站的 nginx.conf ▪ /srv/playgame/shared/config/nginx.conf ▪ /srv/digiphoto/shared/config/nginx.conf ▪ /srv/techbang/shared/config/nginx.conf
production 環境的佈署 $ cd /srv/playgame/current $ RAILS_ENV=production rake db:create $
RAILS_ENV=production rake db:migrate $ RAILS_ENV=production rake db:seed $ export RAILS_ENV=production
DNS 設定 • 提早設定 • game.techbang.com.tw • asset.game.techbang.com.tw • cdn0~3.game.techbang.com.tw
相關部門的配合 • 要求公司內部相關人員在 staging 測試找出問題 • 舊站轉新站:網站發佈公告下線維護的時間 • 新站:到社群發佈網站上線的時間
上線前兩天 • 完成 production server 的佈署 • playgame PHP 轉
Rails ◦ 編輯截稿停止上新文章 ◦ 備份 PHP 資料庫,在 production server 轉換資料庫 ◦ 轉完資料庫檢查 Rails 網站內容 • digiphoto Rails 新站 ◦ 請編輯準備好可以上稿的稿件 ◦ 設定 HTTP Basic Authentication 只有內部人員可以進入 ◦ 開始上稿
production 檢查項目 • 檢測 SSO 登入、登出行為正常 • 確保文章刊登正常,不會顯示未來文章,包括 RSS 輸出
• 應該使用 strip_tags 濾掉 HTML 的地方 ◦ meta description、文章的引言 • 每頁的 meta title 都要變換 ◦ 文章標題 | 站名 • 確認廣告顯示正常 ◦ 廣告系統、 Google AdSense、Yahoo Ads • Social Widgets ◦ Facebook、Plurk、Twitter
效能檢查 • 開發寫程式時不要過於注意效能問題 但上線前需要做全面的檢測 • 避免全域的 SQL Query 可在 partial
裡撈資料打 cache
效能檢查 • 在開發端測效能 ◦ script/server ◦ tail -f log/development.log
效能檢查 • https://github.com/nesquena/query_reviewer
上線 • playgame 公告網站維護時間兩個小時 ◦ 舊站進入維護頁面 ◦ 修改新舊站 nginx.conf 互換
server_name ▪ server_name game.techbang.com.tw root /srv/playgame/php ▪ server_name game_on_rails.techbang.com.tw root /srv/playgame/current/public • digiphoto ◦ 解除 HTTP Basic Authentication 即可
SEO 檢查 • public/robots.txt User-Agent: * Disallow: Sitemap: http://game.techbang.com.tw/sitemap_index.xml.gz •
nginx.conf 中設定 301 轉址 rewrite ^/wow$ http://game.techbang.com.tw/games/45 permanent; • Google Webmaster 進行驗證 • 檢查 RSS,上 feedburner 可分散流量,auto discovery
New Relic 觀察網站效能
Web transactions
Database
Hoptoad 追蹤錯誤訊息
錯誤訊息紀錄
Scout 監控伺服器狀況
Q & A