How do i make nginx and passenger restart automati

2019-04-11 01:33发布

问题:

I currently have a rails app deployed on a virtual private server.

I use 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 a cap deploy:update.

The deploy happens fine and the code is even seen on the live server via Vim but if I navigate to the live site it won't display.

My current workaround is rebooting the server, starting nginx and passenger after the server boots back up.

my concern is if someone is logged on to the site when i deploy and restart, it will knock them off the site.

Does anyone have any ideas

回答1:

If you run touch tmp/restart.txt from your rails root directory, passenger will restart the app. You shouldn't have to restart nginx. After the timestamp of the restart.txt file changes, Passenger will restart for the next request. If your app takes a while to boot, you may want to force this by making a request immediately after touching the file.

You don't need to worry about kicking someone off the site, it won't restart the server if there is a request in process.



回答2:

If you are still facing the problem you can use Monit gem, in capstraino it works really well.