docs: add safe persistence migration and verification steps
This commit is contained in:
1 parent
f432094868
commit
276b338b9c
1 file changed
+52
@@ -0,0 +1,52 @@
|
|||||||
|
# Durable Docker state
|
||||||
|
|
||||||
|
The bot stores runtime state in `/app/data`:
|
||||||
|
|
||||||
|
- `global_memory.json` — global facts and preferences;
|
||||||
|
- `sessions/` — conversation history;
|
||||||
|
- `calendar_token.json` — Google OAuth token, if enabled.
|
||||||
|
|
||||||
|
`docker-compose.yml` mounts the host directory `${DATA_DIR_HOST:-./data}` to `/app/data` and sets `DATA_DIR=/app/data` inside the container.
|
||||||
|
|
||||||
|
## First deployment / migration
|
||||||
|
|
||||||
|
Back up the existing state before recreating the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p data
|
||||||
|
cp -a data "data.backup.$(date +%Y%m%d-%H%M%S)"
|
||||||
|
|
||||||
|
# If the old container has the only copy, copy it BEFORE removing it:
|
||||||
|
docker cp homeagent:/app/data/. ./data/
|
||||||
|
|
||||||
|
docker compose config
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
If the old state was written into the container layer at another path, find it first:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec homeagent sh -lc 'find /app /root -maxdepth 4 -type f \( -name global_memory.json -o -path "*/sessions/*.json" \) -print'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Verify after restart
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose exec homeagent sh -lc '\
|
||||||
|
printf "DATA_DIR=%s\\n" "$DATA_DIR"; \
|
||||||
|
mount | grep /app/data; \
|
||||||
|
ls -la /app/data; \
|
||||||
|
find /app/data/sessions -type f 2>/dev/null | head'
|
||||||
|
```
|
||||||
|
|
||||||
|
Then restart and verify the same files remain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose restart homeagent
|
||||||
|
```
|
||||||
|
|
||||||
|
## Important
|
||||||
|
|
||||||
|
- Do not run `docker compose down -v` before backing up `data/`.
|
||||||
|
- Check `df -h .` and `docker system df`: a previous `No space left on device` error can prevent writes.
|
||||||
|
- This change cannot recover data that was already deleted; it only prevents future loss once deployed.
|
||||||
Reference in new issue
Block a user