Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Sock on a Fish
Jul 17, 2004

What if that thing I said?
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.

Adbot
ADBOT LOVES YOU

Sock on a Fish
Jul 17, 2004

What if that thing I said?

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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply