Перейти к содержимому

Backup and restore

A Squad backup is one file with everything your instance needs to start again somewhere else. It restores into any way of running Squad, which is also how you move an instance to another machine or from Docker to systemd.

The .tar.zst file has the database, uploads, search index and settings, and the passwords and keys Squad made on its first start.

Squad also backs up by itself before it starts a newer release on older data. That backup has the database, passwords and keys but not uploads, and Squad keeps the newest 3.

Окно терминала
docker exec fluxer fluxerd backup --out - > fluxer-$(date +%F).tar.zst

With the compose file, the command is docker compose exec -T fluxer fluxerd backup --out - > fluxer-$(date +%F).tar.zst.

Squad shows a maintenance page while it copies uploads and the search index, and stays up the rest of the time. When a backup is already running, a second one stops with “another backup or restore of this instance is running”.

Pass --skip with the parts you don’t want in a backup, such as uploads that your object store already backs up. Repeat it, or list the parts with commas between them.

Окно терминала
rexctl backup --skip uploads
rexctl backup --skip uploads,search --skip nats

Without rexctl, fluxerd backup --skip uploads,search does the same.

PartWhat the backup leaves outWhere you can leave it out
databaseThe PostgreSQL databaseEvery way of running Squad
uploadsThe files people uploadEvery way of running Squad
searchThe search indexEvery way of running Squad
valkeyValkey’s dataEvery way of running Squad
natsThe message queueEvery way of running Squad
certificatesThe edge’s own certificate authorityOne container or systemd, not the older layout with many containers

rexctl backup --without-uploads is the same as --skip uploads. rexctl refuses a part that the way your instance runs doesn’t have, and lists the parts it does have.

rexctl backup list and rexctl backup verify show what each backup leaves out. When rexctl deletes older backups, it keeps the newest backup that has each part. rexctl rollback only uses backups with every part, and upgrades and rexctl migrate always make full backups.

A restore keeps what the instance has for each part a backup leaves out, and on a new machine those parts start empty. Before it changes anything, rexctl restore says which parts the backup lacks. A backup without the database restores only the other parts. The database stays as it is, or starts empty on a new machine. After you restore a backup without search data on a new machine, run rexctl search reindex.

Set these and Squad backs itself up into the backups folder of its data folder.

fluxer.env
FLUXER_BACKUP_SCHEDULE=daily
FLUXER_BACKUP_KEEP=7
FLUXER_BACKUP_HOUR=3
SettingHelm valueWhat it doesDefault
FLUXER_BACKUP_SCHEDULEbackup.scheduleHow often to back up, as daily, weekly or offoff
FLUXER_BACKUP_HOURbackup.hourThe hour it starts, from 0 to 233
FLUXER_BACKUP_KEEPbackup.keepHow many scheduled backups to keep before deleting the oldest7

The hour is in the machine’s time zone, which is UTC in the container image.

With rexctl, rexctl backup schedule daily sets up the schedule.

With rexctl on Linux, a systemd timer or cron job runs the backup at about 03:00. On Docker Desktop, rexctl sets FLUXER_BACKUP_SCHEDULE and Squad backs itself up.

A backup on the same disk doesn’t help when the disk fails. Copy each backup somewhere else, such as another machine, a NAS or object storage.

Окно терминала
rsync -a /var/lib/docker/volumes/fluxer-data/_data/backups/ backup@storage.example.org:/srv/fluxer/
rclone copy fluxer-2026-12-01.tar.zst remote:fluxer-backups

The first line copies the scheduled backups out of the Docker volume. Under systemd they are in /var/lib/fluxer/backups, which only the fluxer account can read, so run the copy as root or as the fluxer account.

A backup has every password and key of your instance, unencrypted. Encrypt each copy before it leaves the machine, for example with age, or with a tool that encrypts on its own, such as restic or an rclone crypt remote.

Окно терминала
age -r age1examplepublickey... -o fluxer-2026-12-01.tar.zst.age fluxer-2026-12-01.tar.zst

