docker-compose.yml that runs Postgres, and a migrate script, and deploy it to Reliant hosting with a managed Postgres. Forge reads the Dockerfile, the compose file and package.json and writes its declarations beside them; no JavaScript changes. This guide was run on a minimal notes API (express + pg) at Forge v1.10.1-0.20261123064811-54313eead62f.
Before you begin
- Docker, and the app in a git repository with a root
Dockerfilethat builds on its own. - Forge:
reliant forgeinside Reliant, ornpx -y @reliantlabs/forge@latestanywhere else. - For a deploy that lasts, a Reliant account with app hosting billing. With no account you can publish a 72-hour preview (step 5).
What the Dockerfile must do
A deploy runsdocker build on the Dockerfile and its context alone, so install and build inside it: a Dockerfile that COPYs a dist/ or node_modules from your machine fails there. The detector takes the port from the compose service’s published port, else EXPOSE, else ENV PORT, and sets PORT in the container. Listen on it, on all interfaces:
server.js (excerpt)
Dockerfile
USER node runs as the non-root user the official image ships. Start with node, not npm start: npm doesn’t forward SIGTERM, so every rollout waits out the grace period. Put node_modules, deploy, .forge and secrets in .dockerignore.
Postgres and migrations
ReadDATABASE_URL (new Pool({ connectionString: process.env.DATABASE_URL })). Hosting fills it from a managed Postgres per environment; dev keeps the compose db service. The detector makes a migrate job, run from the app’s image before every rollout, from the first of: a compose service that migrates, a migrate script in package.json, or prisma, knex, sequelize-cli or drizzle-kit in the dependencies. With Prisma the command is npx prisma migrate deploy; keep prisma (and the prisma/ directory) in the final image, not in devDependencies you prune, because the job runs that image.
1
Preview what Forge would write
terminal
Output (trimmed)
2
Adopt the app and check it
terminal
Output (trimmed)
deploy/kcl/workloads.k now holds api (port 3000, a TCP probe) and migrate (command = ["npm", "run", "migrate"] # check: package.json script "migrate"). Read every # check: line. reliant forge env up dev runs your compose file, as docker compose up did.3
Set secrets
Every compose variable that looks like a credential (Then fix the fallbacks:
SESSION_SECRET: ${SESSION_SECRET}) is a forge.ManagedSecret on staging and prod. Set each from stdin:terminal
process.env.SESSION_SECRET || "dev" runs prod with a public value if the secret is never set. Throw at startup when it is missing.4
Deploy
Signed in:It builds the image, cuts a release, runs
terminal
migrate, then rolls out api. Without app hosting billing it is queued, exits 7 and prints the billing link. The default size is 250m CPU and 1 GiB per workload.With no account, adopt with --claimable so prod fits the anonymous plan, preview, then publish:terminal
Output (trimmed)
--plan-only with --claimable uses no identity and creates nothing. npx -y @reliantlabs/forge@latest env deploy prod --claimable then publishes and prints the URL and a claim link, live for 72 hours. An unclaimed deploy gets no secret values (--claimable adoption says prod “delivers none of SESSION_SECRET until it is claimed”) and no outbound internet, so code that needs either must degrade, not crash. The test app idled at about 28 MiB, well inside 128 MiB. Inside Reliant you are signed in and --claimable is refused (exit 1). See Deploy without an account.5
Verify
terminal
suggested[] commands), 2 not proven, 8 the wait ran out (check later). An app with no OpenTelemetry SDK gets 2, reason_code: no_request_telemetry: “not proven good”, never “passed”. Add @opentelemetry/auto-instrumentations-node (guide) to get real verdicts.Express gotchas
trust proxy. TLS ends at the ingress, so setapp.set("trust proxy", 1)before relying onreq.secure,req.iporsecurecookies.- TypeScript. Compile in a build stage (
npm ci && npm run build) and copydist/into the runtime stage; never ship adist/built on your laptop. - Health. Replace the TCP probe with
tiers.Probes {readinessPath = "/healthz"}once/healthzchecks the pool.
Troubleshooting
this content was refused by the platform's safety scan
this content was refused by the platform's safety scan
An unclaimed deploy is scanned before it goes live, and
reason: claimable_content_refused doesn’t say what was found. Our test of this exact app (node:22-slim, express, pg) was refused at this point: the image was built and pushed, nothing was published, and env status prod --claimable showed published: false. Don’t hand out the claim link in that state. Deploy signed in instead.container …-migrate-1 exited (0) … service did not become healthy
container …-migrate-1 exited (0) … service did not become healthy
A compose
migrate service under a plain depends_on. Use depends_on: {migrate: {condition: service_completed_successfully}}.