Backups and keeping the machine safe
The backup script
Section titled “The backup script”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.
Set it up
Section titled “Set it up”- Install
gpgon the host. - Put a long passphrase in
/opt/auratree/backup.key, andchmod 600it. - Run it daily from cron:
0 3 * * * /opt/auratree/repo/docker/backup.sh >> /var/log/auratree-backup.log 2>&1A 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.
Automatic backups before changes
Section titled “Automatic backups before changes”- 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.
Harden the machine
Section titled “Harden the machine”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 noandPermitRootLogin noin/etc/ssh/sshd_config(check your key login works first), thensudo systemctl reload ssh. -
A firewall that lets in only what the server needs:
Terminal window sudo ufw default deny incomingsudo ufw allow OpenSSHsudo ufw allow 80,443/tcpsudo ufw allow 7881/tcpsudo ufw allow 50000:50100/udp# only with the TURN service:# sudo ufw allow 3478 && sudo ufw allow 49160:49200/udpsudo ufw enable -
Docker from Docker’s own packages, kept current, with
"live-restore": truein/etc/docker/daemon.jsonso containers keep running while Docker itself restarts. -
Settings readable by you only:
chmod 600 docker/.env, and the same for the backup passphrase file.
Check the audit log
Section titled “Check the audit log”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:
docker compose exec api node dist/cli/verify-audit-log.js