Search code examples
ruby-on-railspassengerunicorn

Can you reload a Rails app on Passenger in the same seamless way as you can reload one on Unicorn?


With Unicorn, you can restart and reload a Rails app with kill -USR2 [master process], which doesn't kill the process immediately, but starts a new master process + slave processes in the background. When the new master is ready, you can shut off the old master with kill -QUIT. This lets you restart your website without having any visitors notice a slowdown in request handling.

But with Passenger, you restart the Rails app with touch tmp/restart.txt, which as far as I can tell, causes the Rails app to become unresponsive for the few seconds it takes to restart the Rails application.

Is there a way to use Passenger, but also have the Rails app restart seamlessly?


Solution

  • No. [now yes - see hongli's response]

    You're asking for rolling restarts, where the new server processes are brought up before the old ones are killed. Passenger (the free version) won't drop requests, but they will get queued and delayed whenever you deploy.

    Rolling restarts has supposedly already been implemented and is available in the licensed version, but not yet released for the free version. I've been unable to figure out how to get the licensed version.

    Follow this google groups thread for more info:

    https://groups.google.com/forum/#!msg/phusion-passenger/hNvU-ZE7_WY/gOF9XWmhHy0J

    You could try running two standalone passenger processes and manually bring one down while the other stays up, but I don't think that's the answer you were looking for.