How can I automatically restart nginx and passenger after deployment

I am currently using a rails app on a virtual private server.

I am using Capistrano, Nginx and passenger to run my rails app on the server.

For some reason, I can never get the updated code to display on the site after I have done cover deployment: update.

Deployment works fine and the code is even viewed on a live server via Vim, but if I go to the live site it won't show up.

My current solution is to restart the server, start nginx and passenger after server restart.

I am concerned that someone is logged into the site, when I deploy and restart, it will remove them from the site.

Does anyone have any ideas

+3


source to share


2 answers


If you run touch tmp/restart.txt

from the root rails directory, the passenger will restart the application. You don't need to restart nginx. After the timestamp of the restart.txt file changes, Passenger will restart for the next request. If your application takes some time to load, you can force it to do so by making a request immediately after touching the file.



You don't have to worry about hitting someone from the site, it won't restart the server if there is a request in progress.

+17


source


If you still face the problem you can use the Monit stone, in capstraino it works very well.



0


source







All Articles