I am building a rails-ember app using https://github.com/thoughtbot/ember-cli-rails.
I am using Capistrano for deployment on nginx web server and AWS instance. I am following these 2 sources:
https://www.youtube.com/watch?v=imdrYD4ooIk&t=150s
I follow the instructions and everything works fine. The problem is vendor.css, vendor.js, frontend.css, frontend.js are not copied to app/public/assets folder.
However, I am able to run the build successfully by manually copying these files to the desired assets folder. I did this by going through deployment logs which read:
01 - /home/deploy/{app-name}/releases/20180701213801/tmp/ember-cli/apps/frontend/assets/frontend-7b19d05f0c30463b6bc445254c46260a.js: 167.85 KB (19.56 KB gzipped) 01 - /home/deploy/{app-name}/releases/20180701213801/tmp/ember-cli/apps/frontend/assets/frontend-a6e35fc1f15073bdd000b39efd15f59a.css: 148.16 KB (24 KB gzipped) 01 - /home/deploy/{app-name}/releases/20180701213801/tmp/ember-cli/apps/frontend/assets/vendor-711976a824e2656ad208cb4c16c1dfc4.js: 1.16 MB (274.52 KB gzipped) 01 - /home/deploy/{app-name}/releases/20180701213801/tmp/ember-cli/apps/frontend/assets/vendor-d3aa84b783735f00b7be359e81298bf2.css: 38 B (58 B gzipped)
I copied these files to app/public/assets folder explicitly for everything to work fine.
Also, I face 502 error whenever I first deploy the app. For that, I always kill puma process using sudo kill -9 {pid}
and then restarting puma server using bundle exec puma -e production -d -b Unix:/home/deploy/{app-name}/shared/tmp/sockets/puma.sock
And then, I restart nginx server.
Following these steps, I am able to deploy everything successfully.
But this is a lot of work. I rather aim to automate everything. I don't want to copy files explicitly and I don't want to restart the puma and nginx server every time. How do I achieve this?
Also, I need to add 'bower': '*' in the package.json file every time before deployment. Any way to automate this?
Last thing: I want to run some rake tasks from local. Currently, I use this command: bundle exec rake {my_rake_task} RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1
on the server machine. Any suggestions?
P.S. Please answer this in detail. I am sure this question will help many others. If you suggest an edit, I will make it. But please, encourage constructive discussion on this thread. :)
Aucun commentaire:
Enregistrer un commentaire