On Fri, May 18, 2012 at 04:09:02PM +0800, Martin wrote:
> What is the best practice to do a deployment? The best I could come
> up with is the following:
> 1. Tell the loadbalancer to stop autoscaling
> 2. Kill all instances but one
> 3. git pull on that last instance, run syncdb, migrate, collectstatic,
> makemessages, rebuild_index, etc.
> 4. Deployment is done Kill fcgi processes on that last instance
> 5. Create a snapshot of that last instance
> 6. Tell the loadbalancer that new instances, from now on, can be created off
> of that new snapshot
> 7. Allow the loadbalancer to do autoscaling again
>
> Am I missing anything? Does anyone have experience with this? Is there a better
> way to do it?
I would say, leave the specifics aside and concentrate on strategy
first because specifics vary greatly. I see that you are talking about
a load balancer different from what I have seen (I have seen - A10
doing DNS only load balancing, and custom written request based proxy
load balancing) and I am not sure what a Amazons Customer owned
load-balancing would be.
Speaking of general strategies, the first aim is to nullify downtime
when doing deploy. Which means that you will have one instance
running, while you are upgrading another and then roles will reverse
in order to complete the process.
In large scales, an automation strategy is adopted where you do a push
based deploy , one zone at a time, and then when all zones are
deployed the let the load balancer manage the instances. So, it looks
me to that you are doing it right for your solution and you are
perhaps looking to that little extra automation.
My solution has been to let a service on the host machine be read to
start other services on events and then do push based deploy so that
application is deployed and then the service listening for events
would recognize the new app and restart the service. The DNS load
balancer would be zone based so based and take effect after the
process.
Hope this helps,
Senthil