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
200
T 客邦網站上線實務分享
v1nc3ntlaw
3
270
Other Decks in Programming
See All in Programming
Dockerfile CMD for Node.js
grazie1999
0
100
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
740
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
160
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
230
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
160
30年振りにコンパイラの定数整数除算を改善した
herumi
1
170
Android CLI
fornewid
0
230
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
990
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
440
Built Our Own Background Agent at LayerX
layerx
PRO
10
5.8k
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
210
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
340
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
Un-Boring Meetings
codingconduct
0
390
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
260
Building an army of robots
kneath
306
46k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
440
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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