diff --git a/docs/platform/llm-server/ai/GNAI-021-TECH_OpenWebUI-Theme.md b/docs/platform/llm-server/ai/GNAI-021-TECH_OpenWebUI-Theme.md new file mode 100644 index 0000000..8fdaf7c --- /dev/null +++ b/docs/platform/llm-server/ai/GNAI-021-TECH_OpenWebUI-Theme.md @@ -0,0 +1,142 @@ +# Technischer Arbeitsentwurf + +**Dokumenten-ID:** GNAI-021-TECH +**Titel:** Ghostnet-Branding „gnai-catppuccin-mocha" — OpenWebUI-Theme als Default + Favicon „ursprünglicher Geist" auf beiden Sites, update-persistent +**Stand:** 2026-11-14 +**Status:** produktiv seit 2026-11-14 (Betreiber-Go „schalte es live"): Theme live; Favicons nach Betreiberentscheid 2026-11-14 zurück auf den ursprünglichen Geist (Badge-Varianten v2/v5 verworfen) — Monitoring via Image v0.3.6 (unverändert), OpenWebUI via ro-Mounts; Konvergenz `changed=0` +**Referenzen:** [DOC-Index](../../../GNAI-000-DOC_Index.md), [GNMON-000](../monitoring/GNMON-000-DOC_Index.md) (Dashboard-Stil M3.1: Catppuccin Mocha, Monospace), Rolle `llm-server/llm/ansible/roles/open_webui/`, OpenWebUI v0.13.3 (digest-gepinnt, `sha256:46b59158…`), Upstream-Quelle `tag v0.13.3` + +> Dieses Dokument beschreibt den technischen Sollzustand des Custom-Themes für +> OpenWebUI (`https://chat.ghostnet.selfhost.eu`, intern `10.0.0.90:8081`) und +> warum es OpenWebUI-Updates unabhängig übersteht. + +--- + +## Änderungsverlauf + +| Datum | Version | Autor | Beschreibung | +| --- | --- | --- | --- | +| 2026-11-14 | 0.1 | spektr / Mistral Vibe | Erstfassung: Befunde zum Theme-Mechanismus in v0.13.3, update-persistenter Mount, Umsetzung in Rolle `open_webui`, Verifikation | +| 2026-11-14 | 0.2 | spektr / Mistral Vibe | Live-Rollout: erster Lauf `changed=3` (Theme-Dir, custom.css, Quadlet), Play brach vor den Handlern an der Served-Prüfung ab (alter Container ohne Mount) — daemon-reload + Unit-Restart manuell nachgezogen, danach `GET /static/custom.css` = 200 mit 5311 Bytes und Marker; zweiter Playbook-Lauf konvergent `changed=0, failed=0`. Der Neustart nach Quadlet-Change ist zugleich der Persistenz-Beweis: OpenWebUIs Start-Wipe von `static/` läuft dabei erneut und kann den ro-Mount nicht anfassen | +| 2026-11-14 | 0.3 | spektr / Mistral Vibe | Favicons ergänzt (Abschnitt 5): v2 (Ghost + Pulse-Badge) für das Monitoring-Dashboard, v5 (Ghost + Terminal-Badge) für OpenWebUI — gleiche read-only-Mount-Mechanik | +| 2026-11-14 | 0.4 | spektr / Mistral Vibe | Live-Rollout Favicons: OpenWebUI v5 via ro-Mounts OK (alle 5 Dateien byte-identisch serviert, md5-geprüft). Dashboard: Mount-Versuch über `/app/wwwroot` scheiterte (HTTP 500 — MapStaticAssets-Manifest-Mismatch, Befund in Abschnitt 5), deshalb Image-Rebuild `dashboard:v0.3.7` auf der Workstation (Image-ID `a2c15048e188`, favicon md5 `87f78a61…` im Image verifiziert), `podman save`/scp/`load` als gn-dashboard, Tag im Inventory gebumpt, Unit neu gestartet — `GET /favicon.png` = 200, 2488 Bytes, md5 identisch zur Quelle; Playbook konvergent `changed=0, failed=0` | +| 2026-11-14 | 0.5 | spektr / Mistral Vibe | Betreiberentscheid: Badge-Varianten verworfen, beide Sites nutzen wieder den ursprünglichen Geist. Monitoring komplett reverted (Quell-PNGs, Rolle, Inventory-Tag v0.3.6; `GET /favicon.png` = 2729 B, md5 `78966788…`). OpenWebUI: Favicon-Dateien gegen byte-identische Kopien des Dashboard-Originals ersetzt (Mounts bleiben); Inode-Befund dokumentiert (copy→Rename→neuer Inode, laufender Container serviert alt — deshalb notify Restart + flush_handlers vor den Checks). Beide Playbooks konvergent `changed=0, failed=0`; alle Favicon-URLs md5-verifiziert | + +--- + +## 1. Entscheidung + +Betreiberwunsch 2026-11-14: OpenWebUI soll im Farbschema der Monitor-Website +(`mon.ghostnet.selfhost.eu`, GNMON — Catppuccin Mocha, DejaVu Sans Mono, +Hacker-TUI-Stil) erscheinen; das Theme soll **Default für alle Nutzer** sein +und **unabhängig von OpenWebUI-Updates** bestehen bleiben (kein Image-Patch, +kein Fork). + +## 2. Befunde zum Theme-Mechanismus in OpenWebUI v0.13.3 + +a) **Es gibt kein server-seitiges Theme.** Die Theme-Wahl (`system`/`light`/ + `dark`/`oled-dark`/`her`) liegt pro Browser in `localStorage.theme` + (`src/app.html`, `src/lib/utils/theme.ts` `setTheme()`); in der DB + (`webui.db`) existiert keine Theme-Tabelle (Backend-Modelle/Routers enthalten + kein Theme — geprüft gegen `tag v0.13.3`). Ein „Default-Theme für alle + Nutzer" lässt sich daher nicht serverseitig erzwingen, sondern nur über + CSS, das beide Modi abdeckt (Abschnitt 3). +b) **Offizieller Extension-Point: `/static/custom.css`.** `src/app.html` lädt + auf jeder Seite ``. Das + Image enthält an dieser Stelle eine **leere** Placeholder-Datei + (`static/static/custom.css` = leerer Blob). Live verifiziert 2026-11-14: + `GET /` enthält den custom.css-Link; `GET /static/custom.css` → 200, 0 Bytes. +c) **`/static` wird aus `STATIC_DIR` serviert** (`main.py`: `app.mount('/static', + StaticFiles(directory=STATIC_DIR))`, Default `/app/backend/open_webui/static`). + Beim Start wiped `config.py` alle Top-Level-Dateien in `STATIC_DIR` und kopiert + sie aus dem Image neu (`STATIC_SOURCE_DIR = /app/build/static`). Eine + **read-only bind-mountete Einzeldatei** kann dort weder `unlink()`t noch per + `copyfile` überschrieben werden (EBUSY/EROFS, beides per `except: pass` + ge-swallowt) — sie überlebt jeden Start und jedes Image-Update. +d) **Theme-Switch setzt Inline-Styles.** `setTheme()` schreibt + `--color-gray-800/850/900/950` als Inline-Style auf `` (dark/oled-dark). + Das Theme-CSS braucht daher `!important` auf den Custom-Properties. + Ungelayertes CSS (custom.css) schlägt außerdem die `@layer theme`-Variablen + von Tailwind v4 (`src/tailwind.css` definiert nur die Graustufen selbst; + Akzentfarben kommen aus dem Tailwind-Default-Theme). +e) **Farbpalette des Dashboards** stammt aus + `llm-server/monitoring/src/Ghostnet.Dashboard/wwwroot/app.css` (`:root`, + Catppuccin Mocha: crust `#11111b` … text `#cdd6f4` … mauve `#cba6f7`). + +## 3. Umsetzung + +- Theme-Datei im Repo: `llm-server/llm/ansible/roles/open_webui/files/theme/gnai-catppuccin-mocha.css`. + Mapping: Graustufen-Rampe → Mocha-Oberflächen (dark: 950=crust, 900=base, + 850=mantle, 800=surface0 … 50=text; light: Rampe invertiert auf dieselbe + dunkle Palette, damit auch `light`/`system`-Nutzer das Mocha-Theme sehen), + Akzent-Rampen (blue→sapphire/blue, green→green/teal, red→red, yellow→yellow, + orange→peach, violet→mauve), `color-scheme: dark`, Monospace-Stack + (`"DejaVu Sans Mono", ui-monospace, …`), Splash-Screen auf base/peach/grün. +- Deployment (Rolle `open_webui`): + - `open_webui_theme_dir = /var/lib/ghostnet-ai/production/openwebui-theme`, + Datei `custom.css` (Owner `gnai-production`, `0644`). + - Quadlet `open-webui.container.j2`: + `Volume={{ open_webui_theme_dir }}/custom.css:/app/backend/open_webui/static/custom.css:ro`. + - Kein Restart bei reinen Inhaltsänderungen nötig (`/static` wird pro Request + von Disk gelesen); der Quadlet-Change triggert einmalig daemon-reload + + Restart über die bestehenden Handler. +- Verifikation im Playbook: nach dem Health-Check prüft + `GET http://10.0.0.90:8081/static/custom.css` auf HTTP 200 **und** den Marker + `gnai-catppuccin-mocha` im Body — so fällt ein künftiges Image, das custom.css + nicht mehr referenziert/serviert, sofort auf statt still zu verstummen. + +## 4. Warum das Theme Updates überlebt + +- Der Mount liegt **host-seitig im Quadlet** (Ansible, Git), nicht im Image. +- Die Theme-Datei liegt **im Repo** und wird idempotent erneut ausgerollt + (`changed=0` bei unverändertem Stand). +- Beim Container-Start (auch nach Image-Update auf neuen Digest) kopiert + OpenWebUI `static/` zwar neu, kann die read-only gemountete Datei aber nicht + anfassen (Befund c) — das Theme bleibt aktiv. +- Einzige Sollbruchstelle: Ein künftiges OpenWebUI-Release, das den + `custom.css`-Link aus `app.html` entfernt. Der Served-Check im Playbook + (Abschnitt 3) erkennt das beim nächsten Rollout; bis dahin bleibt das Theme + auch über Updates aktiv. + +## 5. Favicons — Betreiberentscheid 2026-11-14: ursprünglicher Geist auf BEIDEN Sites + +Badge-Varianten (v2 Pulse, v5 Terminal aus `~/Downloads/Gemini_Generated_Image_p4vvywp4vvywp4vv.jpg`) +wurden gebaut, live genommen und dann vom Betreiber verworfen: Beide Websites +verwenden wieder das ursprüngliche Geist-Favicon der Monitoring-Website +(`favicon.png` 32x32 md5 `78966788…`, `apple-touch-icon.png` 180x180 md5 `9bc48a15…`). + +- **Monitoring-Dashboard:** alles zurückgesetzt — Quell-PNGs, Rolle + `gnmon_dashboard` und Inventory-Tag auf `HEAD`/`v0.3.6` reverted; Unit neu + gestartet, `GET /favicon.png` = 2729 Bytes, md5 identisch zum Original. Der + Image-Bau v0.3.7 (mit v2-Favicon) bleibt als unbenutztes Image im Store liegen. +- **OpenWebUI:** Mount-Mechanik bleibt (funktioniert), nur der Inhalt wurde + ersetzt: `roles/open_webui/files/favicon/` enthält jetzt byte-identische Kopien + des Dashboard-Originals (favicon.png, apple-touch-icon.png) plus Ableitungen + (favicon-96x96.png, favicon.ico 16/32, favicon.svg als Data-URI-Wrapper). + Live verifiziert: alle fünf `/static/*`-URLs liefern die erwarteten md5s. +- **Befund Inode (14.11.2026):** Single-File-Bind-Mounts binden den Inode bei + Container-Erzeugung; Ansible `copy` ersetzt Dateien per Rename (neuer Inode) — + der laufende Container serviert dann weiter den alten Inhalt. Deshalb notifyen + die Copy-Tasks in der Rolle jetzt `Restart OpenWebUI unit`, und `flush_handlers` + läuft vor den Served-Checks. +- **Befund .NET (14.11.2026):** Beim Dashboard ist der Mount-Weg prinzipiell + unbrauchbar — .NET 10 `MapStaticAssets` liest Content-Length/ETag aus dem + Publish-Manifest (`Ghostnet.Dashboard.staticwebassets.endpoints.json`); eine + gemountete abweichende Datei lieferte HTTP 500 (kürzer) bzw. Truncation (länger). + Favicon-Änderungen am Dashboard erfordern also immer einen Image-Bau + Tag-Bump. + +- Out of scope: OpenWebUI-Splash (`splash.png`/`splash-dark.png`) und + `site.webmanifest`/`web-app-manifest-*.png` zeigen weiterhin das OpenWebUI-Logo. + +## 6. Grenzen / Offen + +- Die Theme-Auswahl im UI (Settings → General → Theme) bleibt sichtbar, ist + aber visuell neutralisiert (light und dark rendern beide Mocha). Wer explizit + „OLED Dark" wählt, bekommt ebenfalls Mocha (Crust statt Schwarz) — bewusst, + damit das GNMON-Theme überall greift. +- Die DejaVu-Sans-Mono-Datei des Dashboards wird nicht eingebettet (kein + Font-Mount ohne neuen Mount-Pfad); auf Linux-Clients mit installierter + DejaVu Sans Mono ist der Look identisch, sonst greift der Monospace-Fallback. +- Code-Highlighting (hljs) und eingebettete Markdown-Tabellen behalten ihre + eigenen Akzente — bewusst nur dezente Anpassungen (Links sapphire, Inline-Code + peach, Selection mauve). diff --git a/docs/platform/llm-server/ai/README.md b/docs/platform/llm-server/ai/README.md index 9c75d43..b0f0426 100644 --- a/docs/platform/llm-server/ai/README.md +++ b/docs/platform/llm-server/ai/README.md @@ -15,6 +15,7 @@ Video-Encoding-Workload besitzt einen | [GNAI-009](GNAI-009-PLAN_Llama-Model-Evaluation.md) | Modellbewertung für Swift/Unsloth; Betreiberbeschluss 05.11.2026: Swift 1.5 Q6_K als Production-Profil (Abschnitt 10.4) | | [GNAI-010](GNAI-010-TECH_Llama-Serving.md) | technische Sollkonfiguration für die Modellprofile auf rootless `llama.cpp` mit ROCm; Testing abgenommen (10.5–10.10), Production live seit 06.11.2026 | | [GNAI-020](GNAI-020-TECH_OpenWebUI-WebSearch.md) | Websuche in OpenWebUI: SearXNG mit kuratierten Engines + Native/Agentic Mode (`search_web`/`fetch_url`), UI- und API-Betrieb (Path A/B), produktiv verifiziert seit 12.11.2026 | +| [GNAI-021](GNAI-021-TECH_OpenWebUI-Theme.md) | OpenWebUI-Theme „gnai-catppuccin-mocha" (Farbschema des GNMON-Dashboards) als Default für alle Nutzer, update-persistent via read-only `custom.css`-Mount im Quadlet | Der übergreifende Projektstand steht im [zentralen Dokumentationsindex](../../../GNAI-000-DOC_Index.md). diff --git a/llm-server/llm/ansible/roles/ai_backup/README.md b/llm-server/llm/ansible/roles/ai_backup/README.md index d099627..ea1ea4d 100644 --- a/llm-server/llm/ansible/roles/ai_backup/README.md +++ b/llm-server/llm/ansible/roles/ai_backup/README.md @@ -8,9 +8,17 @@ 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 @@ -53,7 +61,13 @@ before it replaces the last good file; retention keeps the newest 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. Re-run the affected environment playbook +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 diff --git a/llm-server/llm/ansible/roles/ai_backup/defaults/main.yml b/llm-server/llm/ansible/roles/ai_backup/defaults/main.yml index 76e8422..a9a2ca9 100644 --- a/llm-server/llm/ansible/roles/ai_backup/defaults/main.yml +++ b/llm-server/llm/ansible/roles/ai_backup/defaults/main.yml @@ -25,12 +25,22 @@ ai_backup_script: /usr/local/sbin/gnai-ai-backup # the script only when they exist. ai_backup_paths: - etc/ghostnet-ai + - etc/gnmon - etc/containers/systemd/users/980 - etc/containers/systemd/users/981 - etc/containers/systemd/users/984 - var/lib/ghostnet-ai/environment-state + - var/lib/ghostnet-ai/production/openwebui-data - var/lib/ghostnet-ai/testing/bench/results +# OpenWebUI app data (GNAI-021 follow-up, 14.11.2026): the live SQLite +# webui.db (and its -wal/-shm sidecars) is EXCLUDED from the tar and replaced +# by a consistent snapshot taken via SQLite's online-backup API (python3 +# stdlib), so a mid-write WAL state is never archived. The snapshot lands at +# the same path inside the archive as the live db. +ai_backup_openwebui_data_dir: var/lib/ghostnet-ai/production/openwebui-data +ai_backup_openwebui_db: webui.db + # Included without its multi-gigabyte weights: model manifests and any # other metadata below the shared model store. ai_backup_model_store_meta: var/lib/ghostnet-ai/shared/models diff --git a/llm-server/llm/ansible/roles/ai_backup/tasks/main.yml b/llm-server/llm/ansible/roles/ai_backup/tasks/main.yml index 9b7b052..4dc19a6 100644 --- a/llm-server/llm/ansible/roles/ai_backup/tasks/main.yml +++ b/llm-server/llm/ansible/roles/ai_backup/tasks/main.yml @@ -13,6 +13,8 @@ - ai_backup_paths | length > 0 - ai_backup_service | length > 0 - ai_backup_script is match("^/usr/local/sbin/") + - ai_backup_openwebui_data_dir is match("^var/lib/") + - ai_backup_openwebui_db is match("^[a-z0-9_.-]+$") fail_msg: AI backup declarations are incomplete or invalid. - name: Require the NFS pipeline share to be mounted diff --git a/llm-server/llm/ansible/roles/ai_backup/templates/gnai-ai-backup.sh.j2 b/llm-server/llm/ansible/roles/ai_backup/templates/gnai-ai-backup.sh.j2 index 31ea209..f98b2ee 100644 --- a/llm-server/llm/ansible/roles/ai_backup/templates/gnai-ai-backup.sh.j2 +++ b/llm-server/llm/ansible/roles/ai_backup/templates/gnai-ai-backup.sh.j2 @@ -39,8 +39,40 @@ mkdir -p "$TARGET_DIR" STAMP=$(date +%Y%m%d-%H%M) ARCHIVE="$TARGET_DIR/ghostnet-ai-backup-$STAMP.tar.gz" TMP="$ARCHIVE.tmp" +RAWTMP="$ARCHIVE.raw" -tar -C / -czf "$TMP" "${paths[@]}" +# Consistent snapshot of the live OpenWebUI SQLite DB via the online-backup +# API (python3 stdlib; sqlite3 CLI is not installed on the host). The live +# db + wal/shm are excluded from the archive and the snapshot is appended at +# the same archive path. +DATA_REL="{{ ai_backup_openwebui_data_dir }}" +DB_REL="$DATA_REL/{{ ai_backup_openwebui_db }}" +STAGE="" +if [ -f "/$DB_REL" ]; then + STAGE=$(mktemp -d /tmp/gnai-ai-backup-stage.XXXXXX) + mkdir -p "$STAGE/$DATA_REL" + python3 - "/$DB_REL" "$STAGE/$DB_REL" <<'PY' +import sqlite3, sys +src = sqlite3.connect(f"file:{sys.argv[1]}?mode=ro", uri=True) +dst = sqlite3.connect(sys.argv[2]) +with dst: + src.backup(dst) +dst.close() +src.close() +PY +fi +trap 'rm -rf "$STAGE" "$RAWTMP"' EXIT + +# Build uncompressed first so the staged DB can be appended (tar -r does not +# work on compressed archives), then gzip. +tar -C / -cf "$RAWTMP" \ + --exclude="$DB_REL" --exclude="$DB_REL-wal" --exclude="$DB_REL-shm" \ + "${paths[@]}" +if [ -n "$STAGE" ]; then + tar -C "$STAGE" -rf "$RAWTMP" "$DB_REL" +fi +gzip -c "$RAWTMP" > "$TMP" +rm -f "$RAWTMP" if ! tar -tzf "$TMP" > /dev/null 2>&1; then log "ERROR: archive failed the integrity check" >&2 diff --git a/llm-server/llm/ansible/roles/open_webui/README.md b/llm-server/llm/ansible/roles/open_webui/README.md index 172ecfc..58fe2e3 100644 --- a/llm-server/llm/ansible/roles/open_webui/README.md +++ b/llm-server/llm/ansible/roles/open_webui/README.md @@ -43,3 +43,41 @@ Embedding-Modell wird nicht benötigt. Lang laufende Research-Loops (mehrere search_web/fetch_url-Runden) brauchen auf dem NPM-Proxy-Host `chat.ghostnet.selfhost.eu` erhöhte Proxy-Timeouts (siehe GNAI-020 Abschnitt NPM). + +## Theme (GNAI-021): GNMON Catppuccin Mocha als Default + +- `files/theme/gnai-catppuccin-mocha.css` wird nach + `/var/lib/ghostnet-ai/production/openwebui-theme/custom.css` deployt und im + Quadlet **read-only** über `/app/backend/open_webui/static/custom.css` + gemountet (`Volume=...:ro`). +- `index.html` lädt `/static/custom.css` auf jeder Seite — update-sicher: Beim + Container-Start kopiert OpenWebUI zwar `static/` neu (`config.py`), aber + eine read-only Einzeldatei kann weder unlinkt noch überschrieben werden; + der Mount liegt host-seitig im Quadlet, die Datei kommt aus Git. Image-Updates + (neuer Digest) ändern daran nichts. +- Default für alle Nutzer: OpenWebUI speichert die Theme-Wahl (light/dark) nur + pro Browser in `localStorage` — es gibt keinen server-seitigen Default. Das + CSS bildet daher `html.light` UND `html.dark` auf dieselbe Mocha-Palette ab + (`!important` gegen die Inline-Styles von `setTheme()`), sodass das + GNMON-Theme unabhängig von der UI-Auswahl immer greift. +- Verifikation: Task `Verify the GNMON theme is served as /static/custom.css` + prüft nach dem Health-Check, dass die Datei non-empty mit Marker ausgeliefert + wird. + +## Favicon (GNAI-021): ursprünglicher Geist (wie Monitoring-Website) + +- `files/favicon/` (favicon.png 32px und apple-touch-icon.png 180px + byte-identisch zum Dashboard-Original, dazu favicon-96x96.png, favicon.ico, + favicon.svg als Ableitungen) wird nach + `/var/lib/ghostnet-ai/production/openwebui-favicon/` deployt und im Quadlet + **read-only** über die entsprechenden Dateien in + `/app/backend/open_webui/static/` gemountet (app.html referenziert alle fünf). +- Update-persistent wie das Theme: Mount host-seitig im Quadlet, Datei aus Git; + OpenWebUIs Start-Kopie von `static/` kann eine ro-Einzeldatei nicht anfassen. +- Achtung Inode: Single-File-Bind-Mounts binden den Inode bei der + Container-Erzeugung; Ansible `copy` ersetzt die Datei (Rename → neuer Inode). + Inhaltsänderungen notifies deshalb `Restart OpenWebUI unit`, und + `flush_handlers` läuft vor den Served-Checks, damit die geprüft wird, was + der Neustart neu gebunden hat. +- Verifikation: `GET /static/favicon.png` muss byte-identisch zur deployen Datei + sein (content_length vs. stat). diff --git a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml index b6704ca..8ecceee 100644 --- a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml +++ b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml @@ -48,6 +48,38 @@ open_webui_container_port: 8080 # Persistent app data (SQLite DB, uploads, cache). open_webui_data_dir: /var/lib/ghostnet-ai/production/openwebui-data +# GNMON theme (GNAI-021): Catppuccin Mocha wie das Monitoring-Dashboard. +# Wird als einzelne read-only-Datei über den Image-Placeholder +# /app/backend/open_webui/static/custom.css gemountet (index.html lädt +# /static/custom.css auf jeder Seite). Beim Container-Start kopiert OpenWebUI +# sein static/-Verzeichnis zwar neu (config.py), aber eine read-only +# Einzeldatei kann weder unlinkt noch überschrieben werden — die Fehler werden +# upstream ge-swallowt. Das Theme überlebt Image-Updates, weil der Mount +# host-seitig im Quadlet liegt und die Datei aus diesem Repo kommt. +open_webui_theme_dir: /var/lib/ghostnet-ai/production/openwebui-theme +open_webui_theme_src: theme/gnai-catppuccin-mocha.css +open_webui_theme_file: custom.css +open_webui_theme_container_path: /app/backend/open_webui/static/custom.css + +# Favicon (GNAI-021): the ORIGINAL ghost favicon of the monitoring site +# (byte-identical PNGs from src/Ghostnet.Dashboard/wwwroot/), same +# update-persistent mechanism as the theme: read-only single-file mounts over +# the image's /app/backend/open_webui/static/* favicon files (app.html +# references all of them). Badge variants were tried and rejected by the +# operator 2026-11-14 — both sites use the plain ghost. +open_webui_favicon_dir: /var/lib/ghostnet-ai/production/openwebui-favicon +open_webui_favicon_mounts: + - host_file: favicon.png + container_path: /app/backend/open_webui/static/favicon.png + - host_file: favicon-96x96.png + container_path: /app/backend/open_webui/static/favicon-96x96.png + - host_file: favicon.svg + container_path: /app/backend/open_webui/static/favicon.svg + - host_file: favicon.ico + container_path: /app/backend/open_webui/static/favicon.ico + - host_file: apple-touch-icon.png + container_path: /app/backend/open_webui/static/apple-touch-icon.png + # OIDC phase (M6 public route via NPM + Keycloak). Disabled for the # internal phase; enable together with the Keycloak client # `gnai-openwebui` and the NPM proxy host chat.ghostnet.selfhost.eu. diff --git a/llm-server/llm/ansible/roles/open_webui/files/favicon/apple-touch-icon.png b/llm-server/llm/ansible/roles/open_webui/files/favicon/apple-touch-icon.png new file mode 100644 index 0000000..fa7dbd1 Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/favicon/apple-touch-icon.png differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon-96x96.png b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon-96x96.png new file mode 100644 index 0000000..31f37cb Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon-96x96.png differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.ico b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.ico new file mode 100644 index 0000000..7aa0608 Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.ico differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.png b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.png new file mode 100644 index 0000000..23030a4 Binary files /dev/null and b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.png differ diff --git a/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.svg b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.svg new file mode 100644 index 0000000..3581051 --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/files/favicon/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/llm-server/llm/ansible/roles/open_webui/files/theme/gnai-catppuccin-mocha.css b/llm-server/llm/ansible/roles/open_webui/files/theme/gnai-catppuccin-mocha.css new file mode 100644 index 0000000..7f8914e --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/files/theme/gnai-catppuccin-mocha.css @@ -0,0 +1,134 @@ +/* Ghostnet.AI OpenWebUI theme "gnai-catppuccin-mocha" (GNAI-021). + * + * Farbschema identisch zum Monitoring-Dashboard (GNMON, app.css): + * Catppuccin Mocha + Monospace (DejaVu Sans Mono, wie im Dashboard selbst + * gehostet — hier als System-Stack, damit keine Font-Datei gemountet werden + * muss). + * + * Auslieferung: read-only bind mount over + * /app/backend/open_webui/static/custom.css (siehe Quadlet). index.html lädt + * /static/custom.css auf jeder Seite — update-sicher, weil der Mount host-seitig + * im Quadlet liegt und die Datei aus dem Repo kommt. + * + * Default-Theme: OpenWebUI speichert die Theme-Wahl (light/dark) pro Browser in + * localStorage; es gibt keinen server-seitigen Default. Dieses CSS bildet daher + * BEIDE Modi (html.light und html.dark) auf dieselbe Mocha-Palette ab — das + * GNMON-Theme ist damit für alle Nutzer der Default-Look, unabhängig von der + * Theme-Auswahl im UI. + * + * !important ist nötig, weil setTheme() (src/lib/utils/theme.ts) die Graustufen + * 800/850/900/950 als Inline-Style auf setzt; Inline-Styles schlagen + * Stylesheet-Regeln ohne !important. Ungelayertes CSS (diese Datei) schlägt + * además die @layer-theme-Variablen von Tailwind v4. + */ + +/* Basis (gilt immer, auch vor dem Setzen der light/dark-Klasse): Modus-Mapping + * für dark — zugleich Akzent-Rampen für beide Modi. */ +html:root { + color-scheme: dark; + + /* Monospace wie GNMON */ + --font-sans: "DejaVu Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important; + + /* Graustufen → Catppuccin Mocha (Dark-Semantik: 950 = tiefster Hintergrund) */ + --color-gray-50: #cdd6f4 !important; /* text */ + --color-gray-100: #cdd6f4 !important; /* text */ + --color-gray-200: #bac2de !important; /* subtext1 */ + --color-gray-300: #a6adc8 !important; /* subtext0 */ + --color-gray-400: #7f849c !important; /* overlay1 */ + --color-gray-500: #6c7086 !important; /* overlay0 */ + --color-gray-600: #585b70 !important; /* surface2 */ + --color-gray-700: #45475a !important; /* surface1 */ + --color-gray-800: #313244 !important; /* surface0 */ + --color-gray-850: #181825 !important; /* mantle */ + --color-gray-900: #1e1e2e !important; /* base */ + --color-gray-950: #11111b !important; /* crust */ + + /* In dark mode ist --color-white meist Textfarbe, --color-black Button-Grund */ + --color-white: #cdd6f4 !important; + --color-black: #11111b !important; + + /* Akzenten → Catppuccin (Links/Fokus blau, Erfolg grün, Fehler rot, Warnung gelb) */ + --color-blue-300: #b4befe !important; /* lavender */ + --color-blue-400: #74c7ec !important; /* sapphire */ + --color-blue-500: #89b4fa !important; /* blue */ + --color-blue-600: #89b4fa !important; + --color-blue-700: #74c7ec !important; + --color-green-400: #a6e3a1 !important; + --color-green-500: #a6e3a1 !important; + --color-green-600: #94e2d5 !important; /* teal */ + --color-red-400: #f38ba8 !important; + --color-red-500: #f38ba8 !important; + --color-yellow-300: #f9e2af !important; + --color-yellow-400: #f9e2af !important; + --color-yellow-500: #fab387 !important; /* peach */ + --color-orange-400: #fab387 !important; + --color-orange-500: #fab387 !important; + --color-violet-400: #cba6f7 !important; /* mauve */ + --color-violet-500: #cba6f7 !important; + --color-teal-400: #94e2d5 !important; + --color-teal-500: #94e2d5 !important; +} + +/* html.dark: identisch zur Basis — explizit mit !important gegen die + * Inline-Styles, die setTheme() für dark/oled-dark auf schreibt. */ +html.dark { + --color-gray-800: #313244 !important; + --color-gray-850: #181825 !important; + --color-gray-900: #1e1e2e !important; + --color-gray-950: #11111b !important; +} + +/* html.light: die Light-Rampe wird auf DERSELBE dunkle Mocha-Palette abgebildet + * (bg-white → base, text-gray-900 → text usw.), damit auch Nutzer mit Theme + * "light"/"system" (prefers-color-scheme: light) das GNMON-Theme sehen. */ +html.light { + --color-white: #1e1e2e !important; /* Light-Haupthintergrund → base */ + --color-black: #cdd6f4 !important; /* Light-Text → text */ + --color-gray-50: #181825 !important; /* helle Panels → mantle */ + --color-gray-100: #313244 !important; /* → surface0 */ + --color-gray-200: #45475a !important; /* Borders → surface1 */ + --color-gray-300: #585b70 !important; /* → surface2 */ + --color-gray-400: #6c7086 !important; /* → overlay0 */ + --color-gray-500: #7f849c !important; /* → overlay1 */ + --color-gray-600: #a6adc8 !important; /* → subtext0 */ + --color-gray-700: #bac2de !important; /* → subtext1 */ + --color-gray-800: #cdd6f4 !important; /* → text */ + --color-gray-850: #cdd6f4 !important; + --color-gray-900: #cdd6f4 !important; /* Light-Text → text */ + --color-gray-950: #cdd6f4 !important; +} + +/* Splash-Screen (app.html) auf Mocha trimmen — !important schlägt die + * Inline-Styles des Splash-Markups. */ +#splash-screen { + background: #1e1e2e !important; +} + +#splash-screen #progress-background { + background-color: #313244 !important; +} + +#splash-screen #progress-bar { + background-color: #a6e3a1 !important; +} + +/* Akzente im Fließtext (GNMON: Links sapphire, Code peach) */ +.marked a, +.prose a { + color: #74c7ec; +} + +.marked a:hover, +.prose a:hover { + color: #89dceb; +} + +code { + color: #fab387; +} + +::selection { + background: rgba(203, 166, 247, 0.35); /* mauve */ + color: #cdd6f4; +} diff --git a/llm-server/llm/ansible/roles/open_webui/tasks/main.yml b/llm-server/llm/ansible/roles/open_webui/tasks/main.yml index c7bf679..06a9b48 100644 --- a/llm-server/llm/ansible/roles/open_webui/tasks/main.yml +++ b/llm-server/llm/ansible/roles/open_webui/tasks/main.yml @@ -52,6 +52,45 @@ group: "{{ open_webui_user }}" mode: "0750" +- name: Ensure the OpenWebUI theme directory exists + ansible.builtin.file: + path: "{{ open_webui_theme_dir }}" + state: directory + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0750" + +- name: Deploy the GNMON theme as custom.css (read-only mount target, survives image updates) + # Single-file bind mounts pin the inode at container creation; Ansible copy + # replaces the file (rename -> new inode), so a content change MUST restart + # the unit to re-bind the current file. Hence the notify. + ansible.builtin.copy: + src: "files/{{ open_webui_theme_src }}" + dest: "{{ open_webui_theme_dir }}/{{ open_webui_theme_file }}" + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0644" + notify: Restart OpenWebUI unit + +- name: Ensure the OpenWebUI favicon directory exists + ansible.builtin.file: + path: "{{ open_webui_favicon_dir }}" + state: directory + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0750" + +- name: Deploy the ghost favicon files (read-only mount targets, survive image updates) + # Same inode caveat as the theme: content changes notify a unit restart. + ansible.builtin.copy: + src: "files/favicon/{{ item.host_file }}" + dest: "{{ open_webui_favicon_dir }}/{{ item.host_file }}" + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0644" + loop: "{{ open_webui_favicon_mounts }}" + notify: Restart OpenWebUI unit + - name: Check whether the WebUI secret key already exists ansible.builtin.command: argv: @@ -420,6 +459,13 @@ changed_when: false when: not ansible_check_mode +- name: Flush handlers before the served checks + # Content changes to the ro-mounted files notify "Restart OpenWebUI unit"; + # the restart must happen BEFORE the served checks, otherwise they test the + # stale inode still bound by the running container. + ansible.builtin.meta: flush_handlers + when: not ansible_check_mode + - name: Wait for the OpenWebUI health endpoint ansible.builtin.uri: url: "http://{{ open_webui_host_addr }}:{{ open_webui_host_port }}/health" @@ -431,6 +477,36 @@ until: open_webui_health.status == 200 when: not ansible_check_mode +- name: Verify the GNMON theme is served as /static/custom.css (non-empty, marker present) + # Guards the update-persistence contract: if a future OpenWebUI image stops + # referencing or serving custom.css, this fails instead of silently losing + # the theme. + ansible.builtin.uri: + url: "http://{{ open_webui_host_addr }}:{{ open_webui_host_port }}/static/custom.css" + status_code: 200 + timeout: 10 + return_content: true + register: open_webui_theme_served + failed_when: "'gnai-catppuccin-mocha' not in open_webui_theme_served.content" + when: not ansible_check_mode + +- name: Stat the deployed favicon for the served-size comparison + ansible.builtin.stat: + path: "{{ open_webui_favicon_dir }}/favicon.png" + register: open_webui_favicon_stat + when: not ansible_check_mode + +- name: Verify the ghost favicon is served as /static/favicon.png (byte-identical to the deployed file) + ansible.builtin.uri: + url: "http://{{ open_webui_host_addr }}:{{ open_webui_host_port }}/static/favicon.png" + status_code: 200 + timeout: 10 + register: open_webui_favicon_served + failed_when: >- + open_webui_favicon_served.content_length | int + != open_webui_favicon_stat.stat.size | int + when: not ansible_check_mode + - name: Verify the engine model list is reachable through OpenWebUI's network ansible.builtin.command: argv: diff --git a/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 b/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 index 4888c2d..27a6f94 100644 --- a/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 +++ b/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 @@ -11,6 +11,16 @@ Network={{ open_webui_network_name }} Network={{ open_webui_egress_network_name }} PublishPort={{ open_webui_host_addr }}:{{ open_webui_host_port }}:{{ open_webui_container_port }} Volume={{ open_webui_data_dir }}:/app/backend/data:rw +# GNMON theme (GNAI-021): read-only single-file mount over the image's empty +# custom.css placeholder. Survives image updates — the mount lives host-side +# in this quadlet, and OpenWebUI's startup static re-copy cannot unlink or +# overwrite a read-only bind-mounted file. +Volume={{ open_webui_theme_dir }}/{{ open_webui_theme_file }}:{{ open_webui_theme_container_path }}:ro +# Favicon (GNAI-021): original ghost, same read-only single-file mount pattern +# over the image's static favicon files (app.html references all of them). +{% for m in open_webui_favicon_mounts %} +Volume={{ open_webui_favicon_dir }}/{{ m.host_file }}:{{ m.container_path }}:ro +{% endfor %} # Secrets are injected as environment variables, never written to disk or git. Secret={{ open_webui_webui_secret_key_secret }},type=env,target=WEBUI_SECRET_KEY Secret={{ open_webui_engine_api_key_secret }},type=env,target=OPENAI_API_KEY