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
Optimize Rails Asset Pipeline Deployment
Search
Cam Huynh
October 11, 2015
Technology
0
63
Optimize Rails Asset Pipeline Deployment
Cam Huynh
October 11, 2015
Tweet
Share
More Decks by Cam Huynh
See All by Cam Huynh
Reddit Ruby Conf 2016 Recap
hqc
0
99
FutureWorkz DevOps Workshop Day II - Deploying Rails
hqc
0
42
FutureWorkz DevOps Workshop Day III - Gitlab Runner for CD
hqc
0
90
Futureworkz DevOps Workshop Day 1 - DevOps ToolChain
hqc
0
62
FutureWorkz DevOps Workshop Intro
hqc
1
55
Rack for beginners
hqc
0
67
Chat Implementation with RESTful (Ruby) and Web Socket
hqc
0
50
Monkey patching in Ruby
hqc
0
290
Other Decks in Technology
See All in Technology
プロンプトエンジニアリングでがんばらない-Agentic Workflow へ-近藤憲児
kenjikondobai
3
920
複雑な構成要素を持つUIとの向き合い方 〜新・支出グラフでの実例〜 / B43 TECH TALK
nakamuuu
0
140
現代CSSフレームワークの内部実装とその仕組み
poteboy
7
3.6k
アクセス制御にまつわる改善 / Improving access control
itkq
0
550
競技としてのKaggle、役に立つKaggle
yu4u
3
1.9k
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
300
ChatworkのSRE部って実は 半分くらいPlatform Engineering部かもしれない
saramune
0
160
ゼロから始めるVue.jsコミュニティ貢献 / first-vuejs-community-contribution-link-and-motivation
lmi
1
130
LLM開発・活用の舞台裏@2024.04.25
yushin_n
1
370
Python と Snowflake はズッ友だょ!~ Snowflake の Python 関連機能をふりかえる ~
__allllllllez__
1
120
レガシーをぶっ壊せ。AEONで始めるDevRelの話 / Qiita Night 2024-2-22
aeonpeople
3
1.3k
いつか使うかも貯金してたらめちゃめちゃ機能が増えてた話
riyaamemiya
0
350
Featured
See All Featured
Making Projects Easy
brettharned
108
5.5k
Happy Clients
brianwarren
92
6.4k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
What's in a price? How to price your products and services
michaelherold
237
11k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
The Cost Of JavaScript in 2023
addyosmani
16
3.9k
For a Future-Friendly Web
brad_frost
172
9k
Six Lessons from altMBA
skipperchong
21
3k
Designing Experiences People Love
moore
136
23k
A Philosophy of Restraint
colly
197
16k
Transcript
ASSET PIPELINE OPTIMIZATION by @huynhquancam
WHAT SHOULD YOU KNOW ABOUT THIS GUY? My name is
Huynh Quan Cam. Responsible for the development and engineering of Dadadee.
WHAT’S THE TALK ABOUT? Rails Assets pipeline. Deploy assets pipeline
on multiple servers. How to optimize the deployment?
ASSETS PIPELINE concatenate and minify or compress JavaScript and CSS
assets. support pre-processors such as CoffeeScript, Sass and ERB. based on Sprockets.
USING ASSET PIPELINE
– The Rails core team. “TIPS OF THE DAY” You
can get rid of sprockets by executing this command at the start. rails new my-awesome-app-without-sprockets --skip-sprockets
SITUATION we are deploying an Rails app to four servers:
2 web, 1 database and 1 worker. db and worker servers need static assets to work. zero-down time deployment and rollback required.
CAPISTRANO-RAILS capistrano-rails is a set of Capistrano tasks to automate
Rails deployment. migrations. assets pre-compilation.
ORCHESTRATION SCRIPT
WHAT’S WRONG WITH THIS APPROACH? waste of time. waste of
computing resources. waste of storage resources, especially when you’re using CDNs like CloudFront.
Can we only pre-compile once?
ASSET FINGERPRINTS generated based on file content. optimize client-side caching.
better cache invalidation.
ASSET FINGERPRINT application.css application-908e25f4bf641868d8683022a5b62f54.css application.css application-723d1be6cc741a3aabb1cec24276d681.css
ASSET MANIFEST a manifest-<md5-hash>.json cache every fingerprint of your Rails
static assets. accelerate Rails helper call.
ASSET MANIFEST
NOTES fingerprints only change if file contents change. fingerprints don’t
change across servers. all fingerprint requests are handled by manifest file.
Pre-compile once and sync the manifest file to others.
IMPLEMENTATION
IMPLEMENTATION
QUESTIONS?
THANK YOU!