Deployment tip when using Passenger and Capistrano



2009/09/06 // Leeds // // Feed



A quick tip i picked up from a Gist off Github. Every time you deploy new changes to a rails application powered by Passenger using Capistrano, chances are you’re going to be restarting the application by hitting tmp/restart.txt. The first time you access the site after every restart you’ll experience a short hang whilst the passenger process spawns. A good way to stop this is by pinging the applications URL after you’ve touched the restart file:

desc "Restarts this application when running passenger"
task :restart, :roles => :app do
  run "touch #{current_path}/tmp/restart.txt" 
  `curl -s http://myhost.com $2 > /dev/null`
end

This hits the URL specified and throws the output to /dev/null. It might seem like nothing but if it saves you 10 seconds on every deploy it can’t be a bad thing…

Other (possibly related) posts

Comments