feat(deploy): bake migrations into relay image, migrate from same image - #748
Merged
Conversation
The relay image shipped without migrations or knexfile, forcing operators to hand-maintain a separate migrate image plus host-mounted migration files — which silently drifts from the code that ships. Bake migrations/ and knexfile.js into the runtime stage and point the prod compose nostream-migrate service at the relay image itself (knex migrate:latest). One artifact, one pull; compose recreates the one-shot migrate container whenever the image digest changes, so migrations re-run on every release with no extra flags. Verified locally: image builds, throwaway postgres, knex applies all 32 migrations, exit 0.
|
Collaborator
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.
Summary
The relay image (
ghcr.io/cameri/nostream:main) ships withoutmigrations/orknexfile.js, so relay-server operators must hand-maintain a separate migrate image plus host-mounted migration files — which silently drifts from the code that ships.migrations/andknexfile.jsinto the Docker runtime stagedeploy/docker-compose.prod.yml'snostream-migrateservice at the relay image itself (node_modules/.bin/knex migrate:latest)Verification
Built the image locally and ran the migrate command against a throwaway postgres:15: all 32 migrations applied (
Batch 1 run: 32 migrations), exit 0,knex_migrationsshows 32 rows with20260812_150000_create_dvm_jobs_table.jslatest. Repo hooks (biome lint, build:check, unit tests) pass.