|
What's the best way to automate deployments and any migrations that might be required for those deployments? Right now the deployment model I'm planning has hosts periodically running a configuration management tool (puppet or chef) which checks for new builds, grabs a new build if available, and runs that build. I was going to have each host run db:migrate before they start running new code. I suspected that two hosts doing this at once would step on each other's toes, and when I tested it I confirmed my suspicion. There are a few ways I could deal with this. I could implement some kind of distributed mutex, either in the database or in something like DynamoDB, and just have a new rake task that gets a lock and then invokes db:migrate. I could designate one host as the migrate host. I'm planning on deploying with AWS auto-scaling groups, and that would make this method more complicated. For each deploy, I'd need to suspend terminate processes for the auto-scaling group, pick a migrate host, run migrations, and then resume terminate processes. I could also spin up a single micro instance for each deploy that only does migrations and anything else that needs to be done once on a single host. Each deploy would cost an extra $0.02. Or, I could just forget about automating migrations, and realize that any deploy that requires a migration is going to also require human intervention. Am I missing anything? Or am I approaching this totally wrong? Oh, I'm also investigating whether Heroku could work for us. It's my first week with this employer, and I don't know enough about the application stack to make that call yet.
|
# ¿ Mar 2, 2012 19:07 |
|
|
# ¿ Apr 25, 2024 21:18 |
|
prom candy posted:Have you looked into Capistrano? Your set up is a little more complicated than mine but if there's someone out there who's solved your particular problem it's fairly likely that they've done it with Capistrano. Maybe I'm not well acquainted enough with it, but it seems like Capistrano wouldn't be appropriate for auto-scaling groups. Capistrano pushes out updates, but auto-scaling hosts need to pull the assets they need when they get provisioned. If you do a cap deploy and a host gets added to the group during the deploy, the cap deploy would miss it.
|
# ¿ Mar 2, 2012 19:41 |