Upgrade Your Capistrano Config To Restart Using The Passenger Restart-app Tool

Posted By Weston Ganger

With the release of Passenger 4, they included a app restart command that functions better the touch tmp/restart.txt method.

With the old method the app would restart on the next request, using the restart-app command that app will restart immediately.

Here is how to upgrade your deploy.rb file for Capistrano.

# config/deploy.rb

# Capistrano 2
run "sudo passenger-config restart-app --ignore-app-not-running #{deploy_to}"

# Capistrano 3
execute :sudo, "passenger-config restart-app --ignore-app-not-running #{deploy_to}"
  • The --ignore-app-not-running is required otherwise your deploy might fail.
  • If you recieve an error regarding no Phusion Passenger Served Apps, dont worry its not a bad error

Related External Links:

Article Topic:Software Development - Ruby / Rails

Date:November 03, 2015