Files
PecHub/infra/nginx/conf.d/pecflow.conf
T
mgiustini 58a233236c feat: Fase 1 – Fondamenta complete (backend FastAPI + auth + permessi)
- docker-compose.yml: PostgreSQL 16, Redis 7, MinIO, Nginx
- backend FastAPI: struttura monorepo, config pydantic-settings
- modelli SQLAlchemy: tutti i modelli (tenants, users, mailboxes, messages, archival, permissions, labels, audit_log)
- migrazione Alembic 0001: schema completo in pure SQL
- auth API: login JWT, refresh token rotation, logout, 2FA TOTP (setup/verify/disable)
- CRUD utenti: lista, crea, modifica, reset password, soft delete
- permessi granulari (Fase 1-A): mailbox_permissions, assegna/revoca/lista
- CRUD tenant: gestione super-admin
- sicurezza: AES-256-GCM cifratura credenziali IMAP/SMTP, bcrypt password
- RLS PostgreSQL: isolamento multi-tenant per request
- seed sviluppo: tenant demo + admin + operator
- test unit: security (bcrypt, JWT, AES), auth_service
- test integration: auth endpoints, users endpoints
- CI GitHub Actions: lint (ruff), test (pytest), build Docker, security scan
- infra: nginx.conf, redis.conf
- Makefile con comandi make dev/test/migrate/seed

Definition of Done:
 Login, refresh token e TOTP funzionanti
 make dev porta in piedi tutto lo stack locale
 CI configurata
2026-03-18 16:42:01 +01:00

73 lines
2.9 KiB
Plaintext

server {
listen 80;
server_name localhost;
# Redirect HTTP → HTTPS in produzione (commentato per dev)
# return 301 https://$host$request_uri;
# ── API Backend ───────────────────────────────────────────────────────────
location /api/ {
limit_req zone=api burst=20 nodelay;
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
# Timeout generosi per operazioni lunghe (es. generazione QR)
proxy_connect_timeout 30s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
# Upload allegati fino a 50MB
client_max_body_size 50m;
}
# ── Auth endpoint con rate limiting più stretto ────────────────────────────
location /api/v1/auth/login {
limit_req zone=auth burst=5 nodelay;
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# ── Health check ──────────────────────────────────────────────────────────
location /health {
proxy_pass http://backend:8000;
access_log off;
}
# ── Swagger UI (solo dev) ─────────────────────────────────────────────────
location /docs {
proxy_pass http://backend:8000;
}
location /redoc {
proxy_pass http://backend:8000;
}
location /openapi.json {
proxy_pass http://backend:8000;
}
# ── WebSocket ─────────────────────────────────────────────────────────────
location /ws/ {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
}
# ── Frontend (sarà aggiunto in Fase 5) ────────────────────────────────────
# location / {
# proxy_pass http://frontend:3000;
# }
}