With rexctl, this command takes your newest backup, from its own backups and the ones Squad makes by itself inside its container, encrypts it for your age public key and copies it over SSH. rexctl restore --age-identity key.txt restores the .age file.

Окно терминала
rexctl backup copy-to --age-recipient age1examplepublickey... backup@storage.example.org:/srv/fluxer

A restore runs in one of two situations. Usually Squad is stopped and you run fluxerd restore on its data, as below. After you go back to an older release, Squad is running but not ready, because the data is newer than the code, and you run fluxerd restore inside the running container, pod or service to go back a version. In both cases the backup must come from the same release of Squad or an earlier release.

Окно терминала
docker stop fluxer
docker run --rm -i --env-file fluxer.env -v fluxer-data:/var/lib/fluxer \
"$(docker inspect -f '{{.Config.Image}}' fluxer)" restore - < fluxer-2026-12-01.tar.zst
docker start fluxer

The restore runs on the same image as the container. With the compose file, stop it with docker compose stop, run docker compose run --rm -T fluxer restore - < fluxer-2026-12-01.tar.zst, then start it again with docker compose up -d.

fluxerd restore --check checks a backup and whether it fits the instance, without changing anything or keeping a copy. In a container the file is on the machine, so pass it on standard input, with docker exec -i fluxer fluxerd restore --check - < fluxer-2026-12-01.tar.zst, docker compose exec -T fluxer fluxerd restore --check - < fluxer-2026-12-01.tar.zst with the compose file, or podman exec -i fluxer fluxerd restore --check - < fluxer-2026-12-01.tar.zst on Podman.

If the backup’s settings file differs from yours and Squad can’t write it, such as the fluxer.env you pass to Docker, the restore leaves yours alone and tells you the path where it saved the backup’s copy of the settings file.

With your own PostgreSQL in FLUXER_POSTGRES_URL, a backup has no database, and with uploads in your own S3 store, it has no uploads. Back those up with your database’s and your store’s own tools, at the same time as Squad’s backup. With your own Meilisearch and FLUXER_MEILISEARCH_BUNDLED=false, a backup has no search index. Squad can build the index again from the database, so after a restore run rexctl search reindex, or choose “Reindex everything” under “Search Index” in the admin panel. The message queue, passwords and keys always stay on Squad’s volume and in its backups. Squad gets its public certificate again after a restore.

Every few months, and after big changes, test the latest off-site copy on a spare machine.

  1. On a spare machine or VM with Docker, download fluxer.env as for a Docker install. Set FLUXER_DOMAIN to your real domain, FLUXER_EDGE_MODE=proxy and FLUXER_LIVEKIT_ENABLED=false. Don’t point any DNS record at it.

  2. Copy the newest backup from where you keep copies, not from the instance itself.

    If you encrypted it, decrypt it first. With age, that is this command.

    Окно терминала
    age -d -i key.txt -o fluxer-2026-12-01.tar.zst fluxer-2026-12-01.tar.zst.age
  3. Restore it into a new volume with the docker run --rm -i ... restore - line from the Docker tab above, with the same image tag as your instance runs.

  4. Start Squad on a Docker network without internet access. The copy has your SMTP server and push setup, so this keeps it from sending email or notifications to your users, and from asking Let’s Encrypt for a certificate.

    Для Squad скачайте исходники и конфигурацию сборки. Команда получения готового пакета для этой платформы отсутствует.

    Wait until docker exec fluxer fluxerd health prints ready, then check the API with your domain in place of chat.example.com. The command fails if the API isn’t working. To check your messages as well, sign in through an SSH tunnel to port 8080 at the container’s IP address, which is in $ip.

    Окно терминала
    curl -fsS -H "Host: chat.example.com" "http://$ip:8080/api/v1/_health"
  5. Delete the test machine and its volume, since they have every password and key. On a machine you keep, remove the container, the volume and the network with docker stop fluxer, docker rm fluxer, docker volume rm fluxer-data and docker network rm fluxer-test.