PLATINUM DOCS
Self-hosting

Backups

What to back up on the control plane and the hosts, and how to restore the database.

Back up the database and .env together, and the object storage bucket with your store's own tools. Host disks are not a backup target.

Know what to back up

WhatWhereLosing it
The databaseDocker volume pgdataEverything: accounts, sandboxes, templates, keys
Settings and secretsinfra/compose/.envStored secrets become unreadable, signed snapshots invalid
Object storageDocker volume s3data (bundled), or your bucketAll stored templates, snapshots and volumes
Pinned host certificatesDocker volume cpstateEvery host is unschedulable until it re-registers
TLS certificatesDocker volume caddy_dataRe-issued on start, within Let's Encrypt rate limits
Host settings/etc/platinum/host.env on each hostRe-enroll the host

With the bundled store, all stored sandbox data lives on the control plane machine. Replicate s3data off the machine, or use an external bucket.

Dump the database

# on the control plane, in platinum/infra/compose
docker compose exec -T postgres pg_dump -U platinum -Fc platinum > platinum-$(date +%F).dump
cp .env env-$(date +%F).backup

Run it on a schedule, for example from cron, and copy each dump off the machine.

Check a dump

docker compose exec -T postgres pg_restore --list < platinum-DATE.dump | head

Restore the database

Restore into the stack before the server starts.

# on the control plane, in platinum/infra/compose
docker compose up -d postgres
docker compose exec -T postgres pg_restore -U platinum -d platinum --clean --if-exists < platinum-DATE.dump
docker compose up -d

docker compose up -d runs migrate, which brings an older dump up to the running version's schema.

The database now describes the install as it was at dump time. Sandboxes created or deleted since then do not match what the hosts hold.

Back up the bucket

Use your store's replication or versioning, or any S3 sync tool. Do not use lifecycle rules: see Object storage.

Protect sandbox data

With object storage connected, snapshots and volumes keep sandbox data off the host. See Snapshots and Volumes.