Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid:
touch tmp/restart.txt
sudo passenger-config restart-app /path/to/app
passenger-config restart-app /path/to/app
You should not need to know which one to use. Instead, the capistrano-passenger gem Show archive.org snapshot will choose the appropriate restart mechanism automatically based on your installed the passenger version.
Installation
-
Add to your
Gemfile
:gem 'capistrano-passenger', require: false
-
Add to your
Capfile
:require 'capistrano/passenger'
-
Declare which server role should be restarted (optional). Usually passenger tries to restart all servers with the
app
role. If you have dedicated Sidekiq servers with theapp
role, adjust thepassenger_roles
setting to exclude them.set :passenger_roles, :app # This is the default
-
Remove any homegrown
deploy:restart
orpassenger:restart
tasks. The gem will provide both, and hook itself afterdeploy:publishing
automatically.
See the project's readme document Show archive.org snapshot for more information.
Important notice
It is possible you get an "error" message like this:
*** ERROR: You are not authorized to query the status for this Phusion Passenger instance. Please try again with 'sudo'.
This happens because your application never ran with the current passenger instance (probably due to no requests to it) and the passenger-config
command runs without superuser permissions. This won't stop or break your deploy as the capistrano-passenger
gem will execute the passenger-config restart-app
with the option --ignore-app-not-running
and due to that the command will exit with return code 0
. With the next request to your application passenger will start your application based on the code you just deployed.