From 8c347604f62510891f84fb85772f6d3a807a8a77 Mon Sep 17 00:00:00 2001 From: vibe-agent Date: Wed, 11 Nov 2026 22:10:46 +0100 Subject: [PATCH] M6: self-hosted SearXNG web search fuer OpenWebUI (#15) Co-authored-by: vibe-agent --- .../monitoring/GNMON-000-DOC_Index.md | 8 + llm-server/llm/ansible/playbooks/webui.yml | 1 + .../roles/open_webui/defaults/main.yml | 5 +- .../llm/ansible/roles/web_search/README.md | 17 ++ .../roles/web_search/defaults/main.yml | 22 ++ .../roles/web_search/handlers/main.yml | 34 ++++ .../ansible/roles/web_search/tasks/main.yml | 188 ++++++++++++++++++ .../web_search/templates/searxng.container.j2 | 22 ++ .../web_search/templates/settings.yml.j2 | 11 + .../inventories/testing/group_vars/all.yml | 2 +- .../roles/gnmon_dashboard/defaults/main.yml | 2 +- .../Components/Pages/Home.razor | 1 + .../src/Ghostnet.Dashboard/wwwroot/app.css | 11 +- 13 files changed, 320 insertions(+), 4 deletions(-) create mode 100644 llm-server/llm/ansible/roles/web_search/README.md create mode 100644 llm-server/llm/ansible/roles/web_search/defaults/main.yml create mode 100644 llm-server/llm/ansible/roles/web_search/handlers/main.yml create mode 100644 llm-server/llm/ansible/roles/web_search/tasks/main.yml create mode 100644 llm-server/llm/ansible/roles/web_search/templates/searxng.container.j2 create mode 100644 llm-server/llm/ansible/roles/web_search/templates/settings.yml.j2 diff --git a/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md b/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md index f8bb6b2..4b1c520 100644 --- a/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md +++ b/docs/platform/llm-server/monitoring/GNMON-000-DOC_Index.md @@ -392,6 +392,14 @@ Realm `Ghost.net` (Vaultwarden-Realm, Issuer - **Kosmetik (09.11.2026, v0.3.3):** Favicon ist das Ghostnet-Geist-Maskottchen (`wwwroot/favicon.png` 32×32 + `apple-touch-icon.png` 180×180, aus dem Betreiber-Logo gerendert), via NPM als `image/png` 200 verifiziert. +- **GPU-Chart (11.11.2026, v0.3.4/6, Befund "nur zwei einzelne Linien"):** Der + `.braille-chart` war als Flex-Item in `.gpu-chart` (display:flex) mit + `overflow:hidden` auf min-width 0 kollabiert; der ResizeObserver maß die + kollabierte Breite, jede GPU-Kurve erschien als eine einzelne Spalte. Fix: + `.gpu-chart` ist jetzt `display:block` (+ `.braille-chart{max-width:100%}`). + Verifiziert per Headless-Chromium/CDP: Charts 249 px breit, 16 Zeilen × 21 + Zeichen, 15 Zeilen mit Kurvendaten; Verlauf zeigt die Inferenz-Spitzen beider + GPUs. Dataseite war unauffällig (121 Punkte/Karte in VM). ## Noch offen (Rest) diff --git a/llm-server/llm/ansible/playbooks/webui.yml b/llm-server/llm/ansible/playbooks/webui.yml index 11d081d..0211dcf 100644 --- a/llm-server/llm/ansible/playbooks/webui.yml +++ b/llm-server/llm/ansible/playbooks/webui.yml @@ -11,4 +11,5 @@ hosts: llm_servers become: true roles: + - role: web_search - role: open_webui 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 8f70dcb..0a393e4 100644 --- a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml +++ b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml @@ -69,4 +69,7 @@ open_webui_env: DEFAULT_USER_ROLE: user ENABLE_OAUTH_SIGNUP: "False" ENABLE_LOGIN_FORM: "True" - ENABLE_RAG_WEB_SEARCH: "False" + ENABLE_RAG_WEB_SEARCH: "True" + WEB_SEARCH_ENGINE: searxng + SEARXNG_QUERY_URL: http://searxng:8080/search?q= + WEB_SEARCH_RESULT_COUNT: "5" diff --git a/llm-server/llm/ansible/roles/web_search/README.md b/llm-server/llm/ansible/roles/web_search/README.md new file mode 100644 index 0000000..57f2928 --- /dev/null +++ b/llm-server/llm/ansible/roles/web_search/README.md @@ -0,0 +1,17 @@ +# web_search (SearXNG, self-hosted) + +SearXNG als interne Metasuche für OpenWebUI (kein externer API-Key). +Image digest-gepinnt (`2026.11.11-626105eec`), läuft als `gnai-production` +mit Netzwerk-Alias `searxng` im Egress-Netz `gnai-production-egress` +(kein Host-Port, kein Ingress von außen). Secret-Key als Podman-Secret +(`SEARXNG_SECRET` env), Settings ohne Secret auf der Platte. + +OpenWebUI-seitig (Rolle `open_webui`): `WEB_SEARCH_ENGINE=searxng`, +`SEARXNG_QUERY_URL=http://searxng:8080/search?q=`, +`ENABLE_RAG_WEB_SEARCH=True`, `WEB_SEARCH_RESULT_COUNT=5`. + +Verifiziert 11.11.2026: SearXNG antwortet im Netz (39 Ergebnisse für +Testquery), aus dem OpenWebUI-Container via Alias erreichbar. Offen: der +Chat-Request mit `features.web_search=true` hängt im Tool-Flow des Modells +(kein Generieren, llama idle) — NPM-Proxy-Timeout für chat.* muss sowieso +erhöht werden; Tool-Loop-Verhalten des Modells bei xhigh/128k prüfen. diff --git a/llm-server/llm/ansible/roles/web_search/defaults/main.yml b/llm-server/llm/ansible/roles/web_search/defaults/main.yml new file mode 100644 index 0000000..c8b2b81 --- /dev/null +++ b/llm-server/llm/ansible/roles/web_search/defaults/main.yml @@ -0,0 +1,22 @@ +--- +# Self-hosted SearXNG web search for OpenWebUI (GNAI-001 M6 extension). +# Runs in the egress network with alias `searxng`, no host port, no external +# API key. Image pinned by digest (2026.11.11-626105eec, resolved 2026-11-11). +web_search_image: docker.io/searxng/searxng +web_search_image_ref: docker.io/searxng/searxng@sha256:606fc8852a53f0be4ac05116950ff480f6f56b8ef7d77b366868cc76478036e5 +web_search_image_tag: "2026.11.11-626105eec" + +# Same workload account / egress network as OpenWebUI (Production env). +web_search_user: gnai-production +web_search_uid: 980 +web_search_home: /var/lib/ghostnet-ai/production +web_search_quadlet_dir: /etc/containers/systemd/users/980 +web_search_unit_prefix: gnai-production-searxng +web_search_network_name: gnai-production-egress +web_search_network_alias: searxng +web_search_container_port: 8080 + +# SearXNG config lives on the host (0600, root) — the secret key never enters +# git; it is generated as a Podman secret on first run. +web_search_config_dir: /etc/searxng-ghostnet +web_search_secret_key_secret: searxng-secret-key diff --git a/llm-server/llm/ansible/roles/web_search/handlers/main.yml b/llm-server/llm/ansible/roles/web_search/handlers/main.yml new file mode 100644 index 0000000..0d996b4 --- /dev/null +++ b/llm-server/llm/ansible/roles/web_search/handlers/main.yml @@ -0,0 +1,34 @@ +--- +- name: Reload workload user manager + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/systemctl + - --user + - daemon-reload + chdir: "{{ web_search_home }}" + changed_when: false + when: not ansible_check_mode + +- name: Restart SearXNG unit + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/systemctl + - --user + - restart + - "{{ web_search_unit_prefix }}.service" + chdir: "{{ web_search_home }}" + when: not ansible_check_mode diff --git a/llm-server/llm/ansible/roles/web_search/tasks/main.yml b/llm-server/llm/ansible/roles/web_search/tasks/main.yml new file mode 100644 index 0000000..3269512 --- /dev/null +++ b/llm-server/llm/ansible/roles/web_search/tasks/main.yml @@ -0,0 +1,188 @@ +--- +- name: Verify web_search role declarations + ansible.builtin.assert: + that: + - web_search_image_ref is match('^docker.io/searxng/searxng@sha256:[0-9a-f]{64}$') + - web_search_network_name == 'gnai-production-egress' + fail_msg: "web_search must use the pinned digest and the egress network" + +- name: Check whether the SearXNG image is in the workload store + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/podman + - image + - exists + - "{{ web_search_image_ref }}" + chdir: "{{ web_search_home }}" + changed_when: false + failed_when: web_search_image_present.rc not in [0, 1] + check_mode: false + register: web_search_image_present + +- name: Pull the pinned SearXNG image into the workload store + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/podman + - pull + - "{{ web_search_image_ref }}" + chdir: "{{ web_search_home }}" + when: + - not ansible_check_mode + - web_search_image_present.rc != 0 + +- name: Check whether the SearXNG secret key already exists + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/podman + - secret + - exists + - "{{ web_search_secret_key_secret }}" + chdir: "{{ web_search_home }}" + changed_when: false + failed_when: web_search_secret_exists.rc not in [0, 1] + check_mode: false + register: web_search_secret_exists + +- name: Create the SearXNG secret key (random, via stdin, never on disk in git) + ansible.builtin.shell: | + set -euo pipefail + head -c 32 /dev/urandom | base64 \ + | /usr/sbin/runuser --user {{ web_search_user }} -- /usr/bin/env \ + HOME={{ web_search_home }} XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }} \ + /usr/bin/podman secret create {{ web_search_secret_key_secret }} - + args: + executable: /bin/bash + chdir: "{{ web_search_home }}" + when: web_search_secret_exists.rc == 1 + no_log: true + +- name: Ensure the SearXNG config directory exists + ansible.builtin.file: + path: "{{ web_search_config_dir }}" + state: directory + owner: root + group: root + mode: "0755" # traversable for the rootless container (no secret in settings.yml anymore) + +- name: Render the SearXNG settings (secret stays host-local, 0600) + ansible.builtin.template: + src: settings.yml.j2 + dest: "{{ web_search_config_dir }}/settings.yml" + owner: root + group: root + mode: "0644" + notify: + - Reload workload user manager + - Restart SearXNG unit + +- name: Render the SearXNG quadlet + ansible.builtin.template: + src: searxng.container.j2 + dest: "{{ web_search_quadlet_dir }}/{{ web_search_unit_prefix }}.container" + owner: root + group: "{{ web_search_user }}" + mode: "0640" + notify: + - Reload workload user manager + - Restart SearXNG unit + +- name: Ensure the workload user manager knows the rendered units + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/systemctl + - --user + - daemon-reload + chdir: "{{ web_search_home }}" + changed_when: false + when: not ansible_check_mode + +- name: Read the current state of the SearXNG unit + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/systemctl + - --user + - is-active + - "{{ web_search_unit_prefix }}.service" + chdir: "{{ web_search_home }}" + changed_when: false + failed_when: web_search_unit_state.rc not in [0, 3] + check_mode: false + register: web_search_unit_state + +- name: Start the SearXNG unit + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/systemctl + - --user + - start + - "{{ web_search_unit_prefix }}.service" + chdir: "{{ web_search_home }}" + when: + - not ansible_check_mode + - web_search_unit_state.rc != 0 + +- name: Wait for SearXNG to answer inside the egress network + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ web_search_user }}" + - -- + - /usr/bin/env + - "HOME={{ web_search_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ web_search_uid }}" + - /usr/bin/podman + - exec + - "{{ web_search_unit_prefix }}" + - /usr/bin/python3 + - -c + - "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/search?q=test&format=json', timeout=10)" + chdir: "{{ web_search_home }}" + register: web_search_probe + retries: 20 + delay: 5 + until: web_search_probe.rc == 0 + changed_when: false + when: not ansible_check_mode diff --git a/llm-server/llm/ansible/roles/web_search/templates/searxng.container.j2 b/llm-server/llm/ansible/roles/web_search/templates/searxng.container.j2 new file mode 100644 index 0000000..a9ff6a7 --- /dev/null +++ b/llm-server/llm/ansible/roles/web_search/templates/searxng.container.j2 @@ -0,0 +1,22 @@ +[Unit] +Description=SearXNG metasearch for OpenWebUI ({{ web_search_image_tag }}) +Wants={{ web_search_network_name }}-network.service +After={{ web_search_network_name }}-network.service + +[Container] +Image={{ web_search_image_ref }} +Pull=never +ContainerName={{ web_search_unit_prefix }} +Network={{ web_search_network_name }} +NetworkAlias={{ web_search_network_alias }} +Volume={{ web_search_config_dir }}/settings.yml:/etc/searxng/settings.yml:ro +Secret={{ web_search_secret_key_secret }},type=env,target=SEARXNG_SECRET +# No PublishPort: reachable only inside the egress network as `searxng`. + +[Service] +Restart=on-failure +RestartSec=10 +TimeoutStartSec=300 + +[Install] +WantedBy=default.target diff --git a/llm-server/llm/ansible/roles/web_search/templates/settings.yml.j2 b/llm-server/llm/ansible/roles/web_search/templates/settings.yml.j2 new file mode 100644 index 0000000..ed51273 --- /dev/null +++ b/llm-server/llm/ansible/roles/web_search/templates/settings.yml.j2 @@ -0,0 +1,11 @@ +use_default_settings: true +server: + # secret_key comes from env SEARXNG_SECRET (Podman secret), never on disk + limiter: false + image_proxy: false + bind_address: 0.0.0.0 + port: {{ web_search_container_port }} +search: + formats: + - html + - json diff --git a/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml b/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml index b4b75fd..d3e18e9 100644 --- a/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml +++ b/llm-server/monitoring/ansible/inventories/testing/group_vars/all.yml @@ -86,4 +86,4 @@ gnmon_dashboard_http_listen: "10.0.0.90:8080" # Transportiertes Image (Workstation-Build, podman save/load am 09.11.2026). # v0.2.1: konfigurierbare Auth:AllowedRoles; v0.2.2 (ID 518f88349c6c): ClientId # an den Keycloak-Client "gnai-dashboard" angepasst. Build aus images/dashboard/Containerfile. -gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.3.3 +gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.3.6 diff --git a/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml b/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml index 2f6fe80..a15806c 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml +++ b/llm-server/monitoring/ansible/roles/gnmon_dashboard/defaults/main.yml @@ -18,7 +18,7 @@ gnmon_dashboard_quadlet_dir: >- # adds the configuration-driven OIDC layer with configurable Auth:AllowedRoles # (M6, GNMON-000). The image is transported (podman save/load), so the # inventory pins the tag ref either way. -gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.3.3 +gnmon_dashboard_image_ref: docker.io/ghostnet/dashboard:v0.3.6 # Host loopback only (GNMON-001 section 7); NPM ingress follows in M6. gnmon_dashboard_http_listen: "127.0.0.1:8080" diff --git a/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/Home.razor b/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/Home.razor index cd43373..2450b72 100644 --- a/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/Home.razor +++ b/llm-server/monitoring/src/Ghostnet.Dashboard/Components/Pages/Home.razor @@ -299,6 +299,7 @@ else if (!_loaded) .OrderBy(p => p.Timestamp) .Select(p => p.Value)]; } + } private static double? Lookup(IReadOnlyList series, string card) diff --git a/llm-server/monitoring/src/Ghostnet.Dashboard/wwwroot/app.css b/llm-server/monitoring/src/Ghostnet.Dashboard/wwwroot/app.css index 5856fb4..d3b90a6 100644 --- a/llm-server/monitoring/src/Ghostnet.Dashboard/wwwroot/app.css +++ b/llm-server/monitoring/src/Ghostnet.Dashboard/wwwroot/app.css @@ -342,12 +342,21 @@ a { flex: 1 1 auto; min-width: 0; overflow: hidden; - display: flex; + /* Block, not flex: a flex-item .braille-chart shrinks to min-width 0 + (overflow:hidden disables the automatic minimum), the ResizeObserver + then measures the collapsed width and every GPU curve renders as a + single visible column (Befund 11.11.2026). Block makes the chart + fill the remaining panel width. */ + display: block; padding-left: 0.9rem; margin-top: -0.9rem; margin-bottom: -0.9rem; } +.braille-chart { + max-width: 100%; +} + /* ---- ascii spinners ---- */ .ascii-spin { display: inline-block;