Moving from Fly.io

Move a running Fly.io app to your Base with no gap: fly.toml into a Procfile, your Dockerfile as it is, secrets, the database kept or moved, and the domain.

This moves one running Fly.io app, shop, to your Base. Fly keeps serving until your domain points at Oalo, so your users never see a gap.

You need the Oalo CLI, signed in to your Base (oalo login <workspace>), and flyctl.

On Fly.ioOn Oalo
fly.tomlNot read; a Procfile and .oalo/app.json
[processes]Procfile lines, all started on the first deploy
release_commandrelease: line, run before each release
[http_service] and internal_portThe web process, on $PORT
VM sizeA size per process in .oalo/app.json
Machine countOne copy per process
fly secrets, [env]oalo env, separate for dev and prod
Your DockerfileYour Dockerfile
fly ssh consoleNo shell; release: for migrations
*.fly.dev<app>-<workspace>.oalo.ai

The short way: oalo migrate

In the app's repo, oalo migrate fly works out steps 1 and 2 for you and shows the plan: the Procfile, the sizes, the health path, the variables and what doesn't carry over (volumes, a Dockerfile with no USER, a fixed port). It changes nothing until you add --apply, and never prints a value.

oalo migrate fly            # the plan
oalo migrate fly --apply    # write the Procfile and .oalo/app.json
git add Procfile .oalo/app.json && git commit -m "Move to Oalo"
oalo deploy --new shop
oalo migrate fly --apply    # now the app exists: set its variables

It reads fly.toml for the processes, release command, VM size, health check and [env], and asks fly for your secrets' names. Fly never shows a secret's value, so put the values in a .env file and add --env-file .env.fly. The variables go straight to the live app's settings, with PORT and Fly's own left out and DATABASE_URL renamed to EXTERNAL_DATABASE_URL.

Then carry on from step 3. In step 4 the app and its variables are done, so go straight to oalo deploy --env prod. The steps below say what oalo migrate does, and what's left for you.

1. Turn fly.toml into a Procfile

Your Dockerfile is used as it is. Add a Procfile at the repo's root with your [processes], and release_command as release:

release: bin/rails db:prepare
web: bin/rails server
worker: bundle exec sidekiq
  • With no web: line, web runs the image's own ENTRYPOINT and CMD. An app with no [processes] needs only a release: line, or no Procfile.
  • web must listen on $PORT. A server hard-coded to 8080 (the port fly launch sets up) must read $PORT instead.
  • Every line starts on the first deploy and keeps running. Machines that stop when idle become processes that are always on.

Three things your image must do on Oalo:

  • Build for arm64. The official base images all do.
  • Run as a non-root user (uid 1000). The Dockerfiles fly launch makes for Rails and Node already do.
  • Write only to /tmp (256 MB). The rest of the filesystem is read-only, so point caches, uploads and logs (a Rails app's tmp/ and log/, say) at /tmp or stdout.

Each process runs as one copy. Give it a size with at least the memory of its [[vm]], in .oalo/app.json:

{ "sizes": { "web": "medium", "worker": "small" }, "health": "/up" }

The sizes go from tiny (512 MB) to large (2 CPUs, 4 GB). An [http_service] health check's path goes in health. See Live server apps.

2. Bring your secrets

fly secrets list -a shop shows names only: Fly never shows a secret's value again. Get each value from where it came from (your payment provider's dashboard, say), and write them to .env.fly, a NAME=value per line, with the [env] section of fly.toml. Then:

  • Leave out PORT, PRIMARY_REGION and every FLY_* variable.
  • Rename DATABASE_URL to EXTERNAL_DATABASE_URL. On Oalo, DATABASE_URL is always your Base's own Postgres (step 3). Have your code read the new name first and fall back to the old one, such as process.env.EXTERNAL_DATABASE_URL || process.env.DATABASE_URL. Then if you move the data into your Base, removing EXTERNAL_DATABASE_URL is the whole switch.

Variables are secret unless set with --public, and only public ones reach your Dockerfile's build as ARG NAME. If the build needs [env] values, load them separately: oalo env set --file env.public --public --env prod. Secrets never do.

You'll load it in step 4, once the app exists.

3. Keep your database where it is, or move it

The simplest move keeps your database running and points your Base at it. Your Base reaches it over the internet, not Fly's private network, so:

  • A database with a public URL (Supabase, Neon and the like) works as it is: set its URL as EXTERNAL_DATABASE_URL.
  • Fly Postgres listens only on Fly's private network unless you give it a public address. Fly's docs cover connecting from outside Fly.
  • Upstash Redis made through Fly is private to Fly's network too. Use a Redis with a public URL, set as REDIS_URL.

Anything at *.internal or *.flycast can't be reached from your Base.

Volumes don't come along: a process can write only to /tmp (256 MB), which is emptied when it restarts. Move volume data to object storage or the database first.

Your Base also has its own Postgres, which the app reaches at DATABASE_URL. New tables can go there from day one: see App environment.

Or move the data into your Base

