fix: add automated db migrations to docker-compose using an outpost-migrate service#898
Open
distroaryan wants to merge 1 commit intohookdeck:mainfrom
Open
fix: add automated db migrations to docker-compose using an outpost-migrate service#898distroaryan wants to merge 1 commit intohookdeck:mainfrom
distroaryan wants to merge 1 commit intohookdeck:mainfrom
Conversation
Author
|
cc: @alexluong |
Collaborator
|
Awesome, thanks @distroaryan, I'll take a look today/tomorrow or so! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces an automated migration step to the
docker-composeexample environment. By adding anoutpost-migrateservice, the environment now ensures that all database and Redis migrations are fully applied before starting up the core application services (api,log, anddelivery).Why is this needed?
Previously, developers starting up the project locally via
docker-composehad to manually manage database migrations. If services started before migrations were applied, it lead to startup crashes due to the prerun checkChanges Made
compose.yml: Added theoutpost-migrateservice runningmigrate apply --yes. Updated theapi,log, anddeliveryservices with adepends_oncondition requiringoutpost-migrateto complete successfully (service_completed_successfully).compose-postgres.yml&compose-rabbitmq.yml: Added configuration blocks foroutpost-migrateto inject the appropriate environment variables (POSTGRES_URL,RABBITMQ_SERVER_URL) and wait for the respective datastore health checks.How to test
docker-compose -f compose.yml -f compose-rabbitmq.yml -f compose-postgres.yml up -doutpost-migratecontainer spins up, applies the pending migrations, and exits successfully (Exit code 0).api,log, anddeliveryservices wait for the migration to finish before booting their HTTP servers and consumers.Screenshots
This screenshot from the log service indicates that after running migrations the services are starting successfully