From 6031fa4fd0e6e5254d35904edce78959c997a9c1 Mon Sep 17 00:00:00 2001 From: Barsic <16+barsic@noreply.localhost> Date: Fri, 13 Nov 2026 21:54:50 +0300 Subject: [PATCH] docs: document durable data volume migration and verification --- docs/DATA_PERSISTENCE.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 docs/DATA_PERSISTENCE.md diff --git a/docs/DATA_PERSISTENCE.md b/docs/DATA_PERSISTENCE.md new file mode 100644 index 0000000..7df86a5 --- /dev/null +++ b/docs/DATA_PERSISTENCE.md @@ -0,0 +1,39 @@ +# Docker persistence runbook + +The bot stores all runtime state under `DATA_DIR`: + +- `data/global_memory.json` — global facts and preferences; +- `data/sessions/` — topic conversation histories; +- `data/calendar_token.json` — OAuth refresh token when used. + +`docker-compose.yml` explicitly sets `DATA_DIR=/app/data` and mounts `./data:/app/data`. Do not use `docker compose down -v` as a substitute for a backup: named volumes are not used by this compose file, but the host `data/` directory must be kept. + +## Safe upgrade + +```bash +mkdir -p data +cp -a data "data.backup.$(date +%Y%m%d-%H%M%S)" +git pull +docker compose up -d --build +``` + +If the old container contained the only copy of the state, copy it before removing that container: + +```bash +docker cp homeagent:/app/data/. ./data/ +``` + +Check that the files are visible from the new container: + +```bash +docker compose exec homeagent sh -lc 'printf "DATA_DIR=%s\\n" "$DATA_DIR"; ls -la /app/data; test -f /app/data/global_memory.json && head -c 1 /app/data/global_memory.json' +``` + +A previous `No space left on device` error can still prevent persistence. Check the host before deployment: + +```bash +df -h . +docker system df +``` + +Do not delete Docker data or the host `data/` directory until a backup has been verified.