Read more

better rails app restart with the passenger restart-app tool

Kim Klotz
April 28, 2014Software engineer at makandra GmbH

Use capistrano-passenger to restart your Rails app after each deployment.

With this command you can initiate an application restart without touching restart.txt. Unlike touching restart.txt, this tool initiates the restart immediately instead of on the next request. http://blog.phusion.nl/2014/01/02/phusion-passenger-4-0-33-released/ Show archive.org snapshot

If you want to use this with capistrano 2.x just replace the touch command:

-    run "touch #{current_path}/tmp/restart.txt"
+    run "passenger-config restart-app --ignore-app-not-running #{deploy_to}"
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

If you are using capistrano 3.x:

 - execute :touch, "#{current_path}/tmp/restart.txt"
 + execute "passenger-config restart-app --ignore-app-not-running #{deploy_to}"

Note: If you using a passenger lower than 5.0.10 you have to use sudo to run this command.

If using it with capistrano you should use passenger >=4.0.41 and the --ignore-app-not-running parameter otherwise your deploy may fail.

When deploying with capistrano it's possible you get this "error" message:

*** [err :: example.com] There are no Phusion Passenger-served applications running whose paths begin with '/var/www/example.com'.
*** [err :: example.com] 

This is just because there were no running passenger instance on the server. It's not a real error.

Posted by Kim Klotz to makandra dev (2014-04-28 20:15)