Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Rails migrations as Kubernetes jobs #11

Open
willtcarey opened this issue Nov 13, 2021 · 0 comments
Open

Run Rails migrations as Kubernetes jobs #11

willtcarey opened this issue Nov 13, 2021 · 0 comments

Comments

@willtcarey
Copy link
Member

Reading through this article https://www.honeybadger.io/blog/rails-on-kubernetes/.

They do a really nice thing of running the Rails migrations as a Kubernetes job. That just....makes sense.

Cons of our current setup is

  • Application is prevented from starting up while migrations are running
  • ^Because of the above long running migrations are pretty dangerous. Those translate to application downtime.
  • Extra code has to be added to every application.rb

Pros of running it as a job

  • We can run the migrations before we even tear down old instances of the application meaning no downtime.

Cons of running it as a job

  • All migrations must be backwards compatible.
  • You can't remove a column that the application still depends on in a migration because that old instance of the application will still be running. You have to make a migration that adds a new column and changes the code to rely on that new column, then make a new deployment which cleans up the old database column. This is a pretty common paradigm in large scale applications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant