Railway

Reylo Migrate on Railway

Run your migrations as your service's pre-deploy command:

.railway/railway.ts
const web = service("web", {
  // ...
  preDeploy: "npx reylo migrate deploy",
});

Apply it to your project:

$ railway config apply

It runs between the build and the deploy, in a container of its own on your private network. A migration that fails stops the deploy.

Database

Set DATABASE_URL from your Railway database:

.railway/railway.ts
const db = postgres("postgres");

const web = service("web", {
  // ...
  env: { DATABASE_URL: db.env.DATABASE_URL },
});

Builds

A build that type-checks reads your schema before the pre-deploy command migrates it. Give it a database of its own.

Railway's builds can't reach your private network. So use that database's public URL.

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:

Dockerfile
COPY --from=ghcr.io/reylosql/reylo:0.8.3 /usr/local/bin/reylo /usr/local/bin/reylo
COPY reylo/ reylo/

Copy .reylo.yaml too, if you have one. Then run it directly:

.railway/railway.ts
const web = service("web", {
  // ...
  preDeploy: "reylo migrate deploy",
});
Released under the MIT License. Copyright © 2026 Colin McDonnell.

On this page

reylosql/reylo