Migrate from Railway to Fly.io
service by service.
Both run containers and bill per second, so the move is mostly packaging and data: a Dockerfile Fly can deploy, your variables, your Postgres and any volume data.
Facts checked against each provider's own pages
The short answer
What maps to what
| On Railway | On Fly.io | Notes |
|---|---|---|
| Railway service (repo, Dockerfile or image) | Fly app + Machines | fly launch uses an existing Dockerfile, generates one, or deploys a prebuilt image with --image[1]. |
| railway.json / railway.toml | fly.toml | Railway's file is deprecated (cutoff 1 Dec 2026)[5]; Fly's is fly.toml[6]. |
| Service variables | fly secrets | fly secrets set restarts Machines (use --stage to defer); bulk import via stdin with fly secrets import[2]. |
| Railway Postgres | Fly Managed Postgres | From $38/month with HA and backups[7]. |
| Railway volume | Fly Volume ([mounts] in fly.toml) | One volume per Machine, per region, not replicated automatically[8]. |
| Serverless (app sleeping) | autostop / autostart | min_machines_running = 0; fly launch writes these settings by default[9]. |
| PR environments | Review apps via GitHub Actions | Fly's official blueprint deploys per-PR review apps[10]. |
The migration, step by step
- 01
Collect your variables before you need them
Railway's sealed variables aren't returned by railway variables or railway run[11], so gather those values from wherever they originated (your secret manager or the issuing service) before the move.
- 02
Package each service
If a service builds with Railway's builder, add a Dockerfile, or push an image to a registry. Then run fly launch in the repo; it uses the Dockerfile or generates one, and writes fly.toml[1].
- 03
Load secrets
Pipe a KEY=value file into fly secrets import, or set them one by one with fly secrets set[2].
- 04
- 05
Move volume data
Download volume files with railway volume files download[13], create a Fly Volume per Machine with a [mounts] section in fly.toml, and copy the data in.
- 06
Add the domain
Run fly certs add for your hostname and create the A/AAAA or CNAME records Fly shows; validation can use AAAA, an _acme-challenge CNAME or a _fly-ownership TXT record[4].
Things the docs warn about
- Fly Managed Postgres runs inside Fly's private network and isn't reachable over the public internet; the import uses fly mpg connect[3].
- Dumps made with pg_dump 17 or newer need the SET transaction_timeout line removed before importing into Postgres 16[3].
- Fly volumes are local to one Machine and region and aren't replicated automatically[8]; run two Machines with two volumes if you need redundancy, and design replication yourself.
- Fly has no free allowance for egress on new organizations[14], but its $0.02/GB rate in North America and Europe is below Railway's $0.05/GB[15].
- Egress through Railway's TCP proxy is billed[12], so a large pg_dump has a cost on the way out.
Run both during cutover, then switch
AW3 Host connects both your Railway and Fly.io accounts, so the old and new deployments run side by side from one dashboard and API instead of a big-bang switch.
Weighted routing sends a small share of traffic to Fly.io first (for example 5%, then 25%, 50% and 100%) while Railway serves the rest. Health checks every 60 seconds watch both; if the Fly.io side fails, failover moves traffic back automatically, and rollback to the previous release is one step. Daily cost sync shows what each provider costs during the overlap, and budget policies alert you if the double-running period gets expensive. Secrets for both are stored encrypted per environment.
When Fly.io has carried all traffic cleanly for long enough that you no longer need the fallback, point DNS at it for good and decommission Railway.
Railway vs Fly.io at a glance
| Railway | Fly.io | |
|---|---|---|
| Category | App platform (PaaS) | App platform (PaaS) |
| Pricing model | Plan fee that counts toward usage, plus per-resource usage (RAM, CPU, egress, volumes)[15] | Pay for resources used, no monthly platform fee[14] |
| Compute billing granularity | Per second: $0.00000386 per GB-second of memory, $0.00000772 per vCPU-second[16] | Machines billed per second while running; stopped Machines pay $0.15/GB/mo for root filesystem only[14] |
| Internet egress (first paid tier) | $0.05/GB, all regions and plans[15] | $0.02/GB North America and Europe; $0.04/GB Asia Pacific, Oceania, South America; $0.12/GB Africa and India[14] |
| Regions / locations | 4 regions: US West, US East, EU West, Southeast Asia (counted from list)[17] | 17 regions (counted from list)[19] |
| Deploy model | GitHub repo, Dockerfile, Docker image, or railway up from the CLI[18] | fly launch (uses or generates a Dockerfile, or --image) then fly deploy; Machines API[1] |
| Persistent volumes | Yes: volumes at $0.15/GB/mo; Hobby up to 5 GB, Pro up to 1 TB[13] | Yes: Fly Volumes (local NVMe) $0.15/GB/mo, one per Machine, not replicated automatically[8] |
| Config file | railway.json / railway.toml are deprecated (stop being read 2026-12-01); replacement is .railway/railway.ts[5] | fly.toml[6] |
Frequently asked questions
- How do I move environment variables from Railway to Fly.io?
- Export them to a KEY=value file and pipe it into fly secrets import. Railway's sealed variables can't be read back through the CLI, so source those values from wherever they were created.
- How do I migrate a Railway Postgres database to Fly.io?
- Enable Public Access on the Railway database to get an external connection string, run pg_dump --no-owner --no-acl, then import the dump into Fly Managed Postgres with fly mpg connect <CLUSTER_ID> -f dump.sql.
- Does Fly.io have an equivalent of Railway's app sleeping?
- Yes. Fly Proxy's autostop and autostart stop idle Machines and start them on the next request; set min_machines_running = 0. fly launch writes these settings by default.
Sources
- Fly.io Docs: Create an app with fly launch. https://docs.fly.io/launch/create (checked 2026-11-16)
- Fly.io Docs: Secrets. https://docs.fly.io/apps/secrets (checked 2026-11-16)
- Fly.io Docs: Import into Managed Postgres. https://docs.fly.io/postgres/import (checked 2026-11-16)
- Fly.io Docs: Custom domains. https://docs.fly.io/networking/custom-domain (checked 2026-11-16)
- Railway Docs: Config as code. https://docs.railway.com/config-as-code (checked 2026-11-16)
- Fly.io Docs: App configuration (fly.toml). https://docs.fly.io/reference/configuration (checked 2026-11-16)
- Fly.io Docs: Managed Postgres. https://docs.fly.io/postgres (checked 2026-11-16)
- Fly.io Docs: Volumes overview. https://docs.fly.io/volumes/overview (checked 2026-11-16)
- Fly.io Docs: Autostop/autostart. https://docs.fly.io/launch/autostop-autostart (checked 2026-11-16)
- Fly.io Docs: Review apps blueprint. https://docs.fly.io/blueprints/review-apps-guide (checked 2026-11-16)
- Railway Docs: Variables. https://docs.railway.com/variables (checked 2026-11-16)
- Railway Docs: PostgreSQL. https://docs.railway.com/databases/postgresql (checked 2026-11-16)
- Railway Docs: Volumes. https://docs.railway.com/volumes (checked 2026-11-16)
- Fly.io Docs: Pricing. https://fly.io/docs/about/pricing/ (checked 2026-11-16)
- Railway Docs: Plans. https://docs.railway.com/reference/pricing/plans (checked 2026-11-16)
- Railway: Pricing. https://railway.com/pricing (checked 2026-11-16)
- Railway Docs: Regions. https://docs.railway.com/deployments/regions (checked 2026-11-16)
- Railway Docs: Migrate from Render. https://docs.railway.com/platform/migrate-from-render (checked 2026-11-16)
- Fly.io Docs: Regions. https://fly.io/docs/reference/regions/ (checked 2026-11-16)
Your next deploy
goes everywhere.
Connect a provider, point a service at it, and ship. Add the second provider when you're ready.
No card needed · Free tier · Pay as you go after that