# MIDAS — Infraestrutura ## Stack Técnica | Camada | Tecnologia | |--------|-----------| | **Frontend** | Next.js 14 + Tailwind CSS + PWA | | **Backend** | FastAPI (Python 3.12) | | **Banco** | PostgreSQL (DO Managed) | | **Cache** | Redis (futuro) | | **IA** | OpenAI GPT-4o-mini | | **Hosting** | DigitalOcean (jarvis-do) | | **CDN/SSL** | Cloudflare | ## Portas | Serviço | Porta | |---------|-------| | Frontend (Next.js) | 3087 | | Backend (FastAPI) | 8097 | ## Servidor - **Droplet:** jarvis-do (198.199.84.130) - **RAM:** 8GB / **CPU:** 4vCPU / **Disco:** 160GB - **OS:** Ubuntu 24.04 - **Process Manager:** PM2 ## Banco de Dados - **Tipo:** PostgreSQL 18 (DO Managed) - **Host:** kislanski-db-do-user-32806441-0.k.db.ondigitalocean.com:25060 - **Database:** midas - **User:** midas - **Encoding:** UTF-8 ## DNS (Cloudflare) - **Domínio:** midas.aivertice.com - **Zone:** aivertice.com (0e70c64b5d7a9eb9fac8a53892c5227f) - **Registro:** A → 198.199.84.130 (proxied) - **SSL:** Full (Strict) + Certbot local ## Nginx ```nginx server { server_name midas.aivertice.com; location / { proxy_pass http://127.0.0.1:3087; } location /api { proxy_pass http://127.0.0.1:8097; } # SSL managed by Certbot } ``` ## PM2 ```bash pm2 start "uvicorn app.main:app --host 0.0.0.0 --port 8097" --name midas-backend pm2 start "npx next start -p 3087" --name midas-frontend ``` ## CI/CD - **Gitea:** git.ophion.com.br/bigtux/midas - **Deploy:** Manual via SSH (futuro: webhook) ## Backups - PostgreSQL: backup diário automático (DO Managed) - pg_dump diário → DO Spaces (s3://kislanski-backups/postgres/) - Snapshots 3x/semana ## Monitoramento - Infra monitor cron (30min) — health check HTTP - PM2 auto-restart on crash - Cloudflare Analytics ## APK (futuro) - TWA via bubblewrap - Package: com.aivertice.midas - Download: aivertice.com/app/midas.apk