Files
infrastructure/llm-server/llm/ansible/roles/ai_backup/README.md
T
spektr 46dab5dca7
ci-static / secret-scan (push) Successful in 21s
ci-static / yamllint (push) Successful in 30s
ci-static / ansible-syntax (push) Successful in 28s
ci-static / markdown-links (push) Successful in 22s
ci-static / secret-scan (pull_request) Successful in 20s
ci-static / yamllint (pull_request) Successful in 30s
ci-static / ansible-syntax (pull_request) Successful in 27s
ci-static / markdown-links (pull_request) Successful in 20s
M6/GNAI-021: OpenWebUI-Theme gnai-catppuccin-mocha + Ghost-Favicon als read-only Mounts; ai_backup um /etc/gnmon und openwebui-data (SQLite-Snapshot) erweitert
- open_webui-Rolle: Theme (files/theme/gnai-catppuccin-mocha.css) und Favicon
  (files/favicon/*, byte-identisch zum Dashboard-Original) werden host-seitig
  deployt und im Quadlet read-only ueber die Image-Platzhalter in
  /app/backend/open_webui/static/ gemountet — update-persistent, weil der
  Mount host-seitig liegt und OpenWebUIs Start-Wipe von static/ eine ro-Datei
  nicht anfassen kann. Inode-Befund: copy->Rename tauscht den Inode, daher
  notify Restart + flush_handlers vor den Served-Checks.
- Served-Verifikation in der Rolle: /static/custom.css (Marker) und
  /static/favicon.png (byte-identisch via content_length).
- ai_backup: zusaetzliche Pfade etc/gnmon und
  var/lib/ghostnet-ai/production/openwebui-data; die live webui.db (+wal/shm)
  wird aus dem tar ausgeschlossen und stattdessen als konsistenter Snapshot
  via SQLite-Online-Backup-API (python3 stdlib) an derselben Archiv-Position
  angehaengt (tar uncompressed -> append -> gzip).
- Doku: GNAI-021 (neu) + ai-README-Index; Link auf GNMON-000 korrigiert.
- Live ausgerollt 14.11.2026 auf 10.0.0.90 (webui.yml + ai.yml konvergent
  changed=0): custom.css 200/5311 B mit Marker, favicon.png 200/2729 B,
  alle 6 ro-Mounts am laufenden Container gebunden.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-14 14:37:13 +01:00

3.7 KiB

ai_backup

Configuration backup for the AI server (GNAI-001 milestone 4). Deploys gnai-ai-backup (script), a oneshot service and a weekly timer (Sunday 03:30, Persistent=true). Target is the existing NFS pipeline share (pve:/media/datenhdd3/Encoding, operator decision 06.11.2026).

Backup scope

  • /etc/ghostnet-ai (all environment config trees)
  • /etc/gnmon (dashboard OIDC env file dashboard-secrets.env; added 14.11.2026, GNAI-021 follow-up)
  • /etc/containers/systemd/users/{980,981,984} (rootless quadlets, included when present)
  • /var/lib/ghostnet-ai/environment-state (switch state)
  • /var/lib/ghostnet-ai/production/openwebui-data (OpenWebUI app + user data: uploads, cache; added 14.11.2026, GNAI-021 follow-up). The live webui.db/-wal/-shm are excluded from the tar; instead a consistent snapshot via SQLite's online-backup API (python3 stdlib) is appended at the same archive path, so a mid-write WAL state is never archived.
  • /var/lib/ghostnet-ai/testing/bench/results (benchmark artifacts)
  • /var/lib/ghostnet-ai/shared/models without *.gguf — the pinned SOURCE.yml manifests make the weights reproducible through the model_store role (--tags models re-downloads and verifies them)

Every archive gets a .sha256 sidecar; the archive is integrity-checked before it replaces the last good file; retention keeps the newest ai_backup_retention archives.

Operations

  • Run a backup now: systemctl start gnai-ai-backup.service (the timer does this weekly; systemctl list-timers gnai-ai-backup* shows the next run).
  • Watch: journalctl -u gnai-ai-backup.service -n 20.
  • Boot ordering: the service unit carries RequiresMountsFor=/var/lib/ghostnet-pipeline, so every start (including the Persistent timer run after a reboot) pulls in and waits for the escaped mount unit var-lib-ghostnet\x2dpipeline.mount. The earlier literal After=var-lib-ghostnet-pipeline.mount never matched the escaped unit name and therefore never ordered anything — at boot on 09.11.2026 the timer raced the mount and the script exited 21 (GNAI-008 14.6). Fixed and verified 09.11.2026: systemctl show lists the mount unit under Requires=/After=, a manual systemctl start finished with Result=success and produced a sha256-verified archive on the share, and a second role run reports changed=0.

Restore SOP

  1. Identify the archive on the share: ls -lt /var/lib/ghostnet-ai-backup/ghostnet-ai-backup-*.tar.gz
  2. Verify the sidecar: sha256sum -c <archive>.sha256
  3. Extract to a staging directory first (never extract blindly over live files): mkdir /tmp/gnai-restore && tar -xzf <archive> -C /tmp/gnai-restore
  4. Compare or selectively copy back the affected tree, e.g. diff -r /tmp/gnai-restore/etc/ghostnet-ai/testing /etc/ghostnet-ai/testing
  5. For environment-state restores, run /usr/local/sbin/gnai-environment-switch recover afterwards so the runtime converges with the restored state.
  6. For model weights: restore via the model_store role (--tags models), then verify the SOURCE.yml checksums.
  7. For OpenWebUI user data (var/lib/ghostnet-ai/production/openwebui-data): stop the unit (runuser -u gnai-production -- systemctl --user stop gnai-production-openwebui), copy the archived webui.db back, chown -R gnai-production:gn-production the data dir, start the unit, then re-run playbooks/webui.yml (re-applies model/tool/config sync) and verify /health + model list.
  8. Re-run the affected environment playbook (playbooks/ai.yml --tags service) and verify health.

Accepted proof (06.11.2026): full-tree extract-and-diff against the live configuration and a practical restore of the deleted environment state file, documented in GNAI-008 section 14.6.