Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Restart Rails Production Servers After Code Deployment w/o Downtime

In Rails, what is the best strategy to restarting app servers like Thin after a code deployment through a Capistrano script. I would like to be able to deploy code to production servers without fearing that a user might see the 500.html page.

like image 238
Jhony Fung Avatar asked May 10 '11 03:05

Jhony Fung


People also ask

How do I restart rails?

You can restart the application by creating or modifying the file tmp/restart. txt in the Rails application's root folder. Passenger will automatically restart the application during the next request.


2 Answers

I found this question while looking for an answer. Because I wanted to stick with Thin, none of the answers here suited my needs. This fixed it for me:

thin restart -e production --servers 3 --onebyone --wait 30

like image 63
wrdevos Avatar answered Oct 05 '22 19:10

wrdevos


Unicorn is supposed to have rolling restarts built in. I have not setup a unicorn stack yet but http://sirupsen.com/setting-up-unicorn-with-nginx/ looks like a good start.

like image 26
Paul Nicholson Avatar answered Oct 05 '22 19:10

Paul Nicholson