Skip to content

Backups & Restore

CompassDocs can take full backups on a schedule or on demand, keep a rolling set, restore from any of them, and mirror copies off-site. It’s all in Settings → Backups (admins only).

From 1.20.27 a backup is a set of two files with one name:

  • compassdocs-YYYYMMDD-HHMMSS.dump.enc: the database (a pg_dump of users, documents, versions, tickets, settings and the rest);
  • compassdocs-YYYYMMDD-HHMMSS.files.tar.enc: the uploads volume, which holds document and ticket attachments, images, mail attachments and workspace artwork.

Both are encrypted. Before 1.20.27 a backup was the database alone, so restoring one on a new server brought back every document and ticket but none of their files.

This is different from Import & export, which handles document content as Markdown. Backups are for disaster recovery.

Backups are written to a local volume (mounted at /backups in Docker). The included compose files create a compassdocs_backups volume for this — no setup needed.

In Settings → Backups, set a frequency (Daily or Weekly) and how many to keep. The app checks hourly and runs a backup when one is due, pruning the oldest beyond your retention count. Leave it Off to only back up manually. Pruning removes the copies on this server only (see Off-site copies are never deleted).

Backups now include the attachments, so they are larger than before: roughly the size of your uploads volume more. Check the space on the /backups volume and in your bucket.

Since 0.41, every new backup is encrypted (AES-256-GCM) with the workspace’s master key before it touches disk or an off-site bucket, and files are named .dump.enc. From 1.20.27 the attachments file (.files.tar.enc) is encrypted the same way. Restores handle both encrypted and older plaintext .dump files automatically.

What the attachments file leaves out: the master key file, links and anything else that isn’t an ordinary file or folder, and the scratch files a backup or a restore makes while it runs. A file deleted while the backup is being written (an attachment removed, the trash emptied) is skipped, and the backup still succeeds.

  • Back up now creates a backup immediately (“Backup created (… MB, with attachments)”).
  • Each backup shows With attachments or, for one made before 1.20.27, Database only, and the size of the whole set.
  • Download pulls the encrypted database file to your machine, and Attachments the encrypted attachments file. From 1.20.27 every download is in the audit log as Downloaded backup (backup.download).
  • Restore replaces the entire database with a backup’s contents, and puts its attachments back. This is destructive and irreversible: type RESTORE to confirm, and everyone will need to sign in again afterward.
  • Delete removes the copy on this server. From 1.20.27 it never removes an off-site copy.

From 1.20.27:

  1. Both files are decrypted first. A damaged file, or one made with another master key, stops the restore before anything changes.
  2. The attachments go back first. Files are added, never removed, so files uploaded since the backup are kept. If this step fails, the database hasn’t been touched (“The attachments could not be restored, so the database was not touched”).
  3. Then the database is replaced, except the audit log: entries newer than the backup are kept, so restoring yesterday’s backup can’t erase what was done since. The restore itself is recorded (backup.restore, or backup.restore_failed).

A backup made before 1.20.27 has no attachments file: it restores the database only, and leaves the files as they are.

Every backup can be mirrored to S3 or Azure Blob Storage so it survives losing the server.

Under Settings → Backups → Off-site destinations, fill in the S3 or Azure card and click Save, or Save & test to verify the credentials with a real upload/delete round-trip. Credentials are stored securely and never shown again. This is the easiest path — no restart needed.

S3-compatible (AWS S3, Cloudflare R2, MinIO): bucket, region, optional endpoint (for R2/MinIO), optional key prefix, access key ID, and secret access key.

Azure Blob Storage: container name and a connection string.

Prefer config-as-code? Set these instead (a destination configured in the UI takes precedence):

Terminal window
# S3-compatible
BACKUP_S3_BUCKET=my-compassdocs-backups
BACKUP_S3_REGION=us-east-1
BACKUP_S3_ACCESS_KEY_ID=...
BACKUP_S3_SECRET_ACCESS_KEY=...
BACKUP_S3_ENDPOINT= # set for R2/MinIO
BACKUP_S3_PREFIX= # optional key prefix
# Azure Blob Storage
BACKUP_AZURE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...
BACKUP_AZURE_CONTAINER=compassdocs-backups

Configured destinations show a green badge on the Backups page and on the System info page. A destination being unreachable never fails the local backup; it’s just reported. Both files of a set are copied.

From 1.20.27 the app never deletes anything off-site. Delete and pruning remove the copies on this server only, so an administrator’s account, or ransomware using one, can’t wipe your local and off-site backups in one go. Retire old off-site copies with the storage’s own rules instead:

  • S3: a lifecycle rule that expires objects under your prefix after the number of days you want, and ideally Object Lock on the bucket (compliance or governance mode), so a copy can’t be deleted early even with the credentials CompassDocs uses.
  • Azure Blob Storage: a lifecycle management rule that deletes blobs after a number of days, and ideally an immutability policy on the container.

Before 1.20.27, deleting or pruning a backup also removed its off-site copy. Without a lifecycle rule, your bucket now keeps every backup.