M6: OpenWebUI intern produktiv (Rolle open_webui, v0.13.3 digest-gepinnt) + Produktentscheidung API+WebUI, LiteLLM faellt fuer M6 weg
ci-static / secret-scan (push) Successful in 20s
ci-static / yamllint (push) Successful in 29s
ci-static / ansible-syntax (push) Successful in 27s
ci-static / markdown-links (push) Successful in 20s
ci-static / secret-scan (pull_request) Successful in 21s
ci-static / yamllint (pull_request) Successful in 31s
ci-static / ansible-syntax (pull_request) Successful in 29s
ci-static / markdown-links (pull_request) Successful in 20s
ci-static / secret-scan (push) Successful in 20s
ci-static / yamllint (push) Successful in 29s
ci-static / ansible-syntax (push) Successful in 27s
ci-static / markdown-links (push) Successful in 20s
ci-static / secret-scan (pull_request) Successful in 21s
ci-static / yamllint (pull_request) Successful in 31s
ci-static / ansible-syntax (pull_request) Successful in 29s
ci-static / markdown-links (pull_request) Successful in 20s
- 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 <vibe@mistral.ai>
This commit is contained in:
@@ -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
|
||||
@@ -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.
|
||||
@@ -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"
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user