# ROA2WEB Ultrathin Monolith - Quick Start 🚀 ## Pornire Rapidă ### PROD Environment (server PRODUCȚIE 10.0.20.36) ```bash ./start.sh prod # Pornește tot: SSH tunnel + backend + frontend ./start.sh prod stop # Oprește toate serviciile ``` ### TEST Environment (server TEST 10.0.20.121) ```bash ./start.sh test # Pornește tot: backend + frontend (conexiune directă) ./start.sh test stop # Oprește toate serviciile ``` ## Verificare Status ```bash ./status.sh # Arată status-ul tuturor serviciilor ``` ## Ce s-a Schimbat? ### Înainte (3 Backend-uri Separate) ``` Reports Backend → Port 8001 Data Entry Backend → Port 8003 Telegram Bot → Port 8002 ``` ### Acum (1 Backend Unificat) ``` Unified Backend → Port 8000 ├── Reports API: /api/reports/* ├── Data Entry: /api/data-entry/* ├── Telegram: /api/telegram/* └── Bot: Running ca background task ``` ## Scripturi Disponibile | Script | Descriere | |--------|-----------| | `./start.sh prod` | Pornește tot pentru PROD (Oracle PROD: 10.0.20.36 + SSH) | | `./start.sh test` | Pornește tot pentru TEST (Oracle TEST: 10.0.20.121 direct) | | `./start.sh stop` | Oprește toate serviciile | | `./status.sh` | Verifică status-ul serviciilor | | `./start-backend.sh start/stop/restart` | Control granular backend | | `./start-frontend.sh restart` | Restart rapid frontend (~7s) | ## API Endpoints **Backend Unificat**: http://localhost:8000 - **API Docs**: http://localhost:8000/docs - **Health Check**: http://localhost:8000/health - **Reports**: http://localhost:8000/api/reports/* - **Data Entry**: http://localhost:8000/api/data-entry/* - **Telegram**: http://localhost:8000/api/telegram/* **Frontend**: http://localhost:3000 ## Log Files ```bash # Backend logs tail -f /tmp/unified_backend_dev.log # DEV tail -f /tmp/unified_backend_test.log # TEST # Frontend logs tail -f /tmp/unified_frontend_dev.log # DEV tail -f /tmp/unified_frontend_test.log # TEST ``` ## Troubleshooting ### Backend nu pornește ```bash # Verifică logurile tail -n 50 /tmp/unified_backend_dev.log # Verifică dacă portul este ocupat lsof -i :8000 # Oprește procesul vechi ./start.sh prod stop ``` ### Frontend nu pornește ```bash # Verifică logurile tail -n 50 /tmp/unified_frontend_dev.log # Reinstalează dependențele rm -rf node_modules package-lock.json npm install ``` ### SSH Tunnel nu se conectează ```bash # Pentru servere care necesită SSH tunnel (producție) ./ssh-tunnel.sh stop ./ssh-tunnel.sh start # TEST - conexiune directă, nu necesită tunnel ``` ## Configurare Inițială 1. **Backend**: Creează `backend/.env` din `backend/.env.example` 2. **Configurează variabilele** pentru mediul dorit (DEV/TEST) 3. **Pornește serviciile**: `./start.sh prod` sau `./start.sh test` ## Diferențe DEV vs TEST | Aspect | DEV | TEST | |--------|-----|------| | SSH Tunnel | `./ssh-tunnel.sh` | Nu necesită (conexiune directă) | | Server Oracle | 10.0.20.36 (PROD) | 10.0.20.121 (TEST) | | Schema Test | ROMFAST (id=114) | MARIUSM_AUTO (id=110) | | .env File | `backend/.env` | `backend/.env.test` → `backend/.env` | | Hot Reload | DA (--reload) | NU (pentru stabilitate) | ## Avantaje ✅ **1 comandă** în loc de 3 pentru pornire ✅ **1 proces** în loc de 3 de monitorizat ✅ **Loguri unificate** într-un singur fișier ✅ **Debugging mai ușor** - tot în același proces ✅ **Resurse optimizate** - Oracle pool partajat ✅ **Pornire mai rapidă** - inițializare paralelă ## Documentație Completă - **Implementare**: `ULTRATHIN-MONOLITH-IMPLEMENTATION.md` - **Teste**: `./test-unified-backend.sh` - **Plan Detaliat**: `.auto-build/specs/ultrathin-monolith/plan.md`