

Ask HN: How do you deploy updates to web apps seamlessly? - RossM

I'm looking at implementing continuous deployment on my own projects, but later on in my work products. Ideally, I'd like to be able to `git push production master`, and have the live site update (but eventually have a CI system do this for me on a successful build).<p>My questions are on how the unavailability during source updating, database migration and app server restarting are handled. It's not the end of the world if the app shows a 500 screen for a few seconds or so, but it's preferable that it doesn't (especially if a client happens to be submitting information during the upgrade - did it make it through?)<p>So far I've come up with two solutions:<p>1. Create a mirror system - clone the source tree and update it, duplicate the database and apply migrations, and then switch virtualhosts or symlinks once it's ready to go, however this takes longer and uses more space.<p>2. Deactivate the virtualhost to show a maintenance message, and then reactivate it again once the site is back - but I'd rather avoid this.<p>So what people are actually using in production systems at the moment?<p>My personal projects are Django apps (typical pg-django-gunicorn-nginx stack), however my work projects use PHP (so if a web request comes in mid-update, it can end up using a half-updated app; nasty).<p>Thanks
======
idunno246
I've had it work well with two environments. On the same host, different
ports. Then have ngnix rout to the active port, and have a second Dns that
nginx routes to the inactive one. Push to the inactive one, verify, swap the
ninx config. Migrations are forward/backward compatible and can be applied
whenever. This is really the only tricky part. Static content on CDN with
different urls(hash in name or folder per deploy)

------
nemothekid
I use Capistrano (<https://github.com/capistrano/capistrano>) for our
deployments for zero downtime. It's rails heavy (and requires ruby) but with
tinkering I've also gotten it to deploy my Node and Go apps.

The versioning system is great too, if a deploy is bad, you can simply cap
rollback, which will revert the changes.

