Skip to content

Backups and keeping the machine safe

docker/backup.sh makes encrypted backups (GPG, never in the clear on disk) of:

Backup What’s in it
Database All messages (encrypted), users, roles and server config
Files MinIO’s files, only when they’re kept on this machine. With hosted storage, the files are your provider’s to keep.
Settings and keys .env (and stack.env from Portainer), the federation key, and push (ntfy) data

It keeps seven daily and four weekly backups, and prints the restore commands.

  1. Install gpg on the host.
  2. Put a long passphrase in /opt/auratree/backup.key, and chmod 600 it.
  3. Run it daily from cron:
0 3 * * * /opt/auratree/repo/docker/backup.sh >> /var/log/auratree-backup.log 2>&1

A missing settings file never stops the database backup: the script prints a warning and ends with status 2. On Portainer, your settings live in the stack, so export them yourself.

  • Before the API applies database changes on start-up, it saves a database dump first, and keeps the newest five (MIGRATION_BACKUP_KEEP). If the dump fails, the API stops instead of changing the database.

The machine itself is yours to look after. On Ubuntu or Debian:

  • Security updates install themselves: sudo apt install unattended-upgrades && sudo dpkg-reconfigure -plow unattended-upgrades

  • SSH by key only, no root login: set PasswordAuthentication no and PermitRootLogin no in /etc/ssh/sshd_config (check your key login works first), then sudo systemctl reload ssh.

  • A firewall that lets in only what the server needs:

    Terminal window
    sudo ufw default deny incoming
    sudo ufw allow OpenSSH
    sudo ufw allow 80,443/tcp
    sudo ufw allow 7881/tcp
    sudo ufw allow 50000:50100/udp
    # only with the TURN service:
    # sudo ufw allow 3478 && sudo ufw allow 49160:49200/udp
    sudo ufw enable
  • Docker from Docker’s own packages, kept current, with "live-restore": true in /etc/docker/daemon.json so containers keep running while Docker itself restarts.

  • Settings readable by you only: chmod 600 docker/.env, and the same for the backup passphrase file.

Every admin action goes into an audit log that can’t be edited or deleted through the server, and each entry is chained to the one before. To check nothing was changed directly in the database:

Terminal window
docker compose exec api node dist/cli/verify-audit-log.js