oalo db restore copies the database into your Base's own Postgres, so the app reads it at DATABASE_URL and the old database can go. Workspace admins can run it, for a database whose dump is up to 10 GB, from Postgres 18 or older, and with room for it on your Base. Writes made after the copy starts aren't in the copy, so stop them first.

Fly Postgres is private to Fly's network, so your app on Oalo can't use it in the meantime, and you make the dump on your machine, through fly proxy. Do this before the app's first oalo deploy --env prod (step 4), and leave EXTERNAL_DATABASE_URL out of .env.fly:

  1. Make a dump and check it. In one terminal:

    fly proxy 15432:5432 -a shop-db
    

    In another, with the database's password and pg_dump 18 or older (the version your Base's tools read):

    pg_dump --format=custom --no-owner --no-privileges -d "postgres://postgres:<password>@localhost:15432/shop" -f shop.dump
    oalo db restore shop.dump --env prod --check
    

    --check does everything except the write, and reports the tables (rows and size), the extensions and any conflicts.

  2. Stop writes with fly scale count 0 -a shop. Your users can't reach the app until it's live on Oalo and the domain points there, so pick a quiet hour.

  3. Copy it. Make the dump again, now that nothing writes, and restore it:

    pg_dump --format=custom --no-owner --no-privileges -d "postgres://postgres:<password>@localhost:15432/shop" -f shop.dump
    oalo db restore shop.dump --env prod
    

Then go on with step 4. The live app finds its data at DATABASE_URL from its first start.

A database with a public URL (Supabase, Neon and the like) needs no dump: your Base runs pg_dump against it itself. Do this once the app runs on Oalo against that database (step 4), just before you move the domain (step 6):

read -rs SOURCE_DATABASE_URL && export SOURCE_DATABASE_URL   # paste the URL; it isn't shown
oalo db restore --from-env SOURCE_DATABASE_URL --env prod --check
fly scale count 0 -a shop
oalo db restore --from-env SOURCE_DATABASE_URL --env prod
oalo env unset EXTERNAL_DATABASE_URL --env prod

That's check, stop writes, copy, and switch: the live app relaunches, reading DATABASE_URL (the fallback from step 2). The URL never goes on the command line, where your shell history would keep it.

Two things to know:

  • It's all or nothing. A clash with a table, view, sequence, type or function already in prod is refused, and the reply names them. So is an extension Oalo doesn't allow. A failed restore leaves prod as it was. See "Bringing data in" in App environment. Prod asks you to confirm; in a script, add --yes.
  • Until the switch, your app on Oalo uses the old database, so a write from it during the copy (a worker's, say) is lost too.

4. Deploy it

From your repo's folder:

oalo deploy --new shop

This makes the app from your commits, links the folder to it and starts its preview. Load the variables from step 2 into the live app, then go live:

oalo env set --file .env.fly --env prod
rm .env.fly
oalo deploy --env prod

Every line of the file is set, or none: a line naming a variable Oalo sets (PORT, DATABASE_URL, anything starting with OALO_) refuses the whole file and says which. The preview has its own variables (--env dev), so give it test keys.

Oalo builds the image, runs release, starts every process and waits for web to answer before it serves traffic. If any step fails, it says why and nothing goes live. The app is now at shop-<workspace>.oalo.ai. Try it there before you move the domain.

A preview runs your language's dev server, not the image. An app in a language Oalo doesn't recognize, built only from its Dockerfile, has no preview: its first oalo deploy --env prod is where it runs.

5. Without fly ssh console

There's no one-off shell. Migrations belong in the release: line, which runs before every release. A one-off script against a database you kept (step 3) can run from your machine.

A scheduled job can be a scheduler: process that runs your language's cron library (one copy, so every job runs once), or a workflow with a schedule that calls one of your app's endpoints: see App tools.

Logs: oalo logs --env prod --follow. Rollback: oalo deploy --rollback.

6. Move your domain

  1. In the dashboard, open the app and add the domain under Custom Domain.
  2. Add the CNAME record it shows at your DNS provider. That proves the domain is yours and gets its certificate.
  3. Replace the domain's Fly records (A and AAAA, or a CNAME) with a CNAME to <workspace>.oalo.ai. A root domain (example.com) can't have a CNAME: use your DNS provider's ALIAS, ANAME or flattened CNAME.
  4. Wait for Your app is live at in the panel, usually 5 to 30 minutes after DNS updates. It's served over HTTPS.

An app has one custom domain. To serve both www and the root, add one and redirect the other to it with your DNS provider's forwarding.

7. Switch Fly off

Once traffic comes to Oalo, stop the app's machines:

fly scale count 0 -a shop

That's easy to undo while you watch the new app. Then fly apps destroy shop, which deletes its volumes too. If you kept Fly Postgres (step 3), it's its own Fly app: leave that one running. If you moved the data into your Base, destroy that one too once you're sure (fly apps destroy shop-db).

Leaving again

Your code stays a git repo and your data comes out as plain SQL (oalo db dump). See "Undock any time" in Bring your repo.

Related
Try it on your own Base

Sign up, install the CLI, and deploy your repo in a few minutes.

bring your repo