Most instructions for using Capistrano tell you how to make it restart Phusion Passenger by 'touch'ing the restart.txt
file, but this doesn't immediately restart the app - instead the first person to try to use the application will cause it to be restarted, so they will see a delay of at least a few seconds.
This shows how to add a post-deploy task to 'ping' the server, to cause it to restart immediately.
Then add a deploy:ping
task to config/deploy.rb
and set it to run automatically after deploy:restart
. Alternatively you could put it into the deploy:restart
task directly.
TODO: Test the response HTTP header of the ping, that it is a 200, and not some other error response (404/500).