Move a project from Railway
Move a Railway project to openrail by recreating its services, copying its variables and moving its database data; the one-step importer comes in a later release.
Take stock
With Railway's CLI, in a folder linked to the project:
railway status
railway variables --json --service web > web.jsonRun the second line once per service, changing --service and the file name. Write down each service's repo, branch and root directory, its databases, and its custom domains.
Create the project
- Log the
openrailCLI in to your console: see Set up the CLI. - Create the project:
openrail init -n my-app- Add each database with the same name it had on Railway, so references like
${{Postgres.DATABASE_URL}}keep working. On the canvas, select + Add, Database, then the engine, and rename it if needed. Or:
openrail add -d postgresRecreate the services
For each service built from a repo:
- On the canvas, select + Add, then GitHub Repo, and paste the repo's address.
- Set the same Branch and Root directory in Settings, Source.
- Name the service as it was named on Railway.
A railway.json or railway.toml in the repo is read and applied: start command, pre-deploy command, health check path and environment overrides come from it. See Config as code.
For a service built from an image, select + Add, Docker Image, or run openrail add --image <image>.
Have a Docker Compose file? openrail import compose docker-compose.yml stages every service in it at once. See Import Docker Compose.
Copy the variables
Railway's JSON output is one object of names and values. This loop sets each one on the linked openrail service, skipping Railway's own RAILWAY_* names, which openrail provides itself:
openrail link -s web
jq -r 'to_entries[] | select(.key | startswith("RAILWAY_") | not) | "\(.key)=\(.value)"' web.json |
while IFS= read -r kv; do openrail variables set "$kv" --skip-deploys; doneIt needs jq. Values that span several lines do not survive the loop; set those in the service's Variables tab. Sealed variables on Railway come out empty, so set them by hand too.
Reference variables such as ${{Postgres.DATABASE_URL}} and ${{shared.API_KEY}} use the same syntax and work unchanged, as long as the services have the same names.
Move the data
Copy each database with one pipe through openrail connect. See Move a database from Railway.
Deploy
- On the canvas, the banner lists the staged changes. Select Details to read the diff.
- Select Deploy.
- Wait until every service shows Active.
Move the domains
- At your DNS provider, lower the TTL of each record to 300 seconds a day ahead.
- Add each custom domain to its service: see Custom domains and HTTPS.
- Switch the DNS records to the values the console shows, last, once everything else works.
Keep your CLI habits
openrail alias installrailway up, railway logs and the rest now talk to your console. See The railway alias.
What success looks like
- Every service shows Active.
- Row counts match between the Railway database and the openrail one.
- The custom domains show Active on openrail.
- You can stop the services on Railway.