SLAP backup and restore procedure (tested Dec 1, 2026)
TODO item 8 ("Write and test a backup procedure... Actually restore from one"). Tested on Andre's
laptop (Windows 11, Docker Desktop 29.6.2, Git Bash) against the real SLAP volumes, restoring into
separate slaptest_* volumes so the live data was never touched. Logs: logs/05a-backup.log,
logs/05b-source-db-rowcounts.log, logs/05c-restore.log, logs/05d-restore-boot.log,
logs/05e-backup-SHA256SUMS.txt.
What to back up#
| Volume | Holds | Back up? |
|---|---|---|
slap_open_webui_data |
accounts, chats, uploaded source documents, settings DB (webui.db) |
Yes. Irreplaceable. |
slap_qdrant_storage |
document embeddings (vectors) | Yes. It can in principle be rebuilt by re-uploading every document, but that is slow and loses nothing only if every original is still on hand. |
slap_nginx_logs |
proxy access/error logs (audit trail) | Yes, small |
slap_ollama_models |
model weights (6.6 GB here) | No. Rebuild from the offline bundle or import_models.sh. |
.env in the repo folder |
WEBUI_SECRET_KEY, QDRANT_API_KEY, site settings |
Yes, but separately and securely. It holds secrets: never put it next to the data tarballs on shared media. Without it, a new .env gets new keys: everyone must sign in again, and anything Open WebUI encrypted with the old key cannot be read (not tested). |
The tarballs contain every account's password hash, every chat and every uploaded document. Treat them like the live system: encrypted storage, controlled media, same classification as the documents in them.
Backup (cold: stop first)#
Stop the stack first. webui.db is SQLite in WAL mode, and copying it while Open WebUI writes can
produce a backup that will not open. Qdrant also writes continuously. A cold backup is the simple,
safe option. Downtime measured here: about 45 s for 266 MB, plus restart time.
cd /path/to/CapstoneLocalAI
export MSYS_NO_PATHCONV=1 # Git Bash on Windows only; harmless elsewhere
./stop_mvp.sh # data is preserved
BK=/secure/backup/slap-$(date +%Y%m%d) # Windows example: BK='D:/slap-backup/20261201'
mkdir -p "$BK"
for v in open_webui_data qdrant_storage nginx_logs; do
docker run --rm -v slap_$v:/data:ro -v "$BK":/out nginx:1.27.5-alpine \
tar czf /out/slap_$v.tar.gz -C /data .
done
( cd "$BK" && sha256sum slap_*.tar.gz > SHA256SUMS )
./start_mvp.sh
nginx:1.27.5-alpine is used as the tar tool because it is already one of the stack's images (also
true on an air-gapped machine). Do not use another tag: an offline machine has no other.
Measured (Dec 1, 10:30 AM, stack already stopped):
| Volume | Files | Tarball size | Time | SHA-256 |
|---|---|---|---|---|
slap_open_webui_data |
81 | 250,098,947 B (239 MB) | 34.9 s | c5e5b8e5c9595eb1e8a83648fe9f221af510e4e6e63cac443627558dac1d8ff4 |
slap_qdrant_storage |
96 | 345,261 B | 6.0 s | f9be3b13e9ab0b543ab142708c2ab2b0dd271b94f125219b790e95f490805d95 |
slap_nginx_logs |
0 | 157 B | 1.7 s | e1349f84cdc6a436a984e05541cc175c04e67a2a1fc0f3268f80deb8453872cf |
Most of the 266 MB in open_webui_data is Open WebUI's model cache (cache/), not user data.
Qdrant's directory shows 250 MB "apparent" size but 652 KB on disk (sparse files). The tarball is
the real size.
Restore#
A. Replace the live data (disaster recovery, or moving to a new machine)#
On a new machine, install SLAP first (bundle or start_mvp.sh), copy in the old .env, and stop
it. Then:
cd /path/to/CapstoneLocalAI
export MSYS_NO_PATHCONV=1
BK=/secure/backup/slap-20261201
( cd "$BK" && sha256sum -c SHA256SUMS ) # every line must say OK
./stop_mvp.sh
for v in open_webui_data qdrant_storage nginx_logs; do
docker volume rm slap_$v # DESTROYS the current data in that volume
docker volume create slap_$v
docker run --rm -v slap_$v:/data -v "$BK":/backup:ro nginx:1.27.5-alpine \
tar xzf /backup/slap_$v.tar.gz -C /data
done
./start_mvp.sh
Restore with the same Open WebUI version that made the backup. Open WebUI migrates its database
forward, one way, on first start. A newer version upgrades the restored copy irreversibly, and an
older version may refuse it. The version is in /api/version and in the alembic_version table
(d4c1a8e37b62 for this backup, Open WebUI 0.11.3).
To keep the old data rather than delete it, skip docker volume rm and restore into differently
named volumes first (procedure B). Then point a test copy at them.
B. Test a backup without touching the live system (what was done on Dec 1)#
export MSYS_NO_PATHCONV=1
BK=/secure/backup/slap-20261201
( cd "$BK" && sha256sum -c SHA256SUMS )
for v in open_webui_data qdrant_storage nginx_logs; do
docker volume create slaptest_$v
docker run --rm -v slaptest_$v:/data -v "$BK":/backup:ro nginx:1.27.5-alpine \
tar xzf /backup/slap_$v.tar.gz -C /data
done
docker network create --internal slaptest_restore_net # sealed; no host ports needed
docker run -d --name slaptest_qdrant --network slaptest_restore_net \
-e QDRANT__TELEMETRY_DISABLED=true -v slaptest_qdrant_storage:/qdrant/storage qdrant/qdrant:v1.19.1
docker run -d --name slaptest_webui --network slaptest_restore_net \
-v slaptest_open_webui_data:/app/backend/data \
-e WEBUI_SECRET_KEY=$(openssl rand -hex 16) -e VECTOR_DB=qdrant -e QDRANT_URI=http://slaptest_qdrant:6333 \
-e OFFLINE_MODE=1 -e HF_HUB_OFFLINE=1 -e ENABLE_OPENAI_API=false -e ENABLE_PERSISTENT_CONFIG=false \
-e RAG_EMBEDDING_ENGINE=ollama -e RAG_EMBEDDING_MODEL=nomic-embed-text -e WEBUI_NAME=SLAP \
ghcr.io/open-webui/open-webui:<same version as the live stack>
# then check (counts only):
docker exec slaptest_webui python -c "import urllib.request;print(urllib.request.urlopen('http://127.0.0.1:8080/health').status)"
docker exec slaptest_webui python -c "import urllib.request,json;print(json.load(urllib.request.urlopen('http://127.0.0.1:8080/api/config')).get('version'))"
# row counts (copies webui.db to /tmp first, prints counts only); scripts/ is this evidence folder's scripts/:
docker run --rm -v slaptest_open_webui_data:/data:ro -v "$PWD/scripts":/tools:ro --entrypoint python \
ghcr.io/open-webui/open-webui:<same version> /tools/dbcounts.py /data
# Qdrant point counts: scripts/qdrant_counts.py with QDRANT_URI=http://slaptest_qdrant:6333 QDRANT_API_KEY=none
# clean up only the test objects:
docker rm -f slaptest_webui slaptest_qdrant
docker network rm slaptest_restore_net
docker volume rm slaptest_open_webui_data slaptest_qdrant_storage slaptest_nginx_logs
Results of the Dec 1 restore test#
| Check | Result |
|---|---|
Tarball checksums before restore (sha256sum -c) |
3/3 OK |
| Restore time | open_webui_data 25 s, qdrant_storage 5 s, nginx_logs 3 s |
| File counts, restored vs source | 81 = 81, 96 = 96, 0 = 0 |
| Every file's SHA-256, restored volume vs tarball contents | identical for open_webui_data and qdrant_storage (and identical to the live open_webui_data volume. The live Qdrant volume had changed since the backup because the stack was started afterwards, as expected) |
webui.db PRAGMA integrity_check on the restored copy |
ok |
| Row counts, all 44 tables, restored vs source | identical: user 2, auth 2, chat 8, chat_message 32, file 2, chat_file 2, feedback 3, tag 12, note 1, model 1, config 345, knowledge 0, api_key 0 (full list in 05b/05c) |
| Qdrant 1.19.1 booted on the restored volume | collection open-webui_files, 11 points (8 + 3 per document), status green, the same as the live system |
| Open WebUI 0.11.3 booted on the restored volume (sealed network, no host ports) | /health 200 after about 86 s. /api/config reports "SLAP (Open WebUI)" 0.11.3, signup closed, no onboarding flag (which Open WebUI sends only when no users exist). Both uploaded files present. Alembic migration step ran and was a no-op. |
| Signing in to the restored copy | Not done. It would need the user's password. Accounts were proven by row counts and the onboarding flag, not by logging in. |
| Cleanup | slaptest_* containers, network and volumes removed. Tarballs deleted from the temp folder after the test; checksums kept in logs/05e-backup-SHA256SUMS.txt. |
Not covered (be honest in the VCRM)#
- No schedule. This is a manual procedure. A cron job or Windows Task Scheduler entry (stop, tar, checksum, start, copy offsite) is not built. Nightly downtime is under a minute at this data size.
- Hot backup not tested. Qdrant has a snapshot API (
POST /collections/{name}/snapshots) and SQLite has.backup. Either would avoid the stop, but neither was tried. - Same-machine test only. Restoring on a second, clean machine (the Week 12 plan) was not done today. The commands are the same. The risk is version mismatch, which is why the procedure says to restore with the same image version.
- Upgrade/rollback (back up, upgrade Open WebUI, roll back by restoring) was not tested.
From the backup and restore test run on Dec 1, 2026 (capstonesubmit/test-evidence/BACKUP-RESTORE.md). Built Dec 3, 2026.