Skip to content

Back up and restore

Postgres holds everything that cannot be rebuilt. Back it up regularly, and keep a copy away from the database's own disk.

  • Postgres: release snapshots, which release is live, organizations, entitlements, readers and their sign-in links, build history and the audit log. Back this up.
  • Blob store: images and themes, which the worker can upload again by rebuilding from Git, and cached PDFs, which are printed again on demand. Back it up if rebuilding old commits would be inconvenient.
  • The docs themselves live in Git.
  1. Dump the database on a schedule.
    # Docker Compose
    docker compose -f deploy/docker-compose.yml exec -T db pg_dump -U opend -Fc opend > opend-$(date +%F).dump
    # Anywhere else
    pg_dump -Fc "$DATABASE_URL" > opend-$(date +%F).dump

    On Railway, Postgres volume backups are available, but also schedule a pg_dump to the bucket or elsewhere so a copy lives off the volume.

  2. Copy the dumps off the host, and test a restore now and then.

To restore, stop the web service and the worker, restore into an empty database, then start them again:

pg_restore --clean --if-exists -d "$DATABASE_URL" opend-2026-10-16.dump

If blobs were lost too, rebuild the current commit of each release ref through the admin API so the live releases get their images back.