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