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).
Directory layout
Section titled “Directory layout”| 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.
Backing up
Section titled “Backing up”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.
Option 1: Stop, copy, start (simplest)
Section titled “Option 1: Stop, copy, start (simplest)”sudo systemctl stop hyttetar -czf hytte-backup-$(date +%F).tar.gz -C /var/lib hyttesudo systemctl start hytteOption 2: Online backup (no downtime)
Section titled “Option 2: Online backup (no downtime)”Use sqlite3’s built-in .backup command to take a consistent snapshot of the database, then copy uploads/ and avatars/:
mkdir -p /tmp/hytte-snapsqlite3 /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-snapIn Docker, stop the container before tarring the /data volume, or run sqlite3 against the host bind mount.
Restoring
Section titled “Restoring”- Stop hytte.
- Replace the data directory with the extracted backup (make sure no stale
hytte.db-walorhytte.db-shmfiles remain from before the restore). - Ensure ownership matches the user hytte runs as (for example,
chown -R hytte:hytte /var/lib/hyttefor the system package, or UID65532for Docker). - Start hytte.