diff --git a/.gitea/workflows/docker-publish.yaml b/.gitea/workflows/docker-publish.yaml index 3a52fa21..1dc4aa59 100644 --- a/.gitea/workflows/docker-publish.yaml +++ b/.gitea/workflows/docker-publish.yaml @@ -102,16 +102,15 @@ jobs: # Pangolin-Bypass: Gitea intern via HTTP erreichbar machen # Problem: git.mo-code.at ist extern HTTPS (Pangolin), Gitea intern läuft HTTP auf Port 3000. - # Alter Fix (/etc/hosts → 10.0.0.22) scheiterte: Docker versuchte HTTPS:443, Port geschlossen. - # Lösung: socat proxied lokalen Port 80 → 10.0.0.22:3000 - # buildkitd nutzt http=true (Port 80) → socat → Gitea:3000 (kein TLS nötig) + # Lösung: /etc/hosts zeigt git.mo-code.at → 10.0.0.22 + # iptables DNAT leitet :80 → :3000 weiter (kein socat, kein Extra-Paket nötig) + # buildkitd nutzt http=true (Port 80) → iptables → Gitea:3000 - name: Registry intern auflösen (Pangolin-Bypass) run: | - which socat || sudo apt-get install -y -q socat - echo "127.0.0.1 git.mo-code.at" | sudo tee -a /etc/hosts - sudo socat TCP4-LISTEN:80,fork,reuseaddr TCP4:10.0.0.22:3000 & - sleep 1 - echo "✓ Proxy aktiv: git.mo-code.at:80 → 10.0.0.22:3000" + echo "10.0.0.22 git.mo-code.at" | sudo tee -a /etc/hosts + sudo iptables -t nat -A OUTPUT -p tcp -d 10.0.0.22 --dport 80 -j DNAT --to-destination 10.0.0.22:3000 + sudo iptables -t nat -A POSTROUTING -p tcp -d 10.0.0.22 --dport 3000 -j MASQUERADE + echo "✓ DNAT aktiv: git.mo-code.at:80 → 10.0.0.22:3000" - name: Log in to the Container registry uses: docker/login-action@v3 diff --git a/docs/99_Journal/2026-03-06_Session_Log_Pipeline_Fix_v3.md b/docs/99_Journal/2026-03-06_Session_Log_Pipeline_Fix_v3.md new file mode 100644 index 00000000..b7bb933f --- /dev/null +++ b/docs/99_Journal/2026-03-06_Session_Log_Pipeline_Fix_v3.md @@ -0,0 +1,86 @@ +--- +type: journal +status: ACTIVE +owner: Lead Architect +date: 2026-03-06 +--- + +# Session Log — Pipeline Fix v3: socat nicht verfügbar → iptables DNAT + +**Datum:** 06.03.2026 +**Agent:** 👷 Backend Developer +**Thema:** CI/CD Pipeline — `socat` nicht auf Runner verfügbar + +--- + +## Problem + +Fix v2 verwendete `socat` als TCP-Proxy (Port 80 → Gitea:3000). +Der Gitea-Runner (VM 102, Debian minimal) hat kein `socat` installiert und das Paket ist im lokalen APT-Repo nicht auffindbar: + +``` +E: Unable to locate package socat +``` + +--- + +## Lösung: iptables DNAT + +`iptables` ist auf jedem Linux-System ohne Extra-Paket verfügbar. +DNAT (Destination NAT) leitet Verbindungen auf Kernel-Ebene um — kein Userspace-Proxy nötig. + +```yaml +- name: Registry intern auflösen (Pangolin-Bypass) + run: | + echo "10.0.0.22 git.mo-code.at" | sudo tee -a /etc/hosts + sudo iptables -t nat -A OUTPUT -p tcp -d 10.0.0.22 --dport 80 -j DNAT --to-destination 10.0.0.22:3000 + sudo iptables -t nat -A POSTROUTING -p tcp -d 10.0.0.22 --dport 3000 -j MASQUERADE + echo "✓ DNAT aktiv: git.mo-code.at:80 → 10.0.0.22:3000" +``` + +**Traffic-Weg:** +``` +BuildKit → http://git.mo-code.at:80 + → /etc/hosts: 10.0.0.22:80 + → iptables DNAT: 10.0.0.22:80 → 10.0.0.22:3000 + → Gitea (HTTP, kein TLS nötig) +``` + +--- + +## Warum iptables besser als socat + +| Eigenschaft | socat | iptables DNAT | +|--------------------|----------------|-------------------| +| Verfügbarkeit | ❌ Paket fehlt | ✅ immer vorhanden | +| Paket-Installation | nötig | nicht nötig | +| Arbeitsebene | Userspace | Kernel (schneller)| +| Abhängigkeiten | APT-Repo nötig | keine | + +--- + +## Netzwerk-Übersicht Zora + +| Host | IP | Protokoll | +|--------------------|-------------|---------------------| +| Runner (VM 102) | 10.0.0.23 | — | +| Gitea (CT 101) | 10.0.0.22 | HTTP :3000 | +| Pangolin (CT 100) | 10.0.0.21 | HTTPS für git.mo-code.at | + +--- + +## Fix-Verlauf dieser Pipeline-Debugging-Session + +| Version | Symptom | Fix | Ergebnis | +|---------|--------------------------------|----------------------------|-------------------| +| v1 | 502 Bad Gateway (Pangolin) | `/etc/hosts` + provenance:false | Port 443 refused | +| v2 | connection refused Port 443 | socat :80 → :3000 | socat nicht da | +| **v3** | socat nicht verfügbar | **iptables DNAT** | ✅ erwartet grün | + +--- + +## Gelernt + +- Minimale Runner-Images haben oft kein `socat` — APT-Repos auf Air-Gapped Systemen sind limitiert +- `iptables` DNAT ist die robustere Lösung: kein Extra-Paket, Kernel-Level, überall verfügbar +- `OUTPUT`-Chain für lokal initiierte Verbindungen, `POSTROUTING` + MASQUERADE für korrekte Source-Adresse