简体   繁体   中英

Rails - Can I run rake assets:precompile on production server, while the production app is still running?

Sorry if this question sounds basic. But I haven't been able to find an answer anywhere on the web...

I'm currently running my Rails app on a Ubuntu server. Until now I've always shut down the production app before I pull the changes, run rake assets:clean assets:precompile , and only boot up the Rails app again once the process is finished.

I'm not sure whether the shutting down of app is necessary(ie if I don't do it, my app will behave erratically). It induces about 5 minutes of down time.

If that's a must, then maybe I should try to do local precompilation/more advanced deployment procedure, in order to reduce downtime? (Tried local compilation according to http://guides.rubyonrails.org/asset_pipeline.html#local-precompilation , but then after deleting original public/assets and pulling locally precompiled public/assets from the repo, the production server was having rack timeout all the time and won't render anything.)

YES you run rake assets:precompile Rails looks through your assets folder and copies over everything that is not Javascript or CSS into public/assets . It then creates application.js by reading app\\assets\\javascripts\\application.js , and application.css by reading app\\assets\\stylesheets\\application.css , loading up all the "require" files it finds in there. So yes..you can do it ..but if you ran rake assets:clean ..and then precompile...then public/assets will be updated with new compiled assets.

Dont forget to restart the server :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM