简体   繁体   中英

How do i make nginx and passenger restart automatically after a deploy

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

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.

如果你仍然面临这个问题你可以使用Monit gem,在capstraino它的效果非常好。

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