Skip to content

Data and backups

Everything hytte stores lives in a single data directory (-d / --data-dir, default .hytte, or /var/lib/hytte with the .deb/.rpm package, or /data in Docker).

Path Contents
hytte.db SQLite database (WAL mode): accounts, public and wrapped keys, sessions, channels, encrypted messages and reactions, settings, VAPID push keys and audit log. You can move it elsewhere with --db.
uploads/ Encrypted file attachments, stored under random hex names.
avatars/ Resized profile pictures (256×256, EXIF stripped).
tls/ Self-signed certificate when using --tls, and tls/letsencrypt/ when using --lets-encrypt.
known_hosts SSH host keys for the built-in localhost.run fallback tunnel.

Because messages, reactions and files are end-to-end encrypted, a backup of this directory contains only ciphertext plus metadata. Still, store backups with sensible permissions: the database holds password-wrapped keys, sessions and TLS private keys.

SQLite runs in WAL mode (hytte.db-wal and hytte.db-shm sit next to hytte.db while hytte is running). Don’t copy hytte.db on its own while hytte is live without a proper SQLite backup, or you can end up with a half-flushed database.

Terminal window
sudo systemctl stop hytte
tar -czf hytte-backup-$(date +%F).tar.gz -C /var/lib hytte
sudo systemctl start hytte

Use sqlite3’s built-in .backup command to take a consistent snapshot of the database, then copy uploads/ and avatars/:

Terminal window
mkdir -p /tmp/hytte-snap
sqlite3 /var/lib/hytte/hytte.db ".backup '/tmp/hytte-snap/hytte.db'"
cp -a /var/lib/hytte/uploads /var/lib/hytte/avatars /var/lib/hytte/tls /tmp/hytte-snap/
tar -czf hytte-backup-$(date +%F).tar.gz -C /tmp/hytte-snap .
rm -rf /tmp/hytte-snap

In Docker, stop the container before tarring the /data volume, or run sqlite3 against the host bind mount.

  1. Stop hytte.
  2. Replace the data directory with the extracted backup (make sure no stale hytte.db-wal or hytte.db-shm files remain from before the restore).
  3. Ensure ownership matches the user hytte runs as (for example, chown -R hytte:hytte /var/lib/hytte for the system package, or UID 65532 for Docker).
  4. Start hytte.