Files
boti/README.md
root e4a70fff83 Add setup_nginx_proxy.sh; update README and CLAUDE.md
Documents OPNsense NGINX proxy setup script (upstream server, upstream,
location, HTTP server creation via OPNsense API with wildcard cert
auto-detection). Marks reverse proxy automation as complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 19:49:40 +01:00

4.6 KiB
Raw Permalink Blame History

Customer Installer Proxmox LXC n8n Stack

Überblick

Dieses Projekt automatisiert die Bereitstellung DSGVOkonformer KundenLXCs auf einem ProxmoxCluster. Pro Kunde wird eine eigene LXC erstellt, inklusive:

  • Debian 12
  • Docker + Docker Compose Plugin
  • PostgreSQL + pgvector
  • n8n (mit automatisch importiertem RAG-Workflow)
  • PostgREST (Supabase-kompatible REST API)
  • Vorbereitung für Reverse Proxy (OPNsense / NGINX)
  • VLANAnbindung
  • APT & DockerProxy (AptCacher NG)

Ziel: reproduzierbare, schnelle und saubere KundenSetups, vollständig skriptgesteuert.


Architektur

Internet
   │
OPNsense (os-nginx, TLS, Wildcard-Zertifikat)
   │
VLAN 90
   │
Proxmox LXC (Debian 12)
   ├── Docker
   │   ├── n8n
   │   ├── PostgreSQL (pgvector)
   │   └── PostgREST
   └── Kunden-Daten (isoliert)

Voraussetzungen

Proxmox Host

  • Proxmox VE (Clusterfähig)
  • Zugriff auf: pct, pvesm, pveam, pvesh
  • Storage für LXCs (z. B. local-zfs)
  • Bridge (z. B. vmbr0)
  • VLANfähiges Netzwerk

Netzwerk / Infrastruktur

  • OPNsense Firewall (API auf Port 4444)
  • VLAN (Standard: VLAN 90)
  • WildcardZertifikat auf OPNsense
  • osnginx Plugin aktiv
  • Ollama: http://192.168.45.3:11434
  • AptCacher NG (optional): http://192.168.45.2:3142
  • Docker Registry Mirror: http://192.168.45.2:5000

Projektstruktur

installer/
├── install.sh                  # Haupt-Installer
├── libsupabase.sh              # Gemeinsame Bibliothek (Proxmox, n8n API, Generatoren)
├── setup_nginx_proxy.sh        # OPNsense NGINX-Proxy einrichten
├── delete_nginx_proxy.sh       # OPNsense NGINX-Proxy löschen
├── RAGKI-BotPGVector.json      # Standard n8n RAG-Workflow-Template
├── templates/
│   ├── docker-compose.yml      # Referenz-Template
│   ├── reload-workflow.sh      # Wird in CT deployed; lädt Workflow bei Neustart neu
│   └── n8n-workflow-reload.service  # Systemd-Unit für Auto-Reload
├── sql/
│   ├── init_pgvector.sql       # pgvector-Extension, documents-Tabelle, PostgREST-Rollen
│   └── botkonzept_schema.sql
├── credentials/                # Generierte Zugangsdaten pro Kunde (<hostname>.json)
└── logs/                       # Install-Logs pro Kunde (<hostname>.log)

Installation

# Minimal
bash install.sh --storage local-zfs --bridge vmbr0 --ip dhcp --vlan 90

# Mit allen Optionen
bash install.sh \
  --storage local-zfs \
  --bridge vmbr0 \
  --ip dhcp \
  --vlan 90 \
  --base-domain userman.de \
  --n8n-owner-email admin@userman.de \
  --workflow-file RAGKI-BotPGVector.json \
  --debug

# OPNsense NGINX-Proxy einrichten
bash setup_nginx_proxy.sh \
  --ctid <ctid> \
  --hostname sb-<unix_ts> \
  --fqdn sb-<unix_ts>.userman.de \
  --backend-ip <ct_ip> \
  --backend-port 5678 \
  [--certificate-uuid <uuid>]

# Verfügbare Zertifikate auflisten
bash setup_nginx_proxy.sh --list-certificates --debug

# API-Verbindung testen
bash setup_nginx_proxy.sh --test-connection --debug

# NGINX-Proxy für eine Instanz löschen
bash delete_nginx_proxy.sh --ctid <ctid> [--dry-run] [--debug]

Ausgabe

Im Normalbetrieb (DEBUG=0) gibt install.sh ein kompaktes JSON auf stdout aus und schreibt alle Logs in logs/<hostname>.log. Mit --debug erscheinen Logs auf stderr und das JSON wird formatiert ausgegeben.


Automatisierte Schritte

  1. Preflight-Prüfung (Proxmox-Tools, Storage, Bridge)
  2. Debian-12-Template herunterladen (falls nicht vorhanden)
  3. CTID-Generierung: unix_timestamp - 1.000.000.000 → Hostname: sb-<unix_timestamp>
  4. LXC erstellen + starten + IP ermitteln
  5. Docker + Compose Plugin installieren, Locales setzen
  6. Secrets generieren (Passwörter, JWT, Encryption Key)
  7. .env, docker-compose.yml und SQL-Init-Skripte in CT schreiben
  8. Stack starten (postgres + postgrest + n8n)
  9. n8n Owner-Account anlegen
  10. n8n-Credentials + RAG-Workflow importieren und aktivieren
  11. Workflow-Auto-Reload via systemd einrichten
  12. OPNsense NGINX Reverse Proxy konfigurieren (falls setup_nginx_proxy.sh vorhanden)
  13. JSON-Ausgabe + Zugangsdaten in credentials/<hostname>.json speichern

Status

produktiv einsetzbar RAG-Workflow (Chat + PDF-Upload) automatisch deployed Workflow-Auto-Reload bei LXC-Neustart OPNsense NGINX Reverse Proxy vollständig automatisiert


Lizenz / Hinweis

Internes Projekt kein Public Release.