PostgreSQL 18 to 19 upgrade
Orbit's Docker definitions run postgres:19-alpine. The official image keeps each major version in its own directory under /var/lib/postgresql, so a volume created by PostgreSQL 18 holds its data in /var/lib/postgresql/18/docker. The PostgreSQL 19 image refuses to start on such a volume and exits with:
Error: in 18+, these Docker images are configured to store database data in a
...
Counter to that, there appears to be PostgreSQL data in:
/var/lib/postgresql/18/dockerNothing has been lost. Follow the section for your installation.
Who needs this
| Installation | Action |
|---|---|
Local development (docker-compose.yml) | Upgrade the volume, or reset it |
Docker preview (deploy/docker) | Upgrade the volume |
Catalog compose on a host where you can run docker | Upgrade the volume |
Zeabur or another platform without docker access to the volume | Back up and restore into a new PostgreSQL 19 service |
| Managed PostgreSQL such as Supabase, Neon, RDS or Render | Nothing. Orbit runs on PostgreSQL 16 or newer, so upgrade on your provider's schedule. The Render blueprint stays on 18 until Render offers 19 |
Upgrade a Docker volume
Capture a backup first with the routine backup procedure. The upgrade keeps the PostgreSQL 18 files, but an offsite archive is the recovery path if the host itself fails.
If PostgreSQL 19 has already refused to start, the backup has no database to connect to. Start PostgreSQL 18 on the volume for the capture, point the backup's direct database connection at
postgres://orbit:<POSTGRES_PASSWORD>@127.0.0.1:5439/orbit, and stop it afterwards:bashdocker run -d --name orbit-postgres-18-backup -p 127.0.0.1:5439:5432 \ -v orbit-preview_postgres:/var/lib/postgresql postgres:18-alpine docker stop orbit-postgres-18-backup && docker rm orbit-postgres-18-backupThe empty
/var/lib/postgresql/19directory the refused start left behind is harmless, and the upgrade removes it.Stop every container that uses the volume. The command refuses to run while one is running.
bashbun run infra:down bun run preview:downUse the line for your installation. For a catalog deployment, stop the stack from its platform or with
docker compose stop.Find the volume. It is
orbit_orbit-postgresfor local development and<COMPOSE_PROJECT_NAME>_postgresfor the Docker preview, which isorbit-preview_postgresunless you changed the project name. Otherwise list the candidates:bashdocker volume ls --filter name=postgresRun the upgrade from the repository root:
bashbun run postgres:upgrade-volume --volume orbit-preview_postgresIt starts PostgreSQL 18 on the volume, dumps every database and the roles with the PostgreSQL 19 client, initializes PostgreSQL 19 in
/var/lib/postgresql/19/dockeron the same volume and restores into it. It then compares roles, password hashes, extensions and the exact row count of every table with the original, and only reports success when they all match. Any failure removes the new cluster and leaves the volume as it was. The dump is kept in a temporary directory, or in an empty directory you pass with--dump-dir. Pass--userwhen the superuser is notorbit.The volume needs free space for a second copy of the database. The restore rebuilds every index, so expect it to take about as long as a fresh restore of your largest backup.
Start the installation again with
bun run infra:up,bun run preview:upor your platform, and sign in to confirm your workspace is there. The database password is carried over, so no setting changes.Once you are satisfied, remove the PostgreSQL 18 files to reclaim the space:
bashdocker run --rm -v orbit-preview_postgres:/var/lib/postgresql \ --entrypoint rm postgres:19-alpine -rf /var/lib/postgresql/18
Running the command again on an upgraded volume does nothing.
For local development you can instead discard the data with bun run infra:reset and run bun run db:push && bun run db:test-setup && bun run db:seed.
Platforms without access to the volume
Keep the old service on its PostgreSQL 18 image until the new one is ready.
- Capture a backup of the PostgreSQL 18 database with the routine backup procedure, using a PostgreSQL 19
pg_dump. - Create a new PostgreSQL 19 service with a new, empty volume and the same
POSTGRES_USER,POSTGRES_PASSWORDandPOSTGRES_DB. - Restore the archive into it with the region/provider migration procedure, then point the web, realtime and scheduler services at the new database.
- Delete the PostgreSQL 18 service and its volume only after sign-in, documents and attachments check out.
Roll back
Until you delete the PostgreSQL 18 files, you can return to them:
Stop the installation.
Remove the PostgreSQL 19 cluster:
bashdocker run --rm -v orbit-preview_postgres:/var/lib/postgresql \ --entrypoint rm postgres:19-alpine -rf /var/lib/postgresql/19Change the
postgresservice image back topostgres:18-alpineand start the installation. Writes made after the upgrade are lost.