I have a love/hate relationship with the asset pipeline. Ok, it’s mostly hate. I applaud what it tries to do, but it takes something relatively simple - javascript and CSS - and makes it painful, mostly by making deploys take _forever _(even with turbo-sprockets-rails3).
For example, I was working on something yesterday and doing deploys to the staging environment. I noticed that it took forever to be able to start serving requests. Passenger-status showed all three instances were running, and were all stuck serving their first request. A little digging revealed that there were a bunch of node.js processes running compiling assets! What the?! I thought I was precompiling everything! Nope, apparently not.
After a little digging, I found this setting:
config.assets.compile = true
Set that to false
and redeployed, and all of a sudden, I was seeing 500
responses for assets that weren’t precompiled! I ended up
spending about 30 minutes adding a bunch of new javascript and CSS files to
the config.assets.precompile
list and eventually the app started up fine and
I got rid of the unpleasant “first request takes forever” symptom in
Passenger.
I think this is most likely going to bite you if you use a gem that provides its own assets and doesn’t add them to the precompile list on its own (which it should).
I hope that helps someone avoid some downtime / slow requests in the future, because it took me a while to figure out!