Capistrano and Passenger
23 June 2008
To use Capistrano on a Passenger enabled host, you need to add the following lines to your config/deploy.rb file.
namespace :deploy do desc "Restarting mod_rails with restart.txt" task :restart, :roles => :app, :except => { :no_release => true } do run "touch #{current_path}/tmp/restart.txt" end desc "Stop task is a deploy.web.disable with mod_rails" task :stop, :roles => :app do deploy.web.disable end desc "Start task is a deploy.web.enable with mod_rails" task :start, :roles => :app do deploy.web.enable end end
Because in passenger there is no way of stopping or starting your Rails application, I've changed the deploy:start and deploy:stop to deploy:web:enable and deploy:web:disable. The deploy:restart is used by the deploy task, so now your deployment works as expected.
Update:
Don't forget to add the rewrite rules to your apache virtual host config, otherwise the enable disable tasks won't work.
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]