From a4cdd098fff5f604439893fe4c5eb57e81be3af0 Mon Sep 17 00:00:00 2001 From: spektr Date: Wed, 11 Nov 2026 06:40:55 +0100 Subject: [PATCH] M6: OpenWebUI intern produktiv (Rolle open_webui, v0.13.3 digest-gepinnt) + Produktentscheidung API+WebUI, LiteLLM faellt fuer M6 weg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - llm/ansible: Rolle open_webui + playbooks/webui.yml (Production-Netz, Engine via llama-cpp:8080/v1, Ingress 10.0.0.90:8081, Secrets als Podman-Secrets, idempotent changed=0); Health/Model-Liste/Chat-Completion getestet - gnmon_firewall: Port 8081 (OpenWebUI) nur von NPM 10.0.0.10 - CT 100: Split-DNS chat.ghostnet.selfhost.eu -> 10.0.0.10 (intern) / WAN (public) - Doku: GNAI-000/001 — M0 entschieden (API+OpenWebUI), LiteLLM-Gate M6 = nein Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- docs/GNAI-000-DOC_Index.md | 17 +- docs/GNAI-001-PLAN_Project-Roadmap.md | 4 +- llm-server/llm/ansible/playbooks/webui.yml | 14 ++ .../llm/ansible/roles/open_webui/README.md | 19 ++ .../roles/open_webui/defaults/main.yml | 47 ++++ .../roles/open_webui/handlers/main.yml | 17 ++ .../ansible/roles/open_webui/tasks/main.yml | 223 ++++++++++++++++++ .../templates/open-webui.container.j2 | 26 ++ .../roles/gnmon_firewall/defaults/main.yml | 7 + .../gnmon_firewall/templates/nftables.conf.j2 | 7 +- .../agent/group_vars/dns_hosts.yml | 2 + .../bootstrap/group_vars/dns_hosts.yml | 2 + .../production/group_vars/dns_hosts.yml | 2 + .../roles/dns_pihole/defaults/main.yml | 2 + 14 files changed, 382 insertions(+), 7 deletions(-) create mode 100644 llm-server/llm/ansible/playbooks/webui.yml create mode 100644 llm-server/llm/ansible/roles/open_webui/README.md create mode 100644 llm-server/llm/ansible/roles/open_webui/defaults/main.yml create mode 100644 llm-server/llm/ansible/roles/open_webui/handlers/main.yml create mode 100644 llm-server/llm/ansible/roles/open_webui/tasks/main.yml create mode 100644 llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 diff --git a/docs/GNAI-000-DOC_Index.md b/docs/GNAI-000-DOC_Index.md index 36149ea..32b6fea 100644 --- a/docs/GNAI-000-DOC_Index.md +++ b/docs/GNAI-000-DOC_Index.md @@ -88,7 +88,7 @@ Hauptverzeichnisse `llm-server/host/` (Grundkonfiguration des Servers), | --- | --- | --- | | KI-Host | Debian 13.6, Deployment-Zugang, Podman 5.4.2, getrennte rootless Konten, Gerätezugriff für beide KI-Konten; IPv4-only (31.10., GNAI-002 6); Lüftersteuerungs-Dienst `gnai-gpu-fan-control` als Dauerlösung (05.11., GNAI-010 10.10); Backup/Restore praktisch belegt (06.11., GNAI-008 14.6) und Backup-Unit per `RequiresMountsFor` boot-sicher (Fix 09.11., GNAI-008 14.6/0.21); Host-Neustart mit automatischem Production-Recovery (06.11. und erneut 09.11.2026, GNAI-008 14.6) | Host-/Treiber-Upgradepfad | | GPU/ROCm | beide RX 6900 XT als `gfx1030`, `ROCm0` und `ROCm1` im gepinnten Testing-Image erkannt; Modellladen, Layer-Verteilung und reale Inferenz auf beiden GPUs; 64k- und 128k-Stabilität in Testing (GNAI-010 10.5–10.9); GPU-Sensoren im Monitoring mit Alarmgrenzen (GNMON-000 M4/M5, verifiziert 09.11.2026) | Hardware-Ursache des thermischen Defekts an Slot `03:00.0` (GNAI-010 10.10) — Lüfterkurven-Service überbrückt als Dauerlösung | -| LLM-Serving | drei gepinnte Profile (Swift 1.0, Swift 1.5, Unsloth); Testing-Abnahme 64k/128k je Profil (GNAI-010 10.5–10.9); Production-Umgebung live mit Swift 1.5 Q6_K seit 06.11.2026 (Betreiberbeschluss 05.11., GNAI-009 10.4) inklusive Health, Alias und Inferenztest; exklusive Umschaltmechanik mit Recovery (GNAI-008 14.6, T1–T7; nach Neustart 09.11.2026 `gn_ai_active_env{env="production"}=1` verifiziert) | öffentlicher Nutzerpfad (M6), LLM-Metriken jenseits `gn_ai_active_env`, Nutzerakzeptanzprüfung (GNAI-009 5.3) | +| LLM-Serving | drei gepinnte Profile (Swift 1.0, Swift 1.5, Unsloth); Testing-Abnahme 64k/128k je Profil (GNAI-010 10.5–10.9); Production-Umgebung live mit Swift 1.5 Q6_K seit 06.11.2026 (Betreiberbeschluss 05.11., GNAI-009 10.4) inklusive Health, Alias und Inferenztest; exklusive Umschaltmechanik mit Recovery (GNAI-008 14.6, T1–T7; nach Neustart 09.11.2026 `gn_ai_active_env{env="production"}=1` verifiziert); **OpenWebUI v0.13.3 (digest-gepinnt) intern produktiv seit 10.11.2026** — Health 200, Model-Liste, reale Chat-Completion via OpenWebUI → llama.cpp (Rolle `open_webui`, Playbook `webui.yml`, Ingress `10.0.0.90:8081` nur von NPM, Split-DNS `chat.ghostnet.selfhost.eu` live) | öffentlicher Nutzerpfad (M6: NPM-Route + Keycloak-OIDC für chat.*, externe Pos/Neg-Tests), LLM-Metriken jenseits `gn_ai_active_env`, Nutzerakzeptanzprüfung (GNAI-009 5.3) | | Deployment | lokales Ansible-Control-Projekt und idempotente Hostrollen; Production-Inventar mit Referenz- und Rollback-Profil, `ai_environment_switch` und Backup-Timer deployt und abgenommen (GNAI-008 14.6) | statische CI, Runner, geschützte Freigaben und automatisierter Rollback über die Delivery-Kette | | VPN | wg-easy v15.4.0; einziger Peer `ghost-laptop` als Server Admin; native nftables-Zielpolicy und NAT, Legacy-Bereinigung, Fremdnetz-, Positiv-/Negativ-, Dienst- und LXC-Wiederanlauftests bestanden; CT 104 am 07.10.2026 als zwölftes Ziel praktisch abgenommen; WAN-Exposure-Erfassung 10.11.2026: nur TCP 80/443 offen, keine AAAA (GNAI-007 7); frischer Stop-Mode-vzdump + hostunabhängige Kopie auf `ghostnet-ki` am 10.11.2026 | Fremdnetz-WAN-Rescan vom Hotspot (UDP 51820, TCP-Portmatrix), FRITZ!Box-Forward-/IPv6-Abgleich, wg-easy-GUI-HTTPS und KI-Server-Test bei eingeschaltetem Host | | DNS / Pi-hole | CT 100 unter `10.0.0.14` mit digest-gepinntem Pi-hole 2026.09.0 als Podman-Quadlet; SSH/nftables, UDP/TCP-DNS, Split-DNS, Blocking/Allowlist, FRITZ!Box-Cutover, LXC-Reboot und Stop-Mode-Backup am 01.10.2026 abgenommen; Ansible-Projekt am 09.11.2026 adoptiert (ansible-deploy via pct; `site.yml`/`verify-production` `changed=0`) und Split-DNS-Record `mon.ghostnet.selfhost.eu → 10.0.0.10` live (verifiziert per `dig @10.0.0.14`); frischer Stop-Mode-vzdump + hostunabhängige Kopie auf `ghostnet-ki` + praktischer Restore-Test (CT 150) am 10.11.2026 (GNAI-012 10.2) | vollständige App-/OIDC-Regression, praktischer FRITZ!Box-Rollback, mobile DuckDuckGo-/IPv6-Strategie, WireGuard-Profile | @@ -167,11 +167,20 @@ offenen Erstimplementierungen mehr. Noch zu entscheiden sind insbesondere: -- API-only oder zusätzlich Weboberfläche als erstes Nutzerprodukt; -- ob LiteLLM in der ersten Veröffentlichung für individuelle Keys, Quoten oder - Routing tatsächlich benötigt wird; - Freigabe- und Secret-Modell für einen späteren privilegierten Runner. +**Entsieden am 10.11.2026 (Betreiber):** Erstes Nutzerprodukt (M6) ist +**API plus Weboberfläche via OpenWebUI** — OpenWebUI sitzt im +Production-Netz auf `ghostnet-ki` (`10.0.0.90:8081`, nur NPM darf durch), +reicht die Engine über `http://llama-cpp:8080/v1` an und wird öffentlich über +NPM + Keycloak-OIDC freigegeben (`chat.ghostnet.selfhost.eu`). **LiteLLM +fällt für M6 weg** (Entscheidungstor GNAI-001 M6 geschlossen): individuelle +API-Keys und Rollen macht OpenWebUI selbst, Rate-Limits kommen auf +NPM-Ebene; LiteLLM bleibt Zielbild-Kandidat, falls später Quotas/Routing +pro Backend nötig werden. Interner Slice abgenommen 10.11.2026 (Health, +Model-Liste, reale Chat-Completion durch OpenWebUI → llama.cpp mit +Token-Usage). + Bereits entschieden (nicht mehr offen): Das Backupziel ist die bestehende NFS-Anbindung der Encoding-Pipeline (`pve:/media/datenhdd3/Encoding`), die Aufbewahrung beträgt 8 Archive und der Restore ist praktisch belegt diff --git a/docs/GNAI-001-PLAN_Project-Roadmap.md b/docs/GNAI-001-PLAN_Project-Roadmap.md index 9683368..af498db 100644 --- a/docs/GNAI-001-PLAN_Project-Roadmap.md +++ b/docs/GNAI-001-PLAN_Project-Roadmap.md @@ -41,7 +41,9 @@ Laufprotokolle noch duplizierte Sollparameter. - festlegen, ob Sicherheits-Meilenstein 1 den internen LLM-Test blockiert oder kontrolliert parallel läuft; -- erstes Produkt als API-only oder API plus Weboberfläche festlegen; +- erstes Produkt als API-only oder API plus Weboberfläche festlegen + — **entschieden 10.11.2026: API plus Weboberfläche (OpenWebUI)**, siehe + GNAI-000 Abschnitt 4; - 64k-Basis und 128k-Ziel als Abnahmemodell bestätigen; - Verantwortliche für Review, Deployment und Sicherheitsabnahme benennen. diff --git a/llm-server/llm/ansible/playbooks/webui.yml b/llm-server/llm/ansible/playbooks/webui.yml new file mode 100644 index 0000000..11d081d --- /dev/null +++ b/llm-server/llm/ansible/playbooks/webui.yml @@ -0,0 +1,14 @@ +--- +# Deploys the OpenWebUI chat frontend for the Production environment only +# (GNAI-001 milestone 6). The engine stack itself is managed by ai.yml; +# this playbook never changes engine state and requires the Production +# engine network to exist (run ai.yml first). +# +# Usage: +# ansible-playbook -i inventories/production playbooks/webui.yml --check --diff +# ansible-playbook -i inventories/production playbooks/webui.yml +- name: Deploy the OpenWebUI frontend for the Production environment + hosts: llm_servers + become: true + roles: + - role: open_webui diff --git a/llm-server/llm/ansible/roles/open_webui/README.md b/llm-server/llm/ansible/roles/open_webui/README.md new file mode 100644 index 0000000..dfdb7f5 --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/README.md @@ -0,0 +1,19 @@ +# open_webui + +OpenWebUI chat frontend for the **Production** LLM environment (GNAI-001 +milestone 6). Deployed by `playbooks/webui.yml` against +`inventories/production` only. + +- Image gepinnt per Digest (`v0.13.3`, `sha256:46b59158…`), `Pull=never`. +- Läuft als `gnai-production` im Production-Netz `gnai-production-llama` + und erreicht die Engine über `http://llama-cpp:8080/v1` — kein Host-Port + der Engine nötig. +- Ingress: `10.0.0.90:8081` (Container-Port 8080); Host-Firewall + (`gnmon_firewall`, Portliste `gnmon_firewall_npm_only_ports`) lässt nur + NPM (`10.0.0.10`) durch. +- Secrets als Podman-Secrets (`type=env`), nie in Git: `WEBUI_SECRET_KEY` + (random, bei Erstanlage erzeugt) und `OPENAI_API_KEY` (Placeholder; die + Engine selbst hat keine Auth). +- Daten: `/var/lib/ghostnet-ai/production/openwebui-data`. +- Interne Phase: lokaler Auth (erster User = Admin). Die öffentliche + OIDC-Phase (NPM-Route + Keycloak-Client) folgt in M6. diff --git a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml new file mode 100644 index 0000000..6a617ee --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml @@ -0,0 +1,47 @@ +--- +# OpenWebUI application role (GNAI-001 milestone 6, first user path). +# Runs as the Production workload account inside the Production engine +# network, so it reaches llama.cpp via the network alias without any host +# port on the engine. The app itself is published on the LAN address only, +# and the host firewall (gnmon_firewall) restricts it to NPM (10.0.0.10). +# +# Image: immutable digest, never a moving tag (GNAI-010 section 3.1). +# v0.13.3 (2026-11-08), index digest resolved 2026-11-11. +open_webui_image: ghcr.io/open-webui/open-webui +open_webui_image_ref: ghcr.io/open-webui/open-webui@sha256:46b59158e6558eeb980bc828e0f1b30238ad24d82ed84d5e5eda1dab2a082f14 +open_webui_image_tag: v0.13.3 + +# Reuses the Production environment identity and network (GNAI-008 7.4). +open_webui_user: gnai-production +open_webui_uid: 980 +open_webui_home: /var/lib/ghostnet-ai/production +open_webui_quadlet_dir: /etc/containers/systemd/users/980 +open_webui_unit_prefix: gnai-production-openwebui +open_webui_network_name: gnai-production-llama + +# Engine endpoint inside the shared Production network. llama.cpp itself +# has no auth; OpenWebUI just needs a non-empty key value, supplied via a +# Podman secret (never in git). +open_webui_engine_base_url: http://llama-cpp:8080/v1 +open_webui_engine_api_key_secret: openwebui-engine-api-key +open_webui_webui_secret_key_secret: openwebui-webui-secret-key + +# App ingress: LAN address, port 8081, firewall-limited to NPM (CT-103). +open_webui_host_addr: 10.0.0.90 +open_webui_host_port: 8081 +open_webui_container_port: 8080 + +# Persistent app data (SQLite DB, uploads, cache). +open_webui_data_dir: /var/lib/ghostnet-ai/production/openwebui-data + +# Internal phase: local auth with first-user-is-admin. The public OIDC +# phase (M6 route) switches ENABLE_OAUTH_* on and disables local signup. +open_webui_env: + WEBUI_AUTH: "True" + OPENAI_API_BASE_URL: "{{ open_webui_engine_base_url }}" + DATA_DIR: /app/backend/data + ENABLE_SIGNUP: "True" + DEFAULT_USER_ROLE: user + ENABLE_OAUTH_SIGNUP: "False" + ENABLE_LOGIN_FORM: "True" + ENABLE_RAG_WEB_SEARCH: "False" diff --git a/llm-server/llm/ansible/roles/open_webui/handlers/main.yml b/llm-server/llm/ansible/roles/open_webui/handlers/main.yml new file mode 100644 index 0000000..6c41786 --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/handlers/main.yml @@ -0,0 +1,17 @@ +--- +- name: Reload workload user manager + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/systemctl + - --user + - daemon-reload + chdir: "{{ open_webui_home }}" + changed_when: false + when: not ansible_check_mode diff --git a/llm-server/llm/ansible/roles/open_webui/tasks/main.yml b/llm-server/llm/ansible/roles/open_webui/tasks/main.yml new file mode 100644 index 0000000..9aa44c8 --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/tasks/main.yml @@ -0,0 +1,223 @@ +--- +- name: Verify open_webui role declarations + ansible.builtin.assert: + that: + - open_webui_image_ref is match('^ghcr.io/open-webui/open-webui@sha256:[0-9a-f]{64}$') + - open_webui_network_name == 'gnai-production-llama' + fail_msg: "open_webui must use the pinned digest and the Production network" + +- name: Check whether the pinned OpenWebUI image is in the workload store + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/podman + - image + - exists + - "{{ open_webui_image_ref }}" + chdir: "{{ open_webui_home }}" + changed_when: false + failed_when: open_webui_image_present.rc not in [0, 1] + check_mode: false + register: open_webui_image_present + +- name: Pull the pinned OpenWebUI image into the workload store + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/podman + - pull + - "{{ open_webui_image_ref }}" + chdir: "{{ open_webui_home }}" + when: + - not ansible_check_mode + - open_webui_image_present.rc != 0 + +- name: Ensure the OpenWebUI data directory exists + ansible.builtin.file: + path: "{{ open_webui_data_dir }}" + state: directory + owner: "{{ open_webui_user }}" + group: "{{ open_webui_user }}" + mode: "0750" + +- name: Check whether the WebUI secret key already exists + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/podman + - secret + - exists + - "{{ open_webui_webui_secret_key_secret }}" + chdir: "{{ open_webui_home }}" + register: open_webui_secret_exists + changed_when: false + failed_when: open_webui_secret_exists.rc not in [0, 1] + check_mode: false + +- name: Create the WebUI secret key (random, on the host only) + # Piped via stdin: a root-created temp file would not be readable by the + # workload user (umask), so the secret never touches the filesystem. + ansible.builtin.shell: | + set -euo pipefail + head -c 48 /dev/urandom | base64 \ + | /usr/sbin/runuser --user {{ open_webui_user }} -- /usr/bin/env \ + HOME={{ open_webui_home }} XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }} \ + /usr/bin/podman secret create {{ open_webui_webui_secret_key_secret }} - + # runuser keeps the caller's cwd; the workload user cannot traverse + # /home/ansible-deploy, so run from the workload home. + args: + executable: /bin/bash + chdir: "{{ open_webui_home }}" + when: open_webui_secret_exists.rc == 1 + no_log: true + +- name: Check whether the engine API key secret already exists + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/podman + - secret + - exists + - "{{ open_webui_engine_api_key_secret }}" + chdir: "{{ open_webui_home }}" + register: open_webui_engine_secret_exists + changed_when: false + failed_when: open_webui_engine_secret_exists.rc not in [0, 1] + check_mode: false + +- name: Create the engine API key secret (placeholder, llama.cpp has no auth) + ansible.builtin.shell: | + set -euo pipefail + printf 'local-noauth-%s' "$(head -c 16 /dev/urandom | base64)" \ + | /usr/sbin/runuser --user {{ open_webui_user }} -- /usr/bin/env \ + HOME={{ open_webui_home }} XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }} \ + /usr/bin/podman secret create {{ open_webui_engine_api_key_secret }} - + args: + executable: /bin/bash + chdir: "{{ open_webui_home }}" + when: open_webui_engine_secret_exists.rc == 1 + no_log: true + +- name: Render the OpenWebUI quadlet + ansible.builtin.template: + src: open-webui.container.j2 + dest: "{{ open_webui_quadlet_dir }}/{{ open_webui_unit_prefix }}.container" + owner: root + group: "{{ open_webui_user }}" + mode: "0640" + notify: Reload workload user manager + +- name: Ensure the workload user manager knows the rendered unit + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/systemctl + - --user + - daemon-reload + chdir: "{{ open_webui_home }}" + changed_when: false + when: not ansible_check_mode + +- name: Read the current state of the OpenWebUI unit + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/systemctl + - --user + - is-active + - "{{ open_webui_unit_prefix }}.service" + chdir: "{{ open_webui_home }}" + changed_when: false + failed_when: open_webui_unit_state.rc not in [0, 3] + check_mode: false + register: open_webui_unit_state + +- name: Start the OpenWebUI unit + # Quadlet-generated units are transient and cannot be `enable`d directly; + # the [Install] section of the quadlet handles boot enablement, here we + # only start (same pattern as the inference_engine role). + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/systemctl + - --user + - start + - "{{ open_webui_unit_prefix }}.service" + chdir: "{{ open_webui_home }}" + when: + - not ansible_check_mode + - open_webui_unit_state.rc != 0 + +- name: Wait for the OpenWebUI health endpoint + ansible.builtin.uri: + url: "http://{{ open_webui_host_addr }}:{{ open_webui_host_port }}/health" + status_code: 200 + timeout: 10 + register: open_webui_health + retries: 30 + delay: 5 + until: open_webui_health.status == 200 + when: not ansible_check_mode + +- name: Verify the engine model list is reachable through OpenWebUI's network + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ open_webui_user }}" + - -- + - /usr/bin/env + - "HOME={{ open_webui_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}" + - /usr/bin/podman + - exec + - "{{ open_webui_unit_prefix }}" + - /bin/sh + - -c + - "curl -fsS --max-time 10 {{ open_webui_engine_base_url }}/models | grep -q swift" + chdir: "{{ open_webui_home }}" + register: open_webui_models + changed_when: false + when: not ansible_check_mode 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 new file mode 100644 index 0000000..fd66ce3 --- /dev/null +++ b/llm-server/llm/ansible/roles/open_webui/templates/open-webui.container.j2 @@ -0,0 +1,26 @@ +[Unit] +Description=OpenWebUI chat frontend for the Production LLM engine ({{ open_webui_image_tag }}) +Wants={{ open_webui_network_name }}-network.service +After={{ open_webui_network_name }}-network.service + +[Container] +Image={{ open_webui_image_ref }} +Pull=never +ContainerName={{ open_webui_unit_prefix }} +Network={{ open_webui_network_name }} +PublishPort={{ open_webui_host_addr }}:{{ open_webui_host_port }}:{{ open_webui_container_port }} +Volume={{ open_webui_data_dir }}:/app/backend/data:rw +# 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 +{% for key, value in open_webui_env.items() %} +Environment={{ key }}={{ value }} +{% endfor %} + +[Service] +Restart=on-failure +RestartSec=10 +TimeoutStartSec=600 + +[Install] +WantedBy=default.target diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml b/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml index 69ad868..fb60ec4 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml @@ -18,6 +18,13 @@ gnmon_firewall_service_name: nftables.service gnmon_firewall_dashboard_port: 8080 gnmon_firewall_dashboard_allowed_ip: 10.0.0.10 +# LAN-published app ports reachable only from NPM (CT-103): 8080 dashboard +# (GNMON M6), 8081 OpenWebUI (GNAI-001 M6, role open_webui in the llm +# project). NPM terminates TLS and OIDC in front of both. +gnmon_firewall_npm_only_ports: + - 8080 + - 8081 + # Monitoring APIs bind to 127.0.0.1 (GNMON-000 M5); deny non-loopback # access to them anyway (defense in depth, GNMON-001 section 7). gnmon_firewall_loopback_only_ports: diff --git a/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 b/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 index ddfe89e..0d20436 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/templates/nftables.conf.j2 @@ -17,8 +17,11 @@ table inet gnmon_filter { iifname "lo" accept - # M6: dashboard ingress only from NPM (CT-103, {{ gnmon_firewall_dashboard_allowed_ip }}). - ip saddr != {{ gnmon_firewall_dashboard_allowed_ip }} tcp dport {{ gnmon_firewall_dashboard_port }} drop + # M6: LAN-published app ports (dashboard 8080, OpenWebUI 8081) are + # reachable only from NPM (CT-103, {{ gnmon_firewall_dashboard_allowed_ip }}). + {% for port in gnmon_firewall_npm_only_ports %} + ip saddr != {{ gnmon_firewall_dashboard_allowed_ip }} tcp dport {{ port }} drop + {% endfor %} # Monitoring APIs are bound to 127.0.0.1; deny non-loopback anyway. iifname != "lo" tcp dport { {{ gnmon_firewall_loopback_only_ports | join(', ') }} } drop diff --git a/proxmox/lxc/ct-100-dns/ansible/inventories/agent/group_vars/dns_hosts.yml b/proxmox/lxc/ct-100-dns/ansible/inventories/agent/group_vars/dns_hosts.yml index 3a0e7a1..00f3345 100644 --- a/proxmox/lxc/ct-100-dns/ansible/inventories/agent/group_vars/dns_hosts.yml +++ b/proxmox/lxc/ct-100-dns/ansible/inventories/agent/group_vars/dns_hosts.yml @@ -32,6 +32,8 @@ dns_pihole_hosts_records: - "10.0.0.10 auth-admin.ghostnet.selfhost.eu" # GNMON-001 M6: monitoring dashboard via NPM (CT-103); mirrors the role default. - "10.0.0.10 mon.ghostnet.selfhost.eu" + # GNAI-001 M6: OpenWebUI via NPM (CT-103). + - "10.0.0.10 chat.ghostnet.selfhost.eu" dns_pihole_timezone: Europe/Berlin dns_pihole_database_max_db_days: 30 dns_pihole_secret_name: pihole_web_password diff --git a/proxmox/lxc/ct-100-dns/ansible/inventories/bootstrap/group_vars/dns_hosts.yml b/proxmox/lxc/ct-100-dns/ansible/inventories/bootstrap/group_vars/dns_hosts.yml index 3a0e7a1..00f3345 100644 --- a/proxmox/lxc/ct-100-dns/ansible/inventories/bootstrap/group_vars/dns_hosts.yml +++ b/proxmox/lxc/ct-100-dns/ansible/inventories/bootstrap/group_vars/dns_hosts.yml @@ -32,6 +32,8 @@ dns_pihole_hosts_records: - "10.0.0.10 auth-admin.ghostnet.selfhost.eu" # GNMON-001 M6: monitoring dashboard via NPM (CT-103); mirrors the role default. - "10.0.0.10 mon.ghostnet.selfhost.eu" + # GNAI-001 M6: OpenWebUI via NPM (CT-103). + - "10.0.0.10 chat.ghostnet.selfhost.eu" dns_pihole_timezone: Europe/Berlin dns_pihole_database_max_db_days: 30 dns_pihole_secret_name: pihole_web_password diff --git a/proxmox/lxc/ct-100-dns/ansible/inventories/production/group_vars/dns_hosts.yml b/proxmox/lxc/ct-100-dns/ansible/inventories/production/group_vars/dns_hosts.yml index 3a0e7a1..00f3345 100644 --- a/proxmox/lxc/ct-100-dns/ansible/inventories/production/group_vars/dns_hosts.yml +++ b/proxmox/lxc/ct-100-dns/ansible/inventories/production/group_vars/dns_hosts.yml @@ -32,6 +32,8 @@ dns_pihole_hosts_records: - "10.0.0.10 auth-admin.ghostnet.selfhost.eu" # GNMON-001 M6: monitoring dashboard via NPM (CT-103); mirrors the role default. - "10.0.0.10 mon.ghostnet.selfhost.eu" + # GNAI-001 M6: OpenWebUI via NPM (CT-103). + - "10.0.0.10 chat.ghostnet.selfhost.eu" dns_pihole_timezone: Europe/Berlin dns_pihole_database_max_db_days: 30 dns_pihole_secret_name: pihole_web_password diff --git a/proxmox/lxc/ct-100-dns/ansible/roles/dns_pihole/defaults/main.yml b/proxmox/lxc/ct-100-dns/ansible/roles/dns_pihole/defaults/main.yml index 8a29b96..f638cfd 100644 --- a/proxmox/lxc/ct-100-dns/ansible/roles/dns_pihole/defaults/main.yml +++ b/proxmox/lxc/ct-100-dns/ansible/roles/dns_pihole/defaults/main.yml @@ -13,6 +13,8 @@ dns_pihole_hosts_records: - "10.0.0.10 auth-admin.ghostnet.selfhost.eu" # GNMON-001 M6: monitoring dashboard via NPM (CT-103). - "10.0.0.10 mon.ghostnet.selfhost.eu" + # GNAI-001 M6: OpenWebUI via NPM (CT-103). + - "10.0.0.10 chat.ghostnet.selfhost.eu" dns_pihole_database_max_db_days: 30 dns_pihole_service_name: pihole.service dns_pihole_quadlet_path: /etc/containers/systemd/pihole.container