Files
ROMFASTSQL/proxmox/vm201-windows/docs/vm201-dokploy-infrastructure.md
Claude Agent fcf1e06c66 feat(infra): add Dokploy LXC 103 and new IIS web domains
- Add LXC 103 Dokploy infrastructure (v0.28.2) with Traefik
- Deploy pdf-qr-app and qr-generator via Dokploy from GitHub
- Configure IIS VM 201: roa-qr and *.roa.romfast.ro wildcard sites
- Add SSL certificates (Let's Encrypt + wildcard DNS challenge)
- Fix Docker Swarm VIP DNS issue with dnsrr endpoint mode
- Document architecture: IIS → Traefik → Dokploy containers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 15:44:53 +00:00

7.6 KiB

VM 201 IIS — Infrastructură Web Dokploy

Obiectiv

Structură clară de domenii pentru toate serviciile ROMFAST, cu Dokploy ca platformă unificată de deployment. Un singur wildcard DNS (*.roa.romfast.ro) acoperă toate app-urile deployate prin Dokploy.


Structura Completă a Domeniilor

romfast.ro (DNS → 188.26.14.103 → NAT → VM 201 IIS)
│
├── roa.romfast.ro               ← IIS Default Web Site
│   ├── /contafinupdate          ← fișiere locale IIS (rămân neschimbate)
│   ├── /roaupdate               ← fișiere locale IIS (rămân neschimbate)
│   └── /*                       ← proxy → 10.0.20.36 (ROA Windows prod)
│
├── roa2web.romfast.ro           ← IIS Site 2 (existent)
│   └── proxy → 10.0.20.36
│
├── roa-qr.romfast.ro            ← IIS Site NOU → Traefik LXC 103
│   └── pdf-qr-app (migrat pe Dokploy/LXC 103)
│
├── dokploy.romfast.ro           ← IIS Site (existent)
│   └── proxy → Traefik LXC 103 → Dokploy UI
│
├── gitea.romfast.ro             ← IIS Site (existent)
│   └── proxy → Gitea LXC 106
│
└── *.roa.romfast.ro             ← IIS Site NOU (wildcard) → Traefik LXC 103
    ├── app1.roa.romfast.ro      ← app deployată în Dokploy pe LXC 103
    ├── app2.roa.romfast.ro      ← altă app deployată pe LXC 103
    └── [orice app viitoare]

Arhitectura Serverelor

VM 201 IIS (10.0.20.122) — SSL termination + routing per domeniu
    │
    ├── *.roa.romfast.ro + roa-qr.romfast.ro + dokploy.romfast.ro
    │       ↓ proxy HTTPS
    │   LXC 103 Traefik (10.0.20.167:443)
    │       ├── dokploy.roa.romfast.ro / dokploy.romfast.ro → Dokploy UI
    │       ├── roa-qr.romfast.ro → pdf-qr-app container
    │       ├── app1.roa.romfast.ro → app1 container
    │       ├── app2.roa.romfast.ro → app2 container
    │       └── [configurat automat de Dokploy la fiecare deploy]
    │
    └── roa.romfast.ro, roa2web.romfast.ro, gitea.romfast.ro
            ↓ proxy spre destinații existente (neschimbat)

LXC 103 (10.0.20.167) — Dokploy Control Plane + Execution Node Public
    ├── Dokploy UI (port 3000) — management toate serverele
    ├── Traefik (port 443) — routing public pentru TOATE app-urile publice
    └── SSH management → LXC 100

LXC 100 (10.0.20.170) — Remote Execution Node (gestionat din Dokploy)
    ├── Traefik propriu (instalat de Dokploy) — pentru servicii interne
    ├── App-uri fără DNS public (backend-uri, jobs, servicii interne)
    └── Portainer UI (port 9443) — rămâne funcțional

Rezumat Roluri

Component Rol
VM 201 IIS SSL termination, routing per domeniu
LXC 103 Traefik Routing pentru TOATE app-urile publice (*.roa.romfast.ro)
LXC 103 Dokploy UI management, CI/CD, deployment pe LXC 103 și LXC 100
LXC 100 Compute pentru servicii interne/backend fără DNS public
LXC 100 Traefik Routing intern pentru app-urile pe LXC 100
LXC 100 Portainer Vizualizare containere locale (port 9443)

Implementare Pași

Pasul 1 — LXC 100: Oprire nginx existent

# Pe LXC 100 (via Portainer terminal sau Proxmox console)
docker stop docker-nginx-1
docker rm docker-nginx-1
ss -tlnp | grep -E ':80|:443'   # verifică porturile sunt libere

Pasul 2 — Dokploy: Generare SSH Key + Adăugare LXC 100

În Dokploy UI (https://dokploy.romfast.ro):

  1. Settings → SSH Keys → Create SSH Key → copiază public key

Pe LXC 100:

echo "ssh-ed25519 AAAA...[cheia copiată]" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys

În Dokploy UI:

  1. Servers → Add Server → IP: 10.0.20.170, User: root
  2. Test Connection → Setup Server
  3. Verificare: pe LXC 100, docker ps → trebuie container Traefik

Pasul 3 — Dokploy: Deploy pdf-qr-app pe LXC 103

În Dokploy UI:

  1. Services → Create Service → Docker Compose
  2. Server: LXC 103 (local)
  3. Docker Compose: conținutul app-ului pdf-qr
  4. Domain: roa-qr.romfast.ro
  5. Deploy

Pasul 4 — IIS VM 201: Site nou roa-qr.romfast.ro

Rulează scriptul PowerShell (sau manual):

# Rulează scriptul complet
C:\scripts\setup-new-iis-sites.ps1

Sau manual:

New-Item -Path "C:\inetpub\roa-qr" -ItemType Directory -Force
New-Website -Name "roa-qr" -PhysicalPath "C:\inetpub\roa-qr" `
            -HostHeader "roa-qr.romfast.ro" -Port 80
New-WebBinding -Name "roa-qr" -Protocol https -Port 443 `
               -HostHeader "roa-qr.romfast.ro" -SslFlags 1

Copiază iis-configs/roa-qr.web.configC:\inetpub\roa-qr\web.config

Pasul 5 — IIS VM 201: Site wildcard *.roa.romfast.ro

New-Item -Path "C:\inetpub\roa-apps" -ItemType Directory -Force
New-Website -Name "roa-apps" -PhysicalPath "C:\inetpub\roa-apps" `
            -HostHeader "*.roa.romfast.ro" -Port 80
New-WebBinding -Name "roa-apps" -Protocol https -Port 443 `
               -HostHeader "*.roa.romfast.ro" -SslFlags 1

Copiază iis-configs/roa-apps-wildcard.web.configC:\inetpub\roa-apps\web.config

Notă: Wildcard hostname (*.roa.romfast.ro) funcționează din IIS 10 cu SNI.

Pasul 6 — DNS + SSL

DNS (la provider):

roa-qr.romfast.ro         A      188.26.14.103
*.roa.romfast.ro          A      188.26.14.103   ← wildcard

SSL Certificate pe VM 201 — Win-ACME:

cd C:\Tools\win-acme

# Certificate pentru roa-qr.romfast.ro
.\wacs.exe --source iis --siteid <ID_roa-qr> --accepttos --emailaddress admin@romfast.ro

# Certificate wildcard *.roa.romfast.ro (necesită DNS challenge)
# Dacă provider-ul DNS nu suportă API Win-ACME → certificate individuale
.\wacs.exe --source iis --siteid <ID_roa-apps> --accepttos --emailaddress admin@romfast.ro
iisreset

Notă SSL wildcard: Certificate wildcard (*.roa.romfast.ro) necesită DNS challenge (nu HTTP-01). Dacă provider-ul DNS nu suportă API Win-ACME, generează certificate individuale per subdomain când adaugi app-uri noi.


Workflow: Adăugare App Nouă

1. Dokploy UI → New Service → docker-compose → domain: numeapp.roa.romfast.ro
2. DNS: adaugă numeapp.roa.romfast.ro A 188.26.14.103
   (acoperit de wildcard *.roa.romfast.ro dacă e configurat)
3. SSL: Win-ACME pe VM 201 generează cert dacă nu e wildcard
4. Gata — Traefik pe LXC 103 routează automat

Verificare Completă

# Traefik LXC 103 funcționează
curl -I https://10.0.20.167/

# pdf-qr-app accesibil public
curl -I https://roa-qr.romfast.ro/

# Wildcard funcționează (după deploy app)
curl -I https://app1.roa.romfast.ro/

# LXC 100 Portainer funcționează
curl -sk https://10.0.20.170:9443/api/status

Fișiere Asociate

Fișier Scop
../scripts/setup-new-iis-sites.ps1 Script PowerShell setup IIS automat
../iis-configs/roa-qr.web.config web.config proxy pentru roa-qr.romfast.ro
../iis-configs/roa-apps-wildcard.web.config web.config proxy wildcard *.roa.romfast.ro
../../lxc103-dokploy/README.md Documentație LXC 103 Dokploy
../../lxc103-dokploy/docs/pdf-qr-app.md Deploy pdf-qr-app în Dokploy

Ultima actualizare: 2026-03-02 Autor: Marius Mutu Proiect: ROMFASTSQL - Infrastructură Web Dokploy