With the introduction of Phusion Passenger Standalone, some of the established wisdom with regards to Capistrano tasks for managing Passenger are a tad outdated.
In particular, the start
and stop
tasks for Passenger are typically NOOPs, and only the restart
task is deemed relevant. This is arguably no longer the case for standalone Passenger, where start
and stop
tasks do make sense, as they did back in the mongrel days.
The following Capistrano tasks illustrate how to start, stop and restart a standalone Passenger setup.
These tasks are for a Passenger setup that uses Unix domain sockets, but they can easily be modified for Passenger instances configured for TCP sockets.
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && bundle exec passenger start --socket /tmp/passenger.socket --daemonize --environment production"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && bundle exec passenger stop --pid-file tmp/pids/passenger.pid"
end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
end
When you use bundled Passenger Standalone using
bundle exec passenger
touchingtmp/restart.txt
doesn't restart application properly. Especially your application won't see new, freshly bundled gems. You need to restart Passenger by stopping and starting.