Moving from Heroku

Move a running Heroku app to your Base with no gap: the same Procfile, config vars in one file, the database kept or moved, the scheduler, and the domain.

This moves one running Heroku app, shop, to your Base. Heroku 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 the Heroku CLI.

On HerokuOn Oalo
ProcfileThe same Procfile
release process typerelease: line, run before each release
Process types (web, worker)Processes, all started on the first deploy
Dyno typeA size per process in .oalo/app.json
Config varsoalo env, separate for dev and prod
Review appThe preview, dev-<app>
Heroku SchedulerA scheduler: process, or a scheduled workflow
heroku logs --tailoalo logs --env prod --follow
heroku releases:rollbackoalo deploy --rollback
*.herokuapp.com<app>-<workspace>.oalo.ai

The short way: oalo migrate

In the app's repo, oalo migrate heroku works out steps 1 and 2 for you and shows the plan: your Procfile kept as it is, the sizes, the variables and what doesn't carry over (the scheduler, an Aptfile). It changes nothing until you add --apply, and never prints a value.

oalo migrate heroku --from-app shop            # the plan
oalo migrate heroku --from-app shop --apply    # write .oalo/app.json with your dyno sizes
git add .oalo/app.json && git commit -m "Move to Oalo"
oalo deploy --new shop
oalo migrate heroku --from-app shop --apply    # now the app exists: set its variables

It asks the Heroku CLI for the config vars and dyno sizes, so have it installed and signed in. --from-app names the Heroku app when this repo's git remote doesn't. The variables go straight to the live app's settings, with PORT and Heroku'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. Keep your Procfile

Nothing to change. Your release, web and worker lines run as they are: release once before each release, web on $PORT, and every other line as a worker. Workers start on the first deploy; there's nothing to scale up.

Each process runs as one copy. Give it a size with at least the memory its dyno uses today, in .oalo/app.json:

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

The sizes go from tiny (512 MB) to large (2 CPUs, 4 GB). See Live server apps.

Builds. Oalo builds with buildpacks from your repo's files (Node needs its lockfile committed), or from a Dockerfile at the root when there is one. An Aptfile isn't read: if you need system packages, add a Dockerfile.

2. Bring your config vars

Write them to a file:

heroku config --shell -a shop > .env.heroku

Then edit the file before you load it:

  • Delete PORT. Oalo sets it.
  • 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.
  • Delete HEROKU_* values. oalo migrate leaves out every HEROKU_* variable; if your code reads one (an add-on's HEROKU_POSTGRESQL_*_URL, say), set it again under a name of your own.

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 Heroku Postgres and Heroku Key-Value Store (Redis) running, and points your Base at them. Both accept connections from outside Heroku over TLS. With EXTERNAL_DATABASE_URL and REDIS_URL set, your app talks to the same data it always has.

Two things to know:

  • Heroku can change its Postgres credentials during maintenance. On Heroku the variable updates itself; on Oalo, set the new value with oalo env set EXTERNAL_DATABASE_URL --secret --env prod.
  • Keep the Heroku app that owns the add-ons. Destroying it destroys them.

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 Heroku Postgres can go (Redis stays at REDIS_URL). 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. Do this once the app runs on Oalo (step 4), just before you move the domain (step 7):

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

    export SOURCE_DATABASE_URL=$(heroku config:get DATABASE_URL -a shop)
    oalo db restore --from-env SOURCE_DATABASE_URL --env prod --check
    
  2. Stop writes. Maintenance mode stops web requests, and workers keep running, so stop those too:

    heroku maintenance:on -a shop
    heroku ps:scale worker=0 -a shop
    

    Your users get the maintenance page until the domain points at Oalo, so pick a quiet hour.

  3. Copy it. Your Base runs pg_dump against the database itself:

    oalo db restore --from-env SOURCE_DATABASE_URL --env prod
    

    Or from a backup file, which Heroku makes in pg_dump's custom format:

    heroku pg:backups:capture -a shop
    heroku pg:backups:download -a shop      # writes latest.dump
    oalo db restore latest.dump --env prod
    
  4. Switch with oalo env unset EXTERNAL_DATABASE_URL --env prod. The live app relaunches, reading DATABASE_URL (the fallback from step 2).

Three things to know:

  • The URL never goes on the command line, where your shell history would keep it: --from-env names the variable that holds it. Prod asks you to confirm; in a script, add --yes.
  • 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.
  • Your app on Oalo uses the Heroku database until the switch, 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.heroku --env prod
rm .env.heroku
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 commit, 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.

5. Replace Heroku Scheduler

Two ways:

  • A scheduler: process. Add a Procfile line that runs your language's cron library (node-cron, APScheduler, rufus-scheduler, and so on) on the same schedules, in UTC. Each process runs as one copy, so every job runs once.
  • A scheduled workflow. A workflow with a schedule can call one of your app's endpoints with a Run a tool step: see App tools and Triggers.

6. Without heroku run

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

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

7. 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. Point the domain itself at <workspace>.oalo.ai with a CNAME, in place of the Heroku DNS target. 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.

8. Switch Heroku off

Once traffic comes to Oalo, stop the dynos:

heroku ps:scale web=0 worker=0 -a shop

That's easy to undo while you watch the new app. If you kept the database (step 3), or Redis, stop there: the Heroku app holds them. Otherwise, heroku apps:destroy -a shop once you're sure. If you moved the data into your Base, that deletes the old copy.

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