How to perform a rolling restart of the bastard cluster

Does anyone know a good way to restart the Mongrean clan through the rolling capistrano style, for example, one mongrell at a time. It would be great to have a little waiting time there, as well as for everyone to let the mongrel load the rails.

I did some searching and did not find too much, so I was looking for help before I plunged into the mongrel_cluster stone myself.

Thanks!

+7
ruby-on-rails deployment mongrel capistrano
source share
3 answers

I agree with the swing approach more than the approach you are looking for. The problem is that you find yourself in situations where load balancing can move users between different versions of the application during the transition.

The solutions we came across (before finding SeeSaw that we don’t use) had to take half the bastards from the load balancing line. Close them. Update them. Run them. Put these mogrels back online in the load balancer and take the other half. Close the second half. Refresh the second half. Run them. This significantly reduces the time when you have two different versions of the application running at the same time. I wrote a bat bat file for this. (Deploying to Windows is not recommended, by the way)

It is very important to note that database migration can make the whole approach a bit dangerous. If you have only additive migrations, you can run them anytime before deployment. If you delete columns, you need to do this after deployment. If you rename columns, it’s best to split it into a new column and copy the migration data into it to run before deployment and a separate script to delete the old column after deployment. In fact, it can be dangerous to use regular migrations in the production database as a whole if you are not making special efforts to organize them. All this indicates more frequent deliveries, so each update is lower risk and less complex, but is the subject of a different answer.

+3
source share

Seesaw is a gem found in the Rails Oceania Rubyforge Project , which provides such functionality for Mongrezh clusters. However, the project may be suffering from some bit rot, and not havain released the release since 2007. Still worth a look even to pinch ideas :)

+1
source share
#!/bin/bash for PIDFILE in /tmp/mongrel.*; do PID=$(cat ${PIDFILE}) kill ${PID} ${RUN_MONGREL_CMD} ${PID} sleep 2 done 
+1
source share

All Articles