Skip to content

Post-deploy k8s job for non-schema migrations  #3994

@bjester

Description

@bjester

Current behavior

Recently, we've been adding individual k8s jobs for running specific django management commands for migrating existing data in the database after the deploy has occurred. This has benefits since these data migrations could take a while, and aren't usually critical to the functionality of the site, like schema migrations. Even with critical data migrations, we sometimes deploy those ahead of releases where we'll actually require that the data migrations have ran. Over time, we're accumulating a lot of individual jobs for these one-off migration management commands, usually invoked through the Makefile.

Desired behavior

If we had a generalized mechanism that hooks into the flow post-deploy, we could reuse it for calling these commands and we wouldn't need to create new k8s jobs every time. To start, we could create a new k8s job like we normally do, and have it call a make target, i.e. deploy-migrate, that we could change the recipe of whenever we need to / deploy. Long term, maybe there's a way we could leverage django's migration mechanism which doesn't call these migrations with the other schema migrations (make migrate)

Value add

Less infra requirement, less lingering relics in GCP and in the codebase

Possible tradeoffs

If we go the simple way to start, we could accidentally re-run migration commands if we forget to change the recipe of the make target. That may be a reason to explore leveraging django's migration system, or some other package, which is aware of what migrations have occurred.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions