From 36c6405c2152bb2dd16d21376278441cab488fe3 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Wed, 4 Mar 2026 10:37:11 +0000 Subject: [PATCH] docs(infra): add space-booking deploy guide and Gitea LXC 106 docs - Add proxmox/lxc106-gitea/README.md: app.ini editing, Docker restart, webhook ALLOWED_HOST_LIST fix (hairpin NAT), troubleshooting - Add proxmox/lxc103-dokploy/docs/space-booking-app.md: full deploy guide with env vars, auto-seed accounts, SMTP, troubleshooting - Update proxmox/README.md: add LXC 106 entry and quick start - Update lxc103-dokploy/README.md: add space.roa.romfast.ro in domains table, ASCII architecture, and docs links Co-Authored-By: Claude Sonnet 4.6 --- proxmox/README.md | 26 ++- proxmox/lxc103-dokploy/README.md | 4 + .../lxc103-dokploy/docs/space-booking-app.md | 201 ++++++++++++++++ proxmox/lxc106-gitea/README.md | 221 ++++++++++++++++++ 4 files changed, 451 insertions(+), 1 deletion(-) create mode 100644 proxmox/lxc103-dokploy/docs/space-booking-app.md create mode 100644 proxmox/lxc106-gitea/README.md diff --git a/proxmox/README.md b/proxmox/README.md index bb8edd5..8ba970a 100644 --- a/proxmox/README.md +++ b/proxmox/README.md @@ -106,6 +106,30 @@ ssh root@10.0.20.201 "upsc nutdev1" --- +### LXC 106 - Gitea (Git Server) +**Director:** `lxc106-gitea/` +**IP:** 10.0.20.165 | **Host:** pvemini + +| Fișier | Descriere | +|--------|-----------| +| `README.md` | Configurare, operații frecvente, modificare app.ini, troubleshooting | + +**Quick Start:** +```bash +# Status +ssh root@10.0.20.201 "pct exec 106 -- docker ps" + +# Restart după modificare config +ssh root@10.0.20.201 "pct exec 106 -- docker restart gitea" + +# Logs +ssh root@10.0.20.201 "pct exec 106 -- docker logs gitea --tail 50" +``` + +**URL:** https://gitea.romfast.ro + +--- + ### LXC 103 - Dokploy + Traefik (Deployment Platform) **Director:** `lxc103-dokploy/` **IP:** 10.0.20.167 | **Host:** pvemini @@ -308,7 +332,7 @@ echo | openssl s_client -connect roa.romfast.ro:443 -servername roa.romfast.ro 2 | 100 | portainer | 10.0.20.170 | Docker Management (Remote Node) | `cluster/README.md` | | **103** | **dokploy** | **10.0.20.167** | **Dokploy + Traefik (App Deployment)** | **`lxc103-dokploy/`** | | **104** | **flowise** | **10.0.20.161** | **Flowise AI (Chatbot Maria)** | **`lxc104-flowise/`** | -| 106 | gitea | 10.0.20.165 | Git Server | `cluster/README.md` | +| **106** | **gitea** | **10.0.20.165** | **Git Server** | **`lxc106-gitea/`** | | **108** | **central-oracle** | **10.0.20.121** | **Oracle XE 21c** | **`lxc108-oracle/`** | | **110** | **moltbot** | **10.0.20.173** | **MoltBot AI (Telegram+WhatsApp)** | **`lxc110-moltbot/`** | | **171** | **claude-agent** | **10.0.20.171** | **Claude Code Dev Environment** | **`lxc171-claude-agent/`** | diff --git a/proxmox/lxc103-dokploy/README.md b/proxmox/lxc103-dokploy/README.md index ebe9601..d0f9bf0 100644 --- a/proxmox/lxc103-dokploy/README.md +++ b/proxmox/lxc103-dokploy/README.md @@ -22,6 +22,7 @@ Internet → 188.26.14.103 → VM 201 IIS (SSL termination) LXC 103 :443 (Traefik) ├── dokploy.romfast.ro → Dokploy UI :3000 ├── roa-qr.romfast.ro → pdf-qr-app container + ├── space.roa.romfast.ro → space-booking container ├── app1.roa.romfast.ro → app1 container └── app2.roa.romfast.ro → app2 container ``` @@ -54,6 +55,7 @@ conectat doar la UN singur Traefik — LXC 103. |---------|-----------| | `dokploy.romfast.ro` | Dokploy UI (port 3000) | | `roa-qr.romfast.ro` | pdf-qr-app container | +| `space.roa.romfast.ro` | space-booking container | | `*.roa.romfast.ro` | Orice app deployată prin Dokploy | --- @@ -226,6 +228,8 @@ systemctl restart dokploy-dnsrr-fix - **Setup IIS VM 201:** `../vm201-windows/scripts/setup-new-iis-sites.ps1` - **Web.config IIS proxy:** `../vm201-windows/iis-configs/` - **LXC 100 (Remote Node):** `../lxc100-portainer/README.md` *(de creat)* +- **space-booking deploy guide:** `docs/space-booking-app.md` +- **pdf-qr-app deploy guide:** `docs/pdf-qr-app.md` --- diff --git a/proxmox/lxc103-dokploy/docs/space-booking-app.md b/proxmox/lxc103-dokploy/docs/space-booking-app.md new file mode 100644 index 0000000..0504561 --- /dev/null +++ b/proxmox/lxc103-dokploy/docs/space-booking-app.md @@ -0,0 +1,201 @@ +# space-booking — Deploy pe Dokploy LXC 103 + +## Descriere + +Aplicație de rezervare spații (săli de conferință, birouri), cu backend FastAPI și +frontend Vue.js. Deployată pe Dokploy/LXC 103 ca serviciu Docker Compose. + +- **Domeniu:** `space.roa.romfast.ro` +- **Server:** LXC 103 (10.0.20.167) +- **Deployment:** Dokploy → Docker Compose +- **Repo:** `git@gitea.romfast.ro:romfast/space-booking.git` + +### Arhitectură + +``` +Browser → VM 201 IIS (SSL) → LXC 103 Traefik → frontend (nginx:80) + ↓ + backend (FastAPI:8000) + ↓ + SQLite /data/space_booking.db +``` + +Servicii Docker Compose: +- `frontend` — Vue.js servit de nginx, expus prin Traefik +- `backend` — FastAPI pe port 8000, intern (fără expunere directă) + +--- + +## Deploy în Dokploy UI + +### 1. Creare Service + +1. Deschide https://dokploy.romfast.ro +2. **Services** → **Create Service** → **Docker Compose** +3. Name: `space-booking` +4. Server: **LXC 103 (local)** + +### 2. Configurare Git Source + +- Provider: **Gitea** (sau Custom Git) +- URL: `http://gitea.romfast.ro/romfast/space-booking.git` +- Branch: `master` + +### 3. Domain Configuration + +În Dokploy, secțiunea **Domains**: +- Domain: `space.roa.romfast.ro` +- HTTPS: enabled +- Certificate: managed by Traefik + +### 4. Variabile de Mediu (Environment) + +Setează în Dokploy → **Environment** tab: + +| Variabilă | Obligatoriu | Valoare exemplu | Descriere | +|-----------|-------------|-----------------|-----------| +| `SECRET_KEY` | **DA** | `` | JWT signing key | +| `FRONTEND_URL` | **DA** | `https://space.roa.romfast.ro` | URL frontend pentru CORS/redirect | +| `SMTP_ENABLED` | Nu | `true` | Activează trimitere email | +| `SMTP_HOST` | Nu* | `smtp.example.com` | Server SMTP | +| `SMTP_PORT` | Nu* | `587` | Port SMTP | +| `SMTP_USER` | Nu* | `user@example.com` | User autentificare SMTP | +| `SMTP_PASSWORD` | Nu* | `parola` | Parolă SMTP | +| `SMTP_FROM_ADDRESS` | Nu* | `rezervari@romfast.ro` | Adresă expeditor | + +> *Necesare doar dacă `SMTP_ENABLED=true` + +**Generare SECRET_KEY:** +```bash +python -c "import secrets; print(secrets.token_hex(32))" +``` + +### 5. Deploy + +Click **Deploy** → monitorizează logs în Dokploy UI. + +--- + +## Conturi Demo Create Automat + +La primul deploy, `entrypoint.sh` rulează automat `seed_db.py` (idempotent). + +| Email | Parolă | Rol | +|-------|--------|-----| +| `admin@example.com` | `adminpassword` | Superadmin | +| `manager@example.com` | `managerpassword` | Manager | +| `user@example.com` | `userpassword` | User | + +> **Atenție:** Schimbă parolele în producție după primul login! + +Date demo create: 2 proprietăți ("Clădirea Centrală", "Biroul Privat"), 3 spații, 2 organizații. + +--- + +## Verificare Post-Deploy + +```bash +# Health check backend (prin Traefik) +curl -s https://space.roa.romfast.ro/health +# Răspuns așteptat: {"status": "ok"} + +# Health check direct (din LAN) +curl -s http://10.0.20.167/health -H "Host: space.roa.romfast.ro" + +# Verificare logs backend (seed automat) +# În Dokploy UI → space-booking → Logs → backend +# Trebuie să apară: +# [entrypoint] Running database seed... +# Database already seeded. Skipping... ← la redeploy-uri ulterioare +# [entrypoint] Starting application... + +# Test autentificare +curl -s -X POST https://space.roa.romfast.ro/api/auth/login \ + -H "Content-Type: application/json" \ + -d '{"email":"admin@example.com","password":"adminpassword"}' | jq . +``` + +--- + +## Configurare SMTP + +### Cu SMTP (email de confirmare rezervare) + +În Dokploy → Environment, setează: +``` +SMTP_ENABLED=true +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_USER=user@example.com +SMTP_PASSWORD=parola_smtp +SMTP_FROM_ADDRESS=rezervari@romfast.ro +``` + +Redeploy → verificare logs pentru mesaje email la rezervare. + +### Fără SMTP (implicit) + +Aplicația funcționează normal fără SMTP. Rezervările se fac, dar nu se trimit emailuri de confirmare. Setare implicită: `SMTP_ENABLED=false`. + +--- + +## DNS + +``` +space.roa.romfast.ro A 188.26.14.103 +``` + +Domeniu sub `*.roa.romfast.ro` → wildcard DNS acoperă automat. + +--- + +## SSL Certificate (Win-ACME pe VM 201) + +Dacă wildcardul `*.roa.romfast.ro` e deja configurat, SSL funcționează automat. + +Dacă e nevoie de cert explicit: +```powershell +cd C:\Tools\win-acme +Import-Module WebAdministration +Get-Website | Select-Object ID, Name + +.\wacs.exe --source iis --siteid --accepttos --emailaddress admin@romfast.ro +iisreset +``` + +--- + +## Troubleshooting + +### 502 Bad Gateway + +Cauze posibile: +1. **dnsrr fix** — Docker Swarm VIP issue (standard pe LXC 103) + ```bash + journalctl -u dokploy-dnsrr-fix -n 20 + # Trebuie să apară: OK - space-booking-... now uses dnsrr + ``` +2. **Backend nu a pornit** — verifică logs backend în Dokploy UI + +### Seed DB nu rulează + +```bash +# Verificare logs în Dokploy UI → backend +# Dacă apare eroare la seed, verifică DATABASE_URL și permisiuni volum +docker volume ls | grep space-booking +``` + +### SMTP nu trimite emailuri + +1. Verifică `SMTP_ENABLED=true` în Dokploy → Environment +2. Verifică că `SMTP_USER` și `SMTP_PASSWORD` sunt setate (nu doar `SMTP_HOST`) +3. Redeploy după setarea variabilelor +4. Verifică logs backend pentru erori SMTP + +### Resetare bază de date (date demo) + +```bash +# ATENȚIE: șterge toate datele! +docker volume rm space-booking_backend_data +# La redeploy următor, seed_db.py recreează datele demo +``` diff --git a/proxmox/lxc106-gitea/README.md b/proxmox/lxc106-gitea/README.md new file mode 100644 index 0000000..59e94ba --- /dev/null +++ b/proxmox/lxc106-gitea/README.md @@ -0,0 +1,221 @@ +# LXC 106 - Gitea (Git Server) + +## Informații Generale + +- **CTID:** 106 +- **IP:** 10.0.20.165 +- **Rol:** Git server self-hosted pentru toate repo-urile ROMFAST +- **Host Proxmox:** pvemini (10.0.20.201) +- **Status:** Running (onboot: enabled) +- **URL public:** https://gitea.romfast.ro + +--- + +## Arhitectură + +Gitea rulează în Docker Compose pe LXC 106. Datele sunt persistate în volume locale. + +``` +Internet → 188.26.14.103 → VM 201 IIS (SSL) → LXC 106 :3000 (Gitea) + :222 (SSH git) +``` + +### Containere Docker + +| Container | Image | Port | Rol | +|-----------|-------|------|-----| +| `gitea` | docker.gitea.com/gitea:1.24.3 | 3000 (web), 222 (SSH) | Git server | +| `gitea-db-1` | postgres:14 | 5432 (intern) | Bază de date | + +### Volume (pe LXC 106) + +| Cale pe LXC | Montat în container | Conținut | +|-------------|--------------------|----| +| `/opt/gitea/gitea/` | `/data` | Repo-uri, configurație, avatare, LFS | +| `/opt/gitea/postgres/` | `/var/lib/postgresql/data` | Baza de date PostgreSQL | +| `/opt/gitea/docker-compose.yml` | — | Definție servicii Docker | + +### Fișier configurație principal + +``` +/opt/gitea/gitea/gitea/conf/app.ini ← pe LXC 106 (host) +/data/gitea/conf/app.ini ← în interiorul containerului +``` + +--- + +## Acces + +### Web UI +``` +https://gitea.romfast.ro (public, prin IIS) +http://10.0.20.165:3000 (intern LAN) +``` + +### SSH (operații git) +```bash +# Clone repo +git clone git@gitea.romfast.ro:romfast/.git + +# SSH config recomandat (~/.ssh/config) +Host gitea.romfast.ro + HostName 10.0.20.165 + Port 222 + User git + IdentityFile ~/.ssh/gitea_ed25519 +``` + +### Shell pe LXC (din pvemini) +```bash +ssh root@10.0.20.201 "pct exec 106 -- sh -c ''" +``` + +--- + +## Operații Frecvente + +### Status containere +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker ps" +``` + +### Restart Gitea (după modificări app.ini) +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker restart gitea" +``` + +### Restart complet (Gitea + PostgreSQL) +```bash +ssh root@10.0.20.201 "pct exec 106 -- sh -c 'cd /opt/gitea && docker compose restart'" +``` + +### Logs Gitea +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker logs gitea -f --tail 50" +``` + +### Logs PostgreSQL +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker logs gitea-db-1 --tail 20" +``` + +--- + +## Modificare Configurație (app.ini) + +**Fișier:** `/opt/gitea/gitea/gitea/conf/app.ini` pe LXC 106 + +### Vizualizare configurație curentă +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker exec gitea cat /data/gitea/conf/app.ini" +``` + +### Editare directă pe LXC +```bash +# Intră în LXC +ssh root@10.0.20.201 "pct enter 106" + +# Editează +nano /opt/gitea/gitea/gitea/conf/app.ini + +# Restart după modificare +docker restart gitea +``` + +### Adăugare secțiune nouă (non-interactiv) +```bash +ssh root@10.0.20.201 "pct exec 106 -- sh -c 'printf \"\n[sectiune]\nCHEIE = VALOARE\n\" >> /opt/gitea/gitea/gitea/conf/app.ini'" +ssh root@10.0.20.201 "pct exec 106 -- docker restart gitea" +``` + +> **Important:** `bash` nu este disponibil în LXC 106 — folosește `sh`. + +--- + +## Configurații Notabile din app.ini + +### Webhook — ALLOWED_HOST_LIST + +Implicit Gitea blochează webhook-urile spre IP-uri private (protecție SSRF). +Pentru a permite webhook-uri spre LXC-uri interne (ex: Dokploy pe 10.0.20.167): + +```ini +[webhook] +ALLOWED_HOST_LIST = 10.0.20.0/24 +``` + +**Context:** Gitea nu poate accesa `dokploy.romfast.ro` din LAN (hairpin NAT). +Webhook-urile spre Dokploy trebuie configurate cu IP intern: +``` +http://10.0.20.167:3000/api/deploy/compose/ +``` + +### Mailer (SMTP) + +```ini +[mailer] +ENABLED = true +SMTP_ADDR = mail.romfast.ro +SMTP_PORT = 465 +FROM = gitea@romfast.ro +USER = gitea@romfast.ro +``` + +### Server + +```ini +[server] +DOMAIN = gitea.romfast.ro +ROOT_URL = https://gitea.romfast.ro/ +SSH_LISTEN_PORT = 22 ; intern în container +SSH_PORT = 222 ; expus pe LXC +``` + +--- + +## Upgrade Gitea + +```bash +# Editează versiunea în docker-compose.yml +ssh root@10.0.20.201 "pct exec 106 -- sh -c 'cd /opt/gitea && nano docker-compose.yml'" + +# Pull imagine nouă și recreează containerul +ssh root@10.0.20.201 "pct exec 106 -- sh -c 'cd /opt/gitea && docker compose pull && docker compose up -d'" +``` + +--- + +## Backup + +Datele importante sunt în `/opt/gitea/` pe LXC 106: +- `/opt/gitea/gitea/` — repo-uri, configurație, LFS, avatare +- `/opt/gitea/postgres/` — baza de date PostgreSQL + +Proxmox face backup automat al întregului LXC 106 zilnic la 02:00. + +--- + +## Troubleshooting + +### Gitea nu pornește +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker logs gitea --tail 50" +``` + +### Webhook timeout din Gitea +Cauză: hairpin NAT — Gitea nu poate accesa domenii publice care pointează spre LAN. +Fix: folosește IP intern în URL webhook (ex: `http://10.0.20.167:3000/...`). +Vezi secțiunea **Webhook — ALLOWED_HOST_LIST** de mai sus. + +### Port 222 SSH nu răspunde +```bash +ssh root@10.0.20.201 "pct exec 106 -- docker ps | grep gitea" +# Dacă containerul e oprit: +ssh root@10.0.20.201 "pct exec 106 -- sh -c 'cd /opt/gitea && docker compose up -d'" +``` + +--- + +**Ultima actualizare:** 2026-03-04 +**Autor:** Marius Mutu +**Proiect:** ROMFASTSQL - LXC 106 Gitea