From 6da280f91d662dc98531c55ed3bc828fbc5548c5 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 28 Oct 2026 14:53:31 +0100 Subject: [PATCH] docs/deploy: Portal-Betrieb 131/204, Unit-Vorlage, nginx-Proxy fuer 204 Co-Authored-By: Claude Sonnet 5.5 --- deploy/nginx/204-portal-live-api-proxy.conf | 46 +++++++++++++++++++ .../systemd/nexarch-web-portal.service.tmpl | 16 +++++++ docs/ARBEITSKARTEN.md | 7 +++ docs/BETRIEB-PORTAL.md | 15 ++++++ 4 files changed, 84 insertions(+) create mode 100644 deploy/nginx/204-portal-live-api-proxy.conf create mode 100644 deploy/systemd/nexarch-web-portal.service.tmpl create mode 100644 docs/BETRIEB-PORTAL.md diff --git a/deploy/nginx/204-portal-live-api-proxy.conf b/deploy/nginx/204-portal-live-api-proxy.conf new file mode 100644 index 00000000..18b4b261 --- /dev/null +++ b/deploy/nginx/204-portal-live-api-proxy.conf @@ -0,0 +1,46 @@ +# 204 (Dev/Test), Ergaenzung zu /etc/nginx/sites-available/nexarch-portal-live. +# Macht connect-api und rbac-admin-api fuer Browser erreichbar, weil +# NEXT_PUBLIC_* beim Build ins Bundle geht und 127.0.0.1 dort den Rechner des Benutzers meint. +map $http_origin $np_cors_origin { + default ""; + "~^http://192\.168\.1\.204:31[0-9][0-9]$" $http_origin; + "~^https://192\.168\.1\.204(:[0-9]+)?$" $http_origin; +} + +server { + listen 8447 ssl; + http2 on; + server_name 192.168.1.204; + ssl_certificate /etc/ssl/nexarch-portal-live/cert.pem; + ssl_certificate_key /etc/ssl/nexarch-portal-live/key.pem; + location / { + if ($request_method = OPTIONS) { return 204; } + proxy_pass http://127.0.0.1:18105; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_hide_header Access-Control-Allow-Origin; + add_header Access-Control-Allow-Origin $np_cors_origin always; + add_header Access-Control-Allow-Credentials true always; + add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" always; + add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Tenant-Slug" always; + } +} + +server { + listen 8448 ssl; + http2 on; + server_name 192.168.1.204; + ssl_certificate /etc/ssl/nexarch-portal-live/cert.pem; + ssl_certificate_key /etc/ssl/nexarch-portal-live/key.pem; + location / { + if ($request_method = OPTIONS) { return 204; } + proxy_pass http://127.0.0.1:8212; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_hide_header Access-Control-Allow-Origin; + add_header Access-Control-Allow-Origin $np_cors_origin always; + add_header Access-Control-Allow-Credentials true always; + add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" always; + add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Tenant-Slug" always; + } +} diff --git a/deploy/systemd/nexarch-web-portal.service.tmpl b/deploy/systemd/nexarch-web-portal.service.tmpl new file mode 100644 index 00000000..feb8c9a5 --- /dev/null +++ b/deploy/systemd/nexarch-web-portal.service.tmpl @@ -0,0 +1,16 @@ +[Unit] +Description=NEXARCH Web - Portal Frontend +After=network.target + +[Service] +Type=simple +User=nexarch +WorkingDirectory=__INSTALL_DIR__/web/portal +EnvironmentFile=/etc/nexarch/web-portal.env +ExecStart=__INSTALL_DIR__/web/portal/node_modules/.bin/next start -p 3057 +Restart=on-failure +RestartSec=5 +StandardOutput=journal + +[Install] +WantedBy=multi-user.target diff --git a/docs/ARBEITSKARTEN.md b/docs/ARBEITSKARTEN.md index 57c1fc96..00339078 100644 --- a/docs/ARBEITSKARTEN.md +++ b/docs/ARBEITSKARTEN.md @@ -68,3 +68,10 @@ Offene PRs, die auf Merge warten, stehen unter C-01. Merge-Reihenfolge: erst DB- ### C-02 Aufräumen — nur mit Freigabe - `/root/manticore-backup-pre29` auf 131; Dateileichen im Manticore-Datenverzeichnis auf 204 nur nach Sichtung durch den User. - Verwaiste Test-Schemas `dmstest_*`, `workflowtest_*` können nach den testdb-Umstellungen als `connecttest_*` auftauchen. + +## D. Portal-Betrieb (Stand 2026-10-28) +- D-01 Portal-UI (PR #409) und account-api-Start (PR #410): gemergt. +- D-02 Portal auf 131: gebaut, Unit und nginx/nft offen, siehe `docs/BETRIEB-PORTAL.md`. +- D-03 account-api auf 131: DB-Passwort `nexarch_core` abgleichen (Betreiber), Unit aus Vorlage erneuern. +- D-04 204: localhost-Adressen in connect/connect-datev/rbac-admin behoben; Port 3113 offen. +- D-05 Frontends (workflow-tasks, workflow-cases, routing-rules, workflow-approvals, Portal-BFF) von `X-User-Id` auf Bearer umstellen, danach `NEXARCH_WORKFLOW_APP_ALLOW_HEADER_AUTH` entfernen. diff --git a/docs/BETRIEB-PORTAL.md b/docs/BETRIEB-PORTAL.md new file mode 100644 index 00000000..eb88fee7 --- /dev/null +++ b/docs/BETRIEB-PORTAL.md @@ -0,0 +1,15 @@ +# Betrieb Portal (Stand 2026-10-28) + +## 131 (Vorstufe Produktion) +- Code: `/opt/nexarch-web/portal/web/{portal,shl}`, Eigentümer `nexarch`. Der Benutzer hat kein Home; für `npm ci` HOME und `NPM_CONFIG_CACHE` auf `/opt/nexarch-web/portal/` setzen. +- Build mit `NEXT_PUBLIC_CORE_API_BASE=https://192.168.1.131:8443`, `NEXT_PUBLIC_LOGIN_URL=https://192.168.1.131:8443/`, `NEXT_PUBLIC_TOKEN_MODULE=portal`. +- Unit-Vorlage: `deploy/systemd/nexarch-web-portal.service.tmpl` (Port 3057). Env-Datei `/etc/nexarch/web-portal.env` mit `PORTAL_POLICY_API_URL`, `PORTAL_CORE_API_URL`, `PORTAL_STATUS_API_URL` und dem Secret `PORTAL_POLICY_SERVICE_TOKEN` (legt der Betreiber an). +- Offen: nginx-Block (Port 8450) und nft-Regel für den Zugriff von außen. +- Voraussetzung für Anmeldung: `nexarch-account-api` läuft (Passwort der DB-Rolle muss zur DSN in `account-api.env` passen; bei Authentifizierungsfehler beendet sich der Dienst mit Exit 2 und startet nicht neu). + +## 204 (Dev/Test, Demo `nexarch-portal-live`) +- Portal auf Port 3900 (nginx TLS 8443). Build dort mit `next build --webpack`: Turbopack löst `@nexarch/shl` über den Symlink nicht auf. +- `NEXT_PUBLIC_*` wird beim Build ins Bundle eingebaut. Werte mit `127.0.0.1` funktionieren im Browser nie. connect-api und rbac-admin-api sind deshalb über `deploy/nginx/204-portal-live-api-proxy.conf` (Ports 8447, 8448) erreichbar; connect, connect-datev und rbac-admin wurden damit neu gebaut. +- Selbst signiertes Zertifikat: die Ports 8447 und 8448 einmal im Browser bestätigen. +- Offen: Port 3113 (`kennzahlen_dashboard`) hat keinen Dienst. +- archivdms-Daten (Dienste `archivdms*`, `/var/archivdms`, `/opt/archivdms`) nicht anfassen.