Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: How do you deploy updates to web apps seamlessly?
1 point by RossM on May 26, 2013 | hide | past | favorite | 2 comments
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).

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?)

So far I've come up with two solutions:

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.

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.

So what people are actually using in production systems at the moment?

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).

Thanks



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)


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: