10 days ago
Hi Railway team,
We're preparing to migrate a production service from Config as Code (railway.toml) to the new Infrastructure as Code (.railway/railway.ts) ahead of the 2026-12-01 deadline. Before touching production, we'd like official guidance on a few points where our observations, the docs and the CLI disagree. So far nothing has been applied: we have only run railway config migrate (local files only) and railway config plan.
Environment
- One project,
productionenvironment, one service (referred to here asmy-service), single replica in a single region - Source: GitHub repo, auto-deploy from
main - CLI: railway 5.71.0; IaC SDK: npm
[email protected](Node 22+)
The discrepancy
The repository root contains a railway.toml:
[build]
builder = "NIXPACKS"
buildCommand = "pip install -r backend/requirements.txt -c backend/constraints-prod.txt || pip install -r requirements.txt -c backend/constraints-prod.txt"
[deploy]
startCommand = "bash backend/start.sh"But the build actually runs from the root Dockerfile:
- The build log shows
load build definition from Dockerfileand runs the Dockerfile's steps. - The effective
serviceManifestof the current deployment showsbuilder: DOCKERFILE. - The deployment's
meta.configFileis"/railway.toml", but the service instance'srailwayConfigFileisnull. railway config migrate statusreports "No services in production read Config as Code".- The service instance shows
builder: RAILPACKvia the API, whilerailway config plantreats the builder asnull.
railway config migrate generated a railway.ts that copies NIXPACKS + buildCommand from the toml. We edited it to match what really runs in production:
builder: "DOCKERFILE",dockerfilePath: "/Dockerfile",start: "bash backend/start.sh"- healthcheck path with a 600s timeout
- same region, replica count, domain and port
- variables unmanaged
partial = "my-service"
railway config plan reports "0 to add, 2 to change, 0 to destroy". Both updates are marked safe: build.builder/dockerfilePath (null → DOCKERFILE, /Dockerfile) and deploy.startCommand (null → bash backend/start.sh).
Questions
-
Precedence of railway.toml vs IaC. The Config File path is
null, yet deployments recordconfigFile: "/railway.toml", so the root toml seems to be auto-detected. Afterrailway config applywrites builder/startCommand to the service, does an existing rootrailway.tomlstill take precedence over the IaC-managed values? Docs say "configuration defined in code will always override values from the dashboard". Does that still hold for IaC-written values? Also, why does the toml'sbuilder = "NIXPACKS"not take effect today while the Dockerfile wins? Is that expected behavior we can rely on? -
Does
railway config applytrigger a redeploy? If it does, which configuration would that deployment use while the root railway.toml still exists? -
Is
railway config migrate cutoverrequired when the Config File path is alreadynull? The CLI says: "Cutover clears each service's Config File path and redeploys it." In our case there is nothing to clear. Would cutover still redeploy, with which configuration, and is it needed for IaC to "own" the service? Since there are no saved paths, what wouldrailway config migrate undorestore? -
Safe order for a zero-downtime migration. Our proposed sequence is below. Is it correct, or would you recommend a different order?
- Skip cutover, because the path is already null.
railway config plan --out plan.json, then review it.railway config apply --plan plan.json.- Verify the service instance: DOCKERFILE, /Dockerfile, startCommand.
- Remove
railway.tomlfrom the repo via PR and merge it, which triggers a normal deploy from main. - Verify the new deployment: no
configFile, Dockerfile build, healthcheck passing.
Is there any step here that could deploy the service with no builder or start command, or with NIXPACKS?
-
Docs vs CLI 5.71.0. The IaC docs say
migrate --apply"clears the Railway Config File settings" and describe manual steps: remove railway.toml, clear the custom path, then plan/apply. They don't mentioncutoverorundo. The CLI 5.71.0 help saysmigrate --apply"only touches the filesystem", and Config as Code keeps applying "until you runrailway config migrate cutover". Aftermigrate, it suggested the order cutover → plan → apply. Which is authoritative for CLI 5.71.0? Is the plan'snullvs the API'sRAILPACKfor the builder expected?
This is a business-critical production service, so we want to avoid any unplanned redeploy or build-system change. Thanks for your help!
2 Replies
Status changed to Awaiting Railway Response Railway • 10 days ago
10 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 10 days ago
7 days ago
Thanks for the detailed investigation. I'm preparing a similar migration on Railway Hobby and have the same blank Config File path issue, but with a root-level railway.json.
Our production service runs a single Python worker with a persistent /data volume. The effective restart policy from railway.json is ON_FAILURE with 3 retries, while the dashboard displays 10 retries.
We are using CLI 5.71.0 and preparing .railway/railway.ts, but have not applied any configuration or performed a cutover.
Could Railway staff confirm three things?
-
Default-file handoff: When the service instance's
railwayConfigFileis null but deployments automatically read the rootrailway.json, ismigrate cutoverunnecessary? What supported procedure ensures that the existing file stops overriding IaC without an intermediate deployment using dashboard defaults? -
Deployment ordering: Is there a supported way to preview and stage the IaC configuration before removing
railway.json, without triggering an additional deployment? Doesconfig applynecessarily initiate a deployment for build, start-command or restart-policy changes? -
Persistent-volume safety: How can we confirm that the new IaC definition adopts the existing volume and retains its attachment, region, size and data rather than attempting to recreate or replace it? What rollback procedure is supported if the configuration handoff succeeds but the resulting deployment fails?
Our priority is preserving the existing worker, credentials, effective restart policy and database volume through a controlled maintenance migration.
We would appreciate Railway's recommended sequence for CLI 5.71.0 before performing any production-changing operation.
4 days ago
We have a similar case with 3 services in one project, but our Config File paths are NOT empty and use custom names (/railway.web.json, /railway.api.json, /railway.cron.json), builder NIXPACKS only from those files.
Could Railway staff confirm: (1) config apply while the custom path is still set: safe, and does it redeploy using the file values? (2) migrate cutover seems to target only paths ending in railway.toml/railway.json. For custom-named files, is clearing the path manually in Settings the supported step? (3) After clearing it and deploying, do the values written by IaC take effect?