Skip to content

Move Railway from railway.json to Infrastructure as Code - #19

Merged
rvegajr merged 3 commits into
developfrom
chore/railway-iac
Oct 1, 2026
Merged

rvegajr merged 3 commits into
developfrom
chore/railway-iac

Conversation

@rvegajr

@rvegajr rvegajr commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Stacked on #18. Merge order: #15 → #16 → #17 → #18 → this.

Railway stops reading railway.json (Config as Code) on 2026-12-01. This replaces it with .railway/railway.ts, which is already applied to all three environments and changes nothing that runs.

What the file says

  • The web service in each environment:
    • development: branch develop, dev.coachatron.com
    • uat: branch staging, uat.coachatron.com
    • production: branch main, coachatron.com and www.coachatron.com
  • The same in all three: build npm run build, start npm start, healthcheck / (30s), and 1 replica in us-east4-eqdc4a.
  • Variables: all 14 as preserve(), so no values are in git.
  • Partial web: it owns only the web service. Postgres, its volume and slack-cards (production) aren't declared, and apply can't touch them.
  • Node version: RAILPACK_NODE_VERSION is read from .nvmrc.

What was done to the live project

Step development uat production
railway config plan (Node preserved) already up to date already up to date already up to date
railway config migrate --apply --service web no Config File setting to clear same same
railway config apply (Node preserved) applied, no change applied, no change applied, no change

Nothing was redeployed, and no setting or variable changed. Railway never reads .railway/ on deploy, so merging this changes nothing by itself. Once railway.json is gone, deploys use the service settings above, which the plan confirms are already in place.

The unsafe path I didn't take

railway config migrate's own output named the service coachatron (the live one is web) and declared only build, start and healthcheck. plan showed that applying it would delete all 14 web variables (DATABASE_URL, SESSION_SECRET, the relay keys…) and detach the GitHub source. I rebuilt the file from railway config pull in each environment instead.

Node 24 rollout (done 2026-10-01, owner-approved)

development uat production
Change config apply: RAILPACK_NODE_VERSION 22 → 24 same same change via railway variable set (see below)
Rebuilt (same commit, no code change) 8cb1fb3 9f42394 97012f4
node -v in the container v24.21.0 v24.21.0 v24.21.0
/, /signin / DB-backed 404 200 / 404 200 / 404 200 / 404 on coachatron.com and www
config plan afterwards up to date up to date up to date

slack-cards and Postgres were not touched. Production's previous deployment bf066ff6, still on Node 22, is the rollback point.

Railway bug: in production, config apply with any change fails with "Custom-domain registration is not supported" for coachatron.com and www.coachatron.com. Both domains exist, are verified and have valid certificates, and plan showed only the variable change. The apply was refused before changing anything. The workaround is documented in .railway/README.md.

Guards

test/toolchain.test.ts fails if railway.json comes back, if the file stops taking Node from .nvmrc, or if it starts declaring Postgres or slack-cards.

Checks (Node 24)

npm test 101/101, plus typecheck, lint (0 errors) and build. railway config plan reports "already up to date" in all three environments after railway.json was deleted.

🤖 Generated with Claude Code

rvegajr and others added 2 commits October 1, 2026 13:47
.railway/railway.ts describes the web service in development, uat, and
production, rebuilt from the live configuration with every variable
preserved. Plan reports it already matches all three environments, and it
has been applied to each with no change. It owns only web, so Postgres and
slack-cards are untouched. RAILPACK_NODE_VERSION comes from .nvmrc.
railway.json is deleted before Railway's 2026-12-01 cutoff.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rvegajr
rvegajr changed the base branch from chore/node-24 to develop October 1, 2026 19:58
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.

1 participant