Hacker News new | ask | show | jobs
by rendaw 570 days ago
I think first and foremost, if you're going to use a tool like this, you need to do everything through the tool.

That said, for zero downtime migrations there are a number of techniques, but it typically boils down to splitting the migration into two steps where each step is rolled out to each server before starting the next: https://teamplify.com/blog/zero-downtime-DB-migrations/ https://johnnymetz.com/posts/multistep-database-changes/ etc

I'm not sure if there's anything that automates this, but it'd probably need to involve the infrastructure layer (like terraform) too.

Edit: There's one other approach I've heard of for zero downtime deployments:

Start running the new version in new instances/services parallel to the old version, but pause it before doing any database stuff. Drain client connections to the old version and queue them. Once drained, stop the old version, perform database migrations, and start the new version, then start consuming the queue.

This is (I think) more general but you could get client timeouts or need to kill long requests to the old version, and requires coordination between infrastructure (load balancer?) and software versions.