Files
roa2web-service-auto/QUICK-START.md
Claude Agent b137e80b71 feat: multi-Oracle server support with runtime switching
Complete implementation of multi-server Oracle database support:

Backend:
- Multi-pool Oracle with lazy loading per server
- Email-to-server cache for automatic server discovery
- JWT tokens include server_id claim
- /auth/check-identity and /auth/check-email endpoints
- /auth/my-servers endpoint for listing user's accessible servers
- Server switch with password re-authentication

Frontend:
- New ServerSelector component for header dropdown
- Multi-step login flow (identity → server → password)
- Server switching from header with password modal
- Mobile drawer menu with server selection
- Dark mode support for all new components
- URL bookmark support with ?server= query param

Scripts:
- Unified start.sh replacing start-prod.sh/start-test.sh
- Unified ssh-tunnel.sh with multi-server support
- Updated status.sh for new architecture

Tests:
- E2E tests for multi-server and single-server login flows
- Backend unit tests for all new endpoints
- Oracle multi-pool integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 22:39:06 +00:00

139 lines
3.7 KiB
Markdown

# 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 <env> 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`