WHAT SHOULD YOU KNOW
ABOUT THIS GUY?
My name is Huynh Quan Cam.
Responsible for the development and engineering of Dadadee.
Slide 3
Slide 3 text
WHAT’S THE TALK ABOUT?
Rails Assets pipeline.
Deploy assets pipeline on multiple servers.
How to optimize the deployment?
Slide 4
Slide 4 text
ASSETS PIPELINE
concatenate and minify or compress JavaScript and CSS assets.
support pre-processors such as CoffeeScript, Sass and ERB.
based on Sprockets.
Slide 5
Slide 5 text
USING ASSET PIPELINE
Slide 6
Slide 6 text
– 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
Slide 7
Slide 7 text
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.
Slide 8
Slide 8 text
CAPISTRANO-RAILS
capistrano-rails is a set of Capistrano tasks to automate Rails
deployment.
migrations.
assets pre-compilation.
Slide 9
Slide 9 text
ORCHESTRATION SCRIPT
Slide 10
Slide 10 text
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.
Slide 11
Slide 11 text
Can we only pre-compile once?
Slide 12
Slide 12 text
ASSET FINGERPRINTS
generated based on file content.
optimize client-side caching.
better cache invalidation.