Data and backups¶
Everything HouseCairn writes is in the /data volume:
Path |
Content |
|---|---|
|
The SQLite database, unless |
|
The key that signs sessions and tokens, mode 600. Losing it signs everyone out; keep it secret. |
|
Uploaded files. |
|
Copies made by the |
Files are owned by 10001:10001 and readable by that user only. If you mount a
host directory instead of a named volume, give it to that user first:
sudo chown -R 10001:10001 /srv/housecairn.
Back up¶
Back up /data in one of two ways:
Cold copy, the simplest: stop the container, copy the volume, start it again.
docker compose stop housecairn docker run --rm -v housecairn_housecairn-data:/data:ro -v "$PWD":/backup \ debian:stable-slim tar -czf /backup/housecairn-data.tar.gz -C /data . docker compose start housecairn
(The volume name is
<project>_housecairn-data;docker volume lsshows it.)Online copy of the database, while HouseCairn runs, with SQLite’s backup API (the same as
sqlite3 db.sqlite3 ".backup ..."):docker compose exec housecairn python -m housecairn.entrypoint backup # prints /data/backups/db-<UTC date and time>.sqlite3
Then copy
/data/backups/,/data/secret_keyand/data/media/off the machine. Remove old copies from/data/backups/yourself.
With PostgreSQL, back up the database with pg_dump, and /data for the key
and the uploaded files.
Restore¶
To restore, stop the container, put the files back in the volume (owned by
10001:10001), and start it.