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
I found this thread on passenger google group, from what it says your restart task isn't going to work, because if you don't restart your app the process working directory doesn't change. What do you think about that?