From 6b42a460f4ebebb7922806c15598b905cc9c2f80 Mon Sep 17 00:00:00 2001 From: spektr Date: Wed, 18 Nov 2026 14:26:29 +0100 Subject: [PATCH] M8-T4 umgesetzt: GPT Researcher auf ghostnet-ki (backend :8086, frontend :8085) hinter IAP - Rolle gpt_researcher + playbooks/research.yml; Images digest-gepinnt (gptresearcher/gpt-researcher sha256:8e0975ec.., gptr-nextjs sha256:69e7e2fa..) - LLM via OPENAI_BASE_URL=http://llama-cpp:8080/v1, FAST/SMART/STRATEGIC_LLM=Production-Alias, Retriever duckduckgo, LLM_TIMEOUT=600; User=root (upstream compose), Volumes unter gptr/ - NPM-vHost: location / -> 8085, /api -> 8086 (600s), beide auth_request; firewall 8085+8086 nur NPM - Verifiziert: research.yml idempotent changed=0, backend /docs 200, frontend 200, research/ + research/api/docs unauth -> 302 Keycloak, 8086 WAN geblockt Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- .../ai/GNAI-023-PLAN_GPT-Researcher-IAP.md | 16 +- llm-server/llm/ansible/playbooks/research.yml | 13 ++ .../ansible/roles/gpt_researcher/README.md | 28 +++ .../roles/gpt_researcher/defaults/main.yml | 58 +++++ .../roles/gpt_researcher/handlers/main.yml | 37 ++++ .../roles/gpt_researcher/tasks/main.yml | 201 ++++++++++++++++++ .../templates/gptr-backend.container.j2 | 29 +++ .../templates/gptr-frontend.container.j2 | 26 +++ .../roles/gnmon_firewall/defaults/main.yml | 1 + .../defaults/main.yml | 1 + .../files/npm_research_vhost.py | 10 +- .../templates/spec.json.j2 | 1 + 12 files changed, 419 insertions(+), 2 deletions(-) create mode 100644 llm-server/llm/ansible/playbooks/research.yml create mode 100644 llm-server/llm/ansible/roles/gpt_researcher/README.md create mode 100644 llm-server/llm/ansible/roles/gpt_researcher/defaults/main.yml create mode 100644 llm-server/llm/ansible/roles/gpt_researcher/handlers/main.yml create mode 100644 llm-server/llm/ansible/roles/gpt_researcher/tasks/main.yml create mode 100644 llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-backend.container.j2 create mode 100644 llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-frontend.container.j2 diff --git a/docs/platform/llm-server/ai/GNAI-023-PLAN_GPT-Researcher-IAP.md b/docs/platform/llm-server/ai/GNAI-023-PLAN_GPT-Researcher-IAP.md index 3aef05e..b68cb72 100644 --- a/docs/platform/llm-server/ai/GNAI-023-PLAN_GPT-Researcher-IAP.md +++ b/docs/platform/llm-server/ai/GNAI-023-PLAN_GPT-Researcher-IAP.md @@ -120,7 +120,7 @@ Internet → NPM (CT 103, 443) → auth_request-Subrequest an oauth2-proxy 10. E2E: Research-Auftrag in GPT Researcher läuft gegen llama.cpp + SearXNG, Report mit Quellen; NPM-Timeouts für lange Läufe gesetzt. -## 5. Arbeitspakete (Stand 18.11.2026: M8-T1, T2, T3 umgesetzt und verifiziert) +## 5. Arbeitspakete (Stand 18.11.2026: M8-T1..T4 umgesetzt und verifiziert; M8-T5 Haertung/Abnahme offen) | # | Paket | Ziel | Wo | | --- | --- | --- | --- | @@ -175,3 +175,17 @@ Internet → NPM (CT 103, 443) → auth_request-Subrequest an oauth2-proxy https://research.ghostnet.selfhost.eu/` → 302 zu Keycloak (`client_id=gnai-research`, scope openid+email+profile+groups). NPM-Admin-Creds als `/etc/nginx-proxy-manager/api.env` (0600). + +- **M8-T4 (GPT Researcher auf ghostnet-ki, 18.11.):** Rolle `gpt_researcher`, + Playbook `research.yml`. Images `gptresearcher/gpt-researcher` + + `gptresearcher/gptr-nextjs` (nur `latest` publiziert) digest-gepinnt: + backend `sha256:8e0975ec…`, frontend `sha256:69e7e2fa…`. Backend + `10.0.0.90:8086` (FastAPI), Frontend `10.0.0.90:8085` (NextJS), beide nur + von NPM (Firewall `gnmon_firewall_npm_only_ports` += 8085, 8086). LLM via + `OPENAI_BASE_URL=http://llama-cpp:8080/v1`, FAST/SMART/STRATEGIC_LLM = + Production-Alias; Retriever duckduckgo (keyless). Befunde: `User=root` + nötig (sonst PermissionError logs/app.log), Verify ohne curl (python3), + Unit-Start mit is-active-Check (idempotent `changed=0`). NPM-vHost: Location + `/` → 8085, `/api` → 8086 (600 s Timeouts), beide mit auth_request. + E2E: `research/` und `research/api/docs` unauth → 302 Keycloak; Backend + `/docs` 200 via NPM; 8086 von außen geblockt. diff --git a/llm-server/llm/ansible/playbooks/research.yml b/llm-server/llm/ansible/playbooks/research.yml new file mode 100644 index 0000000..a1d36c0 --- /dev/null +++ b/llm-server/llm/ansible/playbooks/research.yml @@ -0,0 +1,13 @@ +--- +# Deploys the GPT Researcher harness (backend + frontend) for the Production +# environment only (GNAI-023 M8-T4). Requires the Production engine network +# (run ai.yml first). Never changes engine state. +# +# Usage: +# ansible-playbook -i inventories/production playbooks/research.yml --check --diff +# ansible-playbook -i inventories/production playbooks/research.yml +- name: Deploy the GPT Researcher harness for the Production environment + hosts: llm_servers + become: true + roles: + - role: gpt_researcher diff --git a/llm-server/llm/ansible/roles/gpt_researcher/README.md b/llm-server/llm/ansible/roles/gpt_researcher/README.md new file mode 100644 index 0000000..4c2c60e --- /dev/null +++ b/llm-server/llm/ansible/roles/gpt_researcher/README.md @@ -0,0 +1,28 @@ +# gpt_researcher + +GPT Researcher (assafelovic/gpt-researcher, GNAI-023 M8-T4) als zweiter +Research-Harness auf `ghostnet-ki` im Production-Netz. Deploy via +`playbooks/research.yml` gegen `inventories/production`. + +- Zwei Quadlets als `gnai-production`: Backend (FastAPI :8000, Image + `gptresearcher/gpt-researcher` digest-gepinnt) und Frontend (NextJS :3000, + `gptresearcher/gptr-nextjs` digest-gepinnt). Beide in + `gnai-production-llama` + `gnai-production-egress`. +- Publish LAN-only: Frontend `10.0.0.90:8085`, Backend `10.0.0.90:8086`; + `gnmon_firewall_npm_only_ports` beschränkt beide auf NPM (10.0.0.10). +- LLM: Engine via `http://llama-cpp:8080/v1` (Alias), `OPENAI_API_KEY` als + Podman-Secret (Placeholder; llama.cpp ohne Auth). `FAST_LLM`/`SMART_LLM`/ + `STRATEGIC_LLM` = Production-Profil-Alias. `LLM_TIMEOUT=600`. +- Retriever: `SEARCH_ENGINE`/`RETRIEVER=duckduckgo` (keyless, Egress-Netz). + SearXNG als Custom-Retriever wäre eine Erweiterung (GNAI-023). +- `User=root` im Container nötig (upstream compose läuft als root; rootless + mappt auf gnai-production — sonst PermissionError auf logs/app.log). +- Ingress: NPM-vHost `research.ghostnet.selfhost.eu` (Rolle + `reverse_proxy_research_vhost` auf CT 103): Location `/` → 8085, Location + `/api` → 8086 (mit 600 s Timeouts), beide hinter oauth2-proxy + (`auth_request`, Keycloak-Client `gnai-research`). +- Daten: `/var/lib/ghostnet-ai/production/gptr/{my-docs,outputs,logs}`. + +Verifiziert 18.11.: `research.yml` idempotent (`changed=0`), Backend +`/docs` 200 und Frontend `/` 200 via NPM-Host, `research/` und +`research/api/docs` unauth → 302 zu Keycloak, Port 8086 von außen geblockt. diff --git a/llm-server/llm/ansible/roles/gpt_researcher/defaults/main.yml b/llm-server/llm/ansible/roles/gpt_researcher/defaults/main.yml new file mode 100644 index 0000000..3519b28 --- /dev/null +++ b/llm-server/llm/ansible/roles/gpt_researcher/defaults/main.yml @@ -0,0 +1,58 @@ +--- +# GPT Researcher (assafelovic/gpt-researcher, GNAI-023 M8-T4) as the second +# research harness on ghostnet-ki in the Production environment. +# Backend (FastAPI, :8000) + NextJS frontend (:3000), both in the Production +# engine network (llama.cpp via alias) and the egress network. +# Published on LAN only: frontend 10.0.0.90:8085, backend 10.0.0.90:8086 — +# host firewall restricts both to NPM (CT-103, gnmon_firewall_npm_only_ports). +# +# Images pulled from docker.io/gptresearcher/*:latest on 2026-11-18 and +# pinned by digest (upstream publishes no version tags). +gpt_researcher_backend_image: docker.io/gptresearcher/gpt-researcher +gpt_researcher_backend_image_ref: "{{ gpt_researcher_backend_image }}@sha256:8e0975ec9aaddc49c17c59568a25618c8a5f75b7a5f1fab35bc90e6c6dc950c7" +gpt_researcher_frontend_image: docker.io/gptresearcher/gptr-nextjs +gpt_researcher_frontend_image_ref: "{{ gpt_researcher_frontend_image }}@sha256:69e7e2fa02d23666e7c00774faed154af1684ac06dc97d2c29c8b6e77f98710a" + +gpt_researcher_user: gnai-production +gpt_researcher_uid: 980 +gpt_researcher_home: /var/lib/ghostnet-ai/production +gpt_researcher_quadlet_dir: /etc/containers/systemd/users/980 +gpt_researcher_unit_prefix: gnai-production-gptr +gpt_researcher_network_name: gnai-production-llama +gpt_researcher_egress_network_name: gnai-production-egress + +gpt_researcher_frontend_host_addr: 10.0.0.90 +gpt_researcher_frontend_host_port: 8085 +gpt_researcher_frontend_container_port: 3000 +gpt_researcher_backend_host_addr: 10.0.0.90 +gpt_researcher_backend_host_port: 8086 +gpt_researcher_backend_container_port: 8000 + +gpt_researcher_data_dir: /var/lib/ghostnet-ai/production/gptr + +# Engine via the Production network alias (llama.cpp has no auth; placeholder +# key via Podman secret, never in git). +gpt_researcher_engine_base_url: http://llama-cpp:8080/v1 +gpt_researcher_engine_model_id: swift-1.5-qwen3.8-27b-q6k +gpt_researcher_engine_api_key_secret: gptr-engine-api-key + +# LLM + retriever config (gpt-researcher v3.8 env). Both SEARCH_ENGINE and +# RETRIEVER are set defensively; duckduckgo is keyless. Token limits stay at +# upstream defaults (FAST=3000/SMART=6000) — fine for a 27B local model. +gpt_researcher_env: + OPENAI_BASE_URL: "{{ gpt_researcher_engine_base_url }}" + FAST_LLM: "{{ gpt_researcher_engine_model_id }}" + SMART_LLM: "{{ gpt_researcher_engine_model_id }}" + STRATEGIC_LLM: "{{ gpt_researcher_engine_model_id }}" + SEARCH_ENGINE: duckduckgo + RETRIEVER: duckduckgo + LLM_TIMEOUT: "600" + LOGGING_LEVEL: INFO + DOC_PATH: /usr/src/app/my-docs + +gpt_researcher_frontend_env: + # relative API base: the browser calls same-origin /api/... which the NPM + # vHost routes to the backend (10.0.0.90:8086) + NEXT_PUBLIC_GPTR_API_URL: "" + CHOKIDAR_USEPOLLING: "true" + LOGGING_LEVEL: INFO diff --git a/llm-server/llm/ansible/roles/gpt_researcher/handlers/main.yml b/llm-server/llm/ansible/roles/gpt_researcher/handlers/main.yml new file mode 100644 index 0000000..4f4bf9a --- /dev/null +++ b/llm-server/llm/ansible/roles/gpt_researcher/handlers/main.yml @@ -0,0 +1,37 @@ +--- +- name: Reload workload user manager + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/systemctl + - --user + - daemon-reload + chdir: "{{ gpt_researcher_home }}" + changed_when: false + when: not ansible_check_mode + +- name: Restart gptr units + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/systemctl + - --user + - restart + - "{{ gpt_researcher_unit_prefix }}-{{ item }}.service" + chdir: "{{ gpt_researcher_home }}" + loop: + - backend + - frontend + when: not ansible_check_mode diff --git a/llm-server/llm/ansible/roles/gpt_researcher/tasks/main.yml b/llm-server/llm/ansible/roles/gpt_researcher/tasks/main.yml new file mode 100644 index 0000000..8ee840a --- /dev/null +++ b/llm-server/llm/ansible/roles/gpt_researcher/tasks/main.yml @@ -0,0 +1,201 @@ +--- +- name: Verify gpt_researcher role declarations + ansible.builtin.assert: + that: + - gpt_researcher_backend_image_ref is match('^docker\.io/gptresearcher/gpt-researcher@sha256:[0-9a-f]{64}$') + - gpt_researcher_frontend_image_ref is match('^docker\.io/gptresearcher/gptr-nextjs@sha256:[0-9a-f]{64}$') + - gpt_researcher_network_name == 'gnai-production-llama' + fail_msg: "gpt_researcher must use digest-pinned images and the Production network" + +- name: Ensure the gptr data directories exist + ansible.builtin.file: + path: "{{ gpt_researcher_data_dir }}/{{ item }}" + state: directory + owner: "{{ gpt_researcher_user }}" + group: "{{ gpt_researcher_user }}" + mode: "0750" + loop: + - my-docs + - outputs + - logs + +- name: Check whether the engine API key secret exists + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/podman + - secret + - exists + - "{{ gpt_researcher_engine_api_key_secret }}" + chdir: "{{ gpt_researcher_home }}" + register: gptr_engine_secret_exists + changed_when: false + failed_when: gptr_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 {{ gpt_researcher_user }} -- /usr/bin/env \ + HOME={{ gpt_researcher_home }} XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }} \ + /usr/bin/podman secret create {{ gpt_researcher_engine_api_key_secret }} - + args: + executable: /bin/bash + chdir: "{{ gpt_researcher_home }}" + when: gptr_engine_secret_exists.rc == 1 + no_log: true + +- name: Check whether the pinned images are in the workload store + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/podman + - image + - exists + - "{{ item }}" + chdir: "{{ gpt_researcher_home }}" + loop: + - "{{ gpt_researcher_backend_image_ref }}" + - "{{ gpt_researcher_frontend_image_ref }}" + register: gptr_images_present + changed_when: false + failed_when: false + check_mode: false + +- name: Pull the pinned images into the workload store + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/podman + - pull + - "{{ item.item }}" + chdir: "{{ gpt_researcher_home }}" + loop: "{{ gptr_images_present.results }}" + when: + - not ansible_check_mode + - item.rc != 0 + +- name: Render the gptr quadlets + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ gpt_researcher_quadlet_dir }}/{{ gpt_researcher_unit_prefix }}-{{ item.name }}.container" + owner: root + group: "{{ gpt_researcher_user }}" + mode: "0640" + loop: + - { src: gptr-backend.container.j2, name: backend } + - { src: gptr-frontend.container.j2, name: frontend } + notify: + - Reload workload user manager + - Restart gptr units + +- name: Ensure the workload user manager knows the rendered units + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/systemctl + - --user + - daemon-reload + chdir: "{{ gpt_researcher_home }}" + changed_when: false + when: not ansible_check_mode + +- name: Read the current state of the gptr units + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/systemctl + - --user + - is-active + - "{{ gpt_researcher_unit_prefix }}-{{ item }}.service" + chdir: "{{ gpt_researcher_home }}" + loop: + - backend + - frontend + register: gptr_unit_states + changed_when: false + failed_when: false + check_mode: false + +- name: Start the gptr units + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/systemctl + - --user + - start + - "{{ gpt_researcher_unit_prefix }}-{{ item.item }}.service" + chdir: "{{ gpt_researcher_home }}" + loop: "{{ gptr_unit_states.results }}" + when: + - not ansible_check_mode + - item.rc != 0 + +- name: Wait for the backend and frontend health endpoints + ansible.builtin.uri: + url: "http://{{ item.addr }}:{{ item.port }}{{ item.path }}" + status_code: [200, 404] + timeout: 10 + loop: + - { addr: "{{ gpt_researcher_backend_host_addr }}", port: "{{ gpt_researcher_backend_host_port }}", path: /docs } + - { addr: "{{ gpt_researcher_frontend_host_addr }}", port: "{{ gpt_researcher_frontend_host_port }}", path: / } + retries: 30 + delay: 5 + when: not ansible_check_mode + +- name: Verify the engine is reachable from the backend container + ansible.builtin.command: + argv: + - /usr/sbin/runuser + - --user + - "{{ gpt_researcher_user }}" + - -- + - /usr/bin/env + - "HOME={{ gpt_researcher_home }}" + - "XDG_RUNTIME_DIR=/run/user/{{ gpt_researcher_uid }}" + - /usr/bin/podman + - exec + - "{{ gpt_researcher_unit_prefix }}-backend" + - /bin/sh + - -c + - "python3 -c \"import urllib.request,sys; sys.exit(0 if b'swift' in urllib.request.urlopen('{{ gpt_researcher_engine_base_url }}/models', timeout=10).read() else 1)\"" + chdir: "{{ gpt_researcher_home }}" + changed_when: false + when: not ansible_check_mode diff --git a/llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-backend.container.j2 b/llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-backend.container.j2 new file mode 100644 index 0000000..dfd80c6 --- /dev/null +++ b/llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-backend.container.j2 @@ -0,0 +1,29 @@ +[Unit] +Description=GPT Researcher backend (FastAPI :8000, GNAI-023 M8) +Wants={{ gpt_researcher_network_name }}-network.service {{ gpt_researcher_egress_network_name }}-network.service +After={{ gpt_researcher_network_name }}-network.service {{ gpt_researcher_egress_network_name }}-network.service + +[Container] +Image={{ gpt_researcher_backend_image_ref }} +Pull=never +# upstream compose runs as root; rootless maps container root to gnai-production +User=root +ContainerName={{ gpt_researcher_unit_prefix }}-backend +Network={{ gpt_researcher_network_name }} +Network={{ gpt_researcher_egress_network_name }} +PublishPort={{ gpt_researcher_backend_host_addr }}:{{ gpt_researcher_backend_host_port }}:{{ gpt_researcher_backend_container_port }} +Secret={{ gpt_researcher_engine_api_key_secret }},type=env,target=OPENAI_API_KEY +Volume={{ gpt_researcher_data_dir }}/my-docs:/usr/src/app/my-docs:rw +Volume={{ gpt_researcher_data_dir }}/outputs:/usr/src/app/outputs:rw +Volume={{ gpt_researcher_data_dir }}/logs:/usr/src/app/logs:rw +{% for key, value in gpt_researcher_env.items() %} +Environment="{{ key }}={{ value }}" +{% endfor %} + +[Service] +Restart=on-failure +RestartSec=10 +TimeoutStartSec=600 + +[Install] +WantedBy=default.target diff --git a/llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-frontend.container.j2 b/llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-frontend.container.j2 new file mode 100644 index 0000000..2535cf2 --- /dev/null +++ b/llm-server/llm/ansible/roles/gpt_researcher/templates/gptr-frontend.container.j2 @@ -0,0 +1,26 @@ +[Unit] +Description=GPT Researcher frontend (NextJS :3000, GNAI-023 M8) +Wants={{ gpt_researcher_network_name }}-network.service {{ gpt_researcher_egress_network_name }}-network.service +After={{ gpt_researcher_network_name }}-network.service {{ gpt_researcher_egress_network_name }}-network.service + +[Container] +Image={{ gpt_researcher_frontend_image_ref }} +Pull=never +# upstream compose runs as root; rootless maps container root to gnai-production +User=root +ContainerName={{ gpt_researcher_unit_prefix }}-frontend +Network={{ gpt_researcher_network_name }} +Network={{ gpt_researcher_egress_network_name }} +PublishPort={{ gpt_researcher_frontend_host_addr }}:{{ gpt_researcher_frontend_host_port }}:{{ gpt_researcher_frontend_container_port }} +Volume={{ gpt_researcher_data_dir }}/outputs:/app/outputs:ro +{% for key, value in gpt_researcher_frontend_env.items() %} +Environment="{{ key }}={{ value }}" +{% endfor %} + +[Service] +Restart=on-failure +RestartSec=10 +TimeoutStartSec=300 + +[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 eb2324c..cd89997 100644 --- a/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml +++ b/llm-server/monitoring/ansible/roles/gnmon_firewall/defaults/main.yml @@ -26,6 +26,7 @@ gnmon_firewall_npm_only_ports: - 8081 # GNAI-023 M8: GPT Researcher behind NPM + oauth2-proxy (IAP) - 8085 + - 8086 # 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). diff --git a/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/defaults/main.yml b/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/defaults/main.yml index e7c1d6f..b7c1951 100644 --- a/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/defaults/main.yml +++ b/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/defaults/main.yml @@ -13,6 +13,7 @@ reverse_proxy_research_api_env_file: /etc/nginx-proxy-manager/api.env reverse_proxy_research_domain: research.ghostnet.selfhost.eu reverse_proxy_research_upstream_host: 10.0.0.90 reverse_proxy_research_upstream_port: 8085 +reverse_proxy_research_api_port: 8086 reverse_proxy_research_upstream_scheme: http reverse_proxy_research_letsencrypt_email: ma-koenig@gmx.net # oauth2-proxy on this host, loopback only (role reverse_proxy_oauth2proxy) diff --git a/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/files/npm_research_vhost.py b/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/files/npm_research_vhost.py index c13fa04..1a65b0c 100644 --- a/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/files/npm_research_vhost.py +++ b/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/files/npm_research_vhost.py @@ -98,7 +98,15 @@ host_body = { "forward_host": spec["upstream_host"], "forward_port": spec["upstream_port"], "advanced_config": spec["root_location_advanced_config"], - } + }, + { + # backend API (gptr backend :8000 published as 8086), same IAP auth + "path": "/api", + "forward_scheme": spec["upstream_scheme"], + "forward_host": spec["upstream_host"], + "forward_port": spec["api_port"], + "advanced_config": spec["root_location_advanced_config"] + "\nproxy_read_timeout 600s;\nproxy_send_timeout 600s;\n", + }, ], } diff --git a/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/templates/spec.json.j2 b/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/templates/spec.json.j2 index 1ad4158..a153a51 100644 --- a/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/templates/spec.json.j2 +++ b/proxmox/lxc/ct-103-reverse-proxy/ansible/roles/reverse_proxy_research_vhost/templates/spec.json.j2 @@ -3,6 +3,7 @@ "upstream_scheme": {{ reverse_proxy_research_upstream_scheme | to_json }}, "upstream_host": {{ reverse_proxy_research_upstream_host | to_json }}, "upstream_port": {{ reverse_proxy_research_upstream_port | int }}, + "api_port": {{ reverse_proxy_research_api_port | int }}, "letsencrypt_email": {{ reverse_proxy_research_letsencrypt_email | to_json }}, "advanced_config": {{ reverse_proxy_research_advanced_config | to_json }}, "root_location_advanced_config": {{ reverse_proxy_research_root_location_advanced_config | to_json }}