Docs

Backups

What a backup holds, how to take and restore one, and what the server does on its first start from a backup.

What to keep

A federation is the database and the volumes together. Apart they are useless:

WhatWhy you cannot do without it
The PostgreSQL databaseEverything except media bytes: profiles, chats, messages, settings.
The federation volumeThe Noise key (without it devices cannot connect) and the media files the database refers to.
The caddy volumeCertificates and, with tls internal, Caddy's own certificate authority.
The state directorystack.env with passwords, the federation ID, push keys, TURN and SFU secrets, Compose files.
The APNs .p8 keyNot in the backup: keep it separately.

A database started on another or empty media volume refuses to start with MediaVolumeMismatch.

Taking a backup

python3 tools/mvp-stack.py backup --backup /absolute/path/backup-2026-10-26

The command stops the whole stack for a while so the PostgreSQL snapshot is consistent, archives every volume and the configuration with SHA-256 sums, and starts the stack again, even if archiving failed. The backup directory must be new.

The archive is not encrypted and not signed: it holds private keys and passwords. Keep it like passwords, encrypt it before it leaves the machine, and restore only your own backups.

The stack has no schedule: run the command from cron or a systemd timer at quiet hours. The downtime lasts while the volumes are archived and grows with the amount of media.

Restoring

On a machine without comon-mvp volumes, from the same repository version:

python3 tools/mvp-stack.py restore --state .local/restored --backup /absolute/path/backup-2026-10-26
python3 tools/mvp-stack.py up --state .local/restored
python3 tools/mvp-stack.py check --state .local/restored

restore checks the sums, needs a new state directory and refuses when the volumes already exist: it never overwrites live data. Do not delete a running stack's volumes to try a restore. Keep the same domain and the same image versions.

To rehearse a restore on the same machine, add --project comon-mvp-restored to every command of the restored stack and stop the original before starting the copy: two diverging instances of one federation are not redundancy.

First start from a backup

A restored federation is older than what the apps, relays and the outside world have already seen. So restore adds --restored-backup=<backup name> to the server, and before serving, the first start:

  • checks media: if files of messages and avatars are missing, the server does not start and lists them in the log (restore_missing_media). Restore the media volume taken together with the database, or start the server with --accept-missing-media;
  • renews push keys: nothing old goes out, and devices register again;
  • starts history from a new generation: apps read their chats again instead of skipping what they saw before the loss, and keep for their people the sends made after the backup;
  • holds outbound work: scheduled messages are not sent (their authors can edit or delete them), bot webhooks are not called. /ready shows "outbound": "held".

Later starts with the same name change nothing, so the option may stay.

Once you have checked that everything is fine, release outbound work (with the server stopped):

dc stop federation
dc run --rm --no-deps --entrypoint /app/bin/federation_admin federation \
  --data=/data --postgres-conninfo-file=/run/secrets/postgres-conninfo restores
dc run --rm --no-deps --entrypoint /app/bin/federation_admin federation \
  --data=/data --postgres-conninfo-file=/run/secrets/postgres-conninfo release-outbound
dc start federation

dc is the function from operations.

If push was on, it is off after a restore: old revocations and preview keys need reconciling before devices are admitted again (push).

Checking after a restore

  1. A device already signed in connects and sees the earlier messages.
  2. Signing in from a second device works.
  3. A new message reaches both.

On this page