Back up and restore
Back up before changes; restore only into a new Compose project.
You need#
- A running PostgreSQL service and an existing backup destination directory.
- A repository checkout with its
.env,docker-compose.yml,justfile, andinfra/compose/scripts, or the release repository's backup and restore scripts for copied files. - Enough private storage for the backup.
Step 1 Create a backup#
From a repository checkout that runs the server, run:
just backup <destination-directory>
If you do not use just, run ./infra/compose/backup.sh <destination-directory> from the same directory. For copied files, run the release repository's infra/compose/backup.sh <destination-directory> from the server folder, with COMPOSE_FILE listing the files the server uses:
# /path/to/peppy-release is a clone of the repository at your release tag.
COMPOSE_FILE=docker-compose.yml:compose.caddy.yml /path/to/peppy-release/infra/compose/backup.sh <destination-directory>
Let in-flight requests finish first.
Backup contents and behavior
The backup contains a PostgreSQL dump, attachment-storage data and filer metadata, plus a manifest and SHA-256 checksums. The command waits for API requests to drain, stops the API and attachment storage while it copies data, then restarts services that were running before it started.
Use the same Compose files that start the server, listed in COMPOSE_FILE with colons. For Caddy:
COMPOSE_FILE=docker-compose.yml:infra/compose/compose.caddy.yml just backup <destination-directory>
Add infra/compose/compose.mcp.yml when MCP is enabled. A backup includes MCP state only when that file is selected.
Step 2 Restore into a new project#
From a repository checkout that runs the server:
just restore <backup-directory> <new-project-name>
For copied files, run the release repository's infra/compose/restore.sh <backup-directory> <new-project-name> from the server folder, with COMPOSE_FILE listing the files the server uses:
COMPOSE_FILE=docker-compose.yml:compose.caddy.yml /path/to/peppy-release/infra/compose/restore.sh <backup-directory> <new-project-name>
Restore checks
<backup-directory> is the timestamped peppy-<project>-<time> folder inside your destination. The new project name must differ from the backup's source project and have no existing target volumes. Restore verifies the manifest, checksums, image layout, and image compatibility. It starts PostgreSQL only to load the dump, then leaves migrations and the API stopped.
Use the same COMPOSE_FILE setting for restore:
COMPOSE_FILE=docker-compose.yml:infra/compose/compose.caddy.yml just restore <backup-directory> <new-project-name>
Start the restored project with the same files and its new project name. Choose a different API_HOST_PORT if the old server still runs.
docker compose -p <new-project-name> --env-file .env -f docker-compose.yml -f infra/compose/compose.caddy.yml up -d
# Copied files:
docker compose -p <new-project-name> --env-file .env -f docker-compose.yml -f compose.caddy.yml up -d
Good to know#
- The backup does not include the MCP control volume.
- Use the same Compose files for backup and restore.
- Keep backup files private because they contain server recovery material.
- The archive is not separately encrypted. Devices encrypt vault contents, but the archive also contains database metadata; keep the archive private.
- Restore validates the manifest, requires one checksum entry for every required artifact, then verifies the SHA-256 checksums before it creates target volumes.
- Restart server replicas, re-sync clients, and reapply revocations before reopening access.
- Peppy runs as one server node and does not provide high availability.