How should I deploy a patch to a Passenger-based production Rails application without downtime?

Posted by Olly on Stack Overflow See other posts from Stack Overflow or by Olly
Published on 2010-03-31T15:20:59Z Indexed on 2010/03/31 15:23 UTC
Read the original article Hit count: 322

Filed under:
|

I have a Passenger-based production Rails application which has thousands of users. Occasionally we need to apply a code patch (we use git) and the current process for doing this (you can assume there are no data migrations) is:

  • Perform git pull origin [production-branch-name] on the server
  • touch tmp/restart.txt to restart Passenger

This allows us to patch the server without having to resort to putting up a maintenance page, which is great, but it doesn't feel quite right since it's not actually a proper 'deployment', and we still need to manually update the revision file and our deployment doesn't appear in the Hoptoad or NewRelic services we use.

Ideally I would run cap production deploy and just let the standard Capistrano deployment script take care of everything, but is this a dangerous thing to do without putting up a maintenance page? This deployment process seems to be fairly safe in that the new revision is deployed to a completely separate folder and only right at the end of the process is a symlink re-created to switch the currently deployed version, but I'm still fairly paranoid about this somehow resulting in a lost or failed request.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about passenger