[5650] feat(infra): Railway preview template as code (WP2) - #5665
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Live verification transcript (WP2 acceptance): |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bb8f8a0 to
61971ae
Compare
6d1ddd4 to
d82bed4
Compare
Railway Preview Environment
Updated at 2026-08-03T06:54:52.461Z |
d82bed4 to
8cfd818
Compare
61971ae to
e15f1f7
Compare
8cfd818 to
22ef7cd
Compare
e15f1f7 to
6fd6ea8
Compare
6fd6ea8 to
7f492e0
Compare
22ef7cd to
10b3a87
Compare
Part of the clone-based Railway preview redesign (#5650, WP2 of 3). Do not merge before #5664; merge order is bottom-up through the stack.
The clone-based design keeps one always-configured "template" environment that every PR preview is cloned from. Until now that template only existed as live Railway state, built by spike scripts: anyone could hand-edit it, and nothing recorded what "correct" looks like. This PR makes the template code.
What changes
hosting/railway/oss/template/template.json: the full definition of the 13-service preview stack: parameterized images (app tag and wrapper tag are inputs;latestandpr-*are refused by guard), per-service startCommands and restart policies, volumes, variable inventory with secret annotations (names and resolution sources only, never values), and deploy-order stages.apply.sh: idempotent converge of a live environment to that definition.--dry-runprints a structured diff and exits 2 on drift, 0 when clean; the default mode applies the delta (create-missing, image fixes, bulk variable upserts, startCommand clearing via the proven empty-string workaround). It refuses to touchagenta-oss-pr-*projects and never deletes services or volumes (destructive drift is reported for a human).47-railway-template-drift.yml: daily drift check (06:30 UTC, offset from the cleanup cron) plus manual dispatch; fails loudly when the live template diverges from the definition.README.md: the change-management protocol. Template changes are PRs; additive-first ordering relative to code PRs (like DB migrations); test on a clone before applying to the template; the drift check catches hand-edits.Verification (live, against the test bed's
pr-templateenvironment)--dry-runexits 0 in 17 API calls with the definition matching live state.DRIFT var-extra service=gateway), removed by apply, and the follow-up dry-run was clean again.latest,pr-*, andagenta-oss-pr-*project names are refused before any API call.:latestto pinnedv0.107.0, because Railway'senvironmentPatchCommitsilently no-ops when a patched tag equals the template's tag.latestin the template would break every preview whose PR tag matched, and pinning is the documented production rule from the spike.Full transcript in the PR comment below. shellcheck, bash -n, jq parse, and actionlint are clean.
Refs #5650
https://claude.ai/code/session_011zdniFW44QDqcs4Nz8n3hr