docs(lxc103): document Docker Swarm VIP DNS fix with dnsrr
Add section explaining the root cause (IPVS broken in LXC), the solution (dnsrr endpoint mode), and the dokploy-dnsrr-fix systemd service that auto-applies the fix on every Dokploy deployment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,74 @@ curl http://localhost:8080/api/http/routers | jq .
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Fix: Docker Swarm VIP DNS (Bug Permanent Rezolvat)
|
||||||
|
|
||||||
|
### Problema
|
||||||
|
|
||||||
|
Docker Swarm folosește implicit **VIP (Virtual IP)** pentru load balancing intern.
|
||||||
|
IPVS (mecanismul kernel care implementează VIP) **nu funcționează în LXC containers**.
|
||||||
|
|
||||||
|
Când Traefik încearcă să rezolve `http://qr-qrgenerator-vqkwsu:80`, primea VIP-ul
|
||||||
|
serviciului (ex: 10.0.1.8) în loc de IP-ul real al task-ului (ex: 10.0.1.12) →
|
||||||
|
**502 Bad Gateway**.
|
||||||
|
|
||||||
|
### Soluția
|
||||||
|
|
||||||
|
Schimbăm endpoint mode-ul serviciilor Swarm din `vip` → `dnsrr` (DNS Round Robin).
|
||||||
|
Cu `dnsrr`, DNS-ul rezolvă direct la IP-ul real al containerului, bypassing IPVS.
|
||||||
|
|
||||||
|
### Implementare: `dokploy-dnsrr-fix` (systemd service)
|
||||||
|
|
||||||
|
Un listener permanent care prinde orice serviciu Swarm nou creat/actualizat de
|
||||||
|
Dokploy și îl setează automat la `dnsrr`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Script: /usr/local/bin/dokploy-dnsrr-fix.sh
|
||||||
|
# Service: /etc/systemd/system/dokploy-dnsrr-fix.service
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verificare status
|
||||||
|
systemctl status dokploy-dnsrr-fix
|
||||||
|
|
||||||
|
# Logs (confirmare că fixul s-a aplicat la ultimul deploy)
|
||||||
|
journalctl -u dokploy-dnsrr-fix -n 20
|
||||||
|
```
|
||||||
|
|
||||||
|
Output normal după un deploy:
|
||||||
|
```
|
||||||
|
Setting dnsrr for qr-qrgenerator-vqkwsu (was: vip)
|
||||||
|
OK - qr-qrgenerator-vqkwsu now uses dnsrr
|
||||||
|
```
|
||||||
|
|
||||||
|
### Timeline la fiecare redeploy
|
||||||
|
|
||||||
|
```
|
||||||
|
0s Dokploy creează/actualizează serviciul Swarm (vip mode)
|
||||||
|
→ Traefik: 502 Bad Gateway
|
||||||
|
1s Listener prinde evenimentul update
|
||||||
|
3s docker service update --endpoint-mode dnsrr
|
||||||
|
13s Service converge, DNS rezolvă corect
|
||||||
|
→ Traefik: 200 OK
|
||||||
|
```
|
||||||
|
|
||||||
|
**Downtime la redeploy: ~13 secunde** (inevitabil cu Swarm în LXC).
|
||||||
|
|
||||||
|
### Dacă fix-ul nu funcționează (manual recovery)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Identifică serviciul cu problemă
|
||||||
|
docker service ls --format '{{.Name}} {{.Mode}}'
|
||||||
|
|
||||||
|
# 2. Setează manual dnsrr
|
||||||
|
docker service update --endpoint-mode dnsrr <service-name>
|
||||||
|
|
||||||
|
# 3. Repornește listener dacă e oprit
|
||||||
|
systemctl restart dokploy-dnsrr-fix
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Documentație Asociată
|
## Documentație Asociată
|
||||||
|
|
||||||
- **Arhitectură completă IIS:** `../vm201-windows/docs/vm201-dokploy-infrastructure.md`
|
- **Arhitectură completă IIS:** `../vm201-windows/docs/vm201-dokploy-infrastructure.md`
|
||||||
@@ -161,6 +229,6 @@ curl http://localhost:8080/api/http/routers | jq .
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Ultima actualizare:** 2026-03-02
|
**Ultima actualizare:** 2026-03-03
|
||||||
**Autor:** Marius Mutu
|
**Autor:** Marius Mutu
|
||||||
**Proiect:** ROMFASTSQL - LXC 103 Dokploy
|
**Proiect:** ROMFASTSQL - LXC 103 Dokploy
|
||||||
|
|||||||
Reference in New Issue
Block a user