Fly.io
Reylo Migrate on Fly.io
Run your migrations as Fly's release command:
[deploy]
release_command = "npx reylo migrate deploy"It runs once per deploy, on a temporary Machine with the new image. A migration that fails stops the deploy.
Database
Attaching a Managed Postgres cluster sets DATABASE_URL on your app:
$ fly mpg attach <cluster-id>Fly recommends the cluster's direct connection for migrations. Set it as a secret of its own:
$ fly secrets set DIRECT_DATABASE_URL="postgresql://…@direct.<cluster-id>.flympg.net/…"Then point direct_url at it:
direct_url: ${DIRECT_DATABASE_URL:-${DATABASE_URL}}Builds
A build that type-checks reads your schema before the release command migrates it. Give it a database of its own.
Fly sets your secrets only when your app runs, not while it builds. So pass that database's URL as a build secret.
Other images
A Next.js standalone build, or any image without your node_modules, has no reylo command. Copy it from Reylo's image, with your reylo directory and .reylo.yaml:
COPY --from=ghcr.io/reylosql/reylo:0.8.3 /usr/local/bin/reylo /usr/local/bin/reylo
COPY reylo/ reylo/
COPY .reylo.yaml ./Then run it directly:
[deploy]
release_command = "reylo migrate deploy"The release command replaces your image's CMD, and its ENTRYPOINT still runs. So start your app from CMD.