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 migrations on docker app start #298

Closed
wants to merge 1 commit into from

Conversation

timcowlishaw
Copy link
Contributor

One approach to running docker on app start - we can't simply add the command to the dockerfile as this will run on all of the containers that use that image (eg app, mqtt-task, sidekiq, auth, etc, etc) causing a race, so instead we create another ephemeral container which runs the migrations then quits.
The only downside to this is that the output from db:migrate goes into the logs for that container, so we don't see whether migrations have been run or not in the terminal, and in the case of long-running migrations (Which ideally shouldn't happen often, if at all, apart from the big kits refactor), they can take a little while to appear.

reading this it appears that there's a school of thought that docker(-compose) shouldn't be responsible for migrations and that they should be run manually when needed. Maybe worth thinking through it and deciding if this is really what we want! (I'm not strongly for or against but probably worth understanding the issues better!

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

Successfully merging this pull request may close these issues.

2 participants