Skip to content

fix: add automated db migrations to docker-compose using an outpost-migrate service#898

Merged
alexluong merged 2 commits into
hookdeck:mainfrom
distroaryan:fix/docker-compose-migrations
May 11, 2026
Merged

fix: add automated db migrations to docker-compose using an outpost-migrate service#898
alexluong merged 2 commits into
hookdeck:mainfrom
distroaryan:fix/docker-compose-migrations

Conversation

@distroaryan
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR introduces an automated migration step to the docker-compose example environment. By adding an outpost-migrate service, the environment now ensures that all database and Redis migrations are fully applied before starting up the core application services (api, log, and delivery).

Why is this needed?

Previously, developers starting up the project locally via docker-compose had to manually manage database migrations. If services started before migrations were applied, it lead to startup crashes due to the prerun check

Changes Made

  • compose.yml: Added the outpost-migrate service running migrate apply --yes. Updated the api, log, and delivery services with a depends_on condition requiring outpost-migrate to complete successfully (service_completed_successfully).
  • compose-postgres.yml & compose-rabbitmq.yml: Added configuration blocks for outpost-migrate to inject the appropriate environment variables (POSTGRES_URL, RABBITMQ_SERVER_URL) and wait for the respective datastore health checks.

How to test

  1. Run docker-compose -f compose.yml -f compose-rabbitmq.yml -f compose-postgres.yml up -d
  2. Verify that the outpost-migrate container spins up, applies the pending migrations, and exits successfully (Exit code 0).
  3. Confirm that the api, log, and delivery services wait for the migration to finish before booting their HTTP servers and consumers.

Screenshots

image

This screenshot from the log service indicates that after running migrations the services are starting successfully

@distroaryan
Copy link
Copy Markdown
Contributor Author

cc: @alexluong
requesting your review

@alexluong
Copy link
Copy Markdown
Collaborator

Awesome, thanks @distroaryan, I'll take a look today/tomorrow or so!

Copy link
Copy Markdown
Collaborator

@alexluong alexluong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @distroaryan for the PR, nice work! Got a few small comments, can you take a look and address?

Comment thread examples/docker-compose/compose.yml Outdated
Comment thread examples/docker-compose/compose.yml Outdated
Comment thread examples/docker-compose/compose-rabbitmq.yml Outdated
… 'migrate' and added the service in awssqs compose file. Cleaned up some of the trailing whitespaces as well
@distroaryan
Copy link
Copy Markdown
Contributor Author

distroaryan commented May 11, 2026

Thanks @distroaryan for the PR, nice work! Got a few small comments, can you take a look and address?

Hii @alexluong , the new commit address the changes that you requested. I have changed the name of outpost-migrate service to migrate service and added the same in compose-awssqs.yml.

I have verified and tested both the changes by setting up the compose files. Let me know if further changes are needed.

Link for the new commit -> link

Thanks

Copy link
Copy Markdown
Collaborator

@alexluong alexluong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@alexluong alexluong merged commit 4b87b8c into hookdeck:main May 11, 2026
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