Skip to content
Preview. LawFive's code and server image aren't public yet, so some steps here won't work until they are.

Backups

A server keeps its data in two places: the Postgres database, and the photos. Back up both, together, and keep .env, since AUTH_SECRET is what unlocks secrets saved in the web app.

Run these from the folder with compose.yaml.

The database:

Terminal window
docker compose exec -T db pg_dump -U lawfive lawfive | gzip > lawfive-db.sql.gz

The photos, unless they’re in an S3 bucket, in which case back up the bucket instead:

Terminal window
docker compose run --rm --no-deps --entrypoint "" -v "$PWD:/backup" server \
tar czf /backup/lawfive-uploads.tar.gz -C /data uploads

This writes as the image’s node user (user ID 1000), so on Linux the folder has to be writable by it.

Copy the two files and .env off the machine, on a schedule that suits you.

Do this on a new install, before its server has started for the first time, so the database is still empty. Keep the same AUTH_SECRET in .env.

Terminal window
docker compose up -d db
gunzip -c lawfive-db.sql.gz | docker compose exec -T db psql -U lawfive lawfive
docker compose run --rm --no-deps --entrypoint "" -v "$PWD:/backup" server \
tar xzf /backup/lawfive-uploads.tar.gz -C /data
docker compose up -d

Try a restore on a spare machine at least once, so you know your backups work before you need them.

Anyone can keep their own copy, whichever server they’re on. Settings → Account has:

  • Download everything: a zip of the account’s records as JSON, with its tracks and photos, and a short README of the format.
  • Restore from an export: merges a zip into the account. Records keep their ids, and where a record is in both, the one changed last is kept. Running it twice changes nothing more.

This also moves an account from one server to another.

A restore is written to the container’s temporary folder while it’s read, so it needs that much free space, up to the 2 GB limit. Behind a proxy, check that the proxy’s upload limit allows it too.