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>
This commit is contained in:
56
README.md
56
README.md
@@ -35,10 +35,11 @@ git clone <repository-url>
|
||||
cd roa2web
|
||||
|
||||
# Start all services with one command
|
||||
./start-prod.sh
|
||||
./start.sh prod # Production
|
||||
./start.sh test # Test environment
|
||||
```
|
||||
|
||||
This starts SSH tunnel, unified backend (port 8001), and frontend (port 3000).
|
||||
This starts SSH tunnel (if needed), unified backend (port 8000), and frontend (port 3000).
|
||||
|
||||
**For individual service setup or troubleshooting**: See "Development & Testing" section below.
|
||||
|
||||
@@ -108,7 +109,7 @@ This starts SSH tunnel, unified backend (port 8001), and frontend (port 3000).
|
||||
|
||||
## Development & Testing
|
||||
|
||||
**Quick Start**: Use `./start-prod.sh` to start all services (SSH tunnel + Backend + Frontend).
|
||||
**Quick Start**: Use `./start.sh prod` to start all services (SSH tunnel + Backend + Frontend).
|
||||
|
||||
**For detailed development commands, testing procedures, and troubleshooting**: See `CLAUDE.md` and component-specific READMEs:
|
||||
- Backend: `backend/ modules and CLAUDE.md`
|
||||
@@ -117,77 +118,76 @@ This starts SSH tunnel, unified backend (port 8001), and frontend (port 3000).
|
||||
|
||||
**Key Commands**:
|
||||
```bash
|
||||
# Start All Services (FAST with parallel backend startup - ~11s dev, ~33s test)
|
||||
./start-prod.sh # Start all (SSH tunnel + Backends + Bot + Frontend)
|
||||
./start-test.sh # Start all (TEST environment)
|
||||
# Start All Services
|
||||
./start.sh prod # Start PROD (SSH tunnel + Backend + Frontend)
|
||||
./start.sh test # Start TEST (direct Oracle connection)
|
||||
./start.sh prod stop # Stop PROD services
|
||||
./start.sh test stop # Stop TEST services
|
||||
|
||||
# Individual Service Control (NEW - for quick restarts!)
|
||||
./start-frontend.sh start|stop|restart|status # Frontend only (~7s restart!)
|
||||
./backend-reports.sh start|stop|status # Reports backend only
|
||||
./backend-data-entry.sh start|stop|status # Data Entry backend only
|
||||
./bot.sh start|stop|status # Telegram bot only
|
||||
# Individual Service Control (for quick restarts)
|
||||
./start-frontend.sh start|stop|restart|status # Frontend only (~7s restart!)
|
||||
./start-backend.sh start|stop|restart|status # Backend only
|
||||
|
||||
# System Monitoring
|
||||
./status.sh # Show all services status + health checks
|
||||
|
||||
# Infrastructure Only
|
||||
./ssh-tunnel-prod.sh start|stop|status # Oracle DB tunnel (production)
|
||||
./ssh-tunnel-test.sh start|stop|status # Oracle TEST tunnel
|
||||
./ssh-tunnel.sh start|stop|status # Oracle DB tunnel (for servers with SSH)
|
||||
```
|
||||
|
||||
**💡 Pro Tips**:
|
||||
- **Frontend changes?** Use `./start-frontend.sh restart` instead of restarting everything (87% faster!)
|
||||
- **Check what's running:** `./status.sh` shows everything at a glance
|
||||
- **Backend-uri pornesc în paralel** în start-prod.sh și start-test.sh pentru pornire mai rapidă
|
||||
- **Single unified script:** `start.sh` handles both environments with parameters
|
||||
|
||||
### 📖 Usage Flow
|
||||
|
||||
**Individual scripts (`start-frontend.sh`, `start-backend.sh`, `backend-*.sh`, `bot.sh`) are environment-neutral:**
|
||||
**Individual scripts (`start-frontend.sh`, `start-backend.sh`) are environment-neutral:**
|
||||
- They DON'T change `.env` files
|
||||
- They use whatever `.env` is already present
|
||||
- Use them for **quick restarts** when working on a specific service
|
||||
|
||||
**Master scripts (`start-prod.sh`, `start-test.sh`) set the environment:**
|
||||
- `start-prod.sh` → uses existing `.env` files (DEV mode)
|
||||
- `start-test.sh` → copies `.env.test` → `.env` (TEST mode)
|
||||
**Master scripts (`start.sh prod`, `start.sh test`) set the environment:**
|
||||
- `start.sh prod` → uses existing `.env` files (DEV mode)
|
||||
- `start.sh test` → copies `.env.test` → `.env` (TEST mode)
|
||||
|
||||
**Recommended workflow:**
|
||||
|
||||
```bash
|
||||
# Morning: Start full stack with environment selection
|
||||
./start-prod.sh # DEV mode - sets up .env files
|
||||
./start.sh prod # DEV mode - sets up .env files
|
||||
|
||||
# During development: Quick service restarts
|
||||
./start-frontend.sh restart # Frontend only (~7s)
|
||||
./backend-reports.sh restart # Reports backend only (~30s)
|
||||
# ⚠️ Individual scripts inherit the environment set by start-prod.sh
|
||||
# ⚠️ Individual scripts inherit the environment set by start.sh prod
|
||||
|
||||
# End of day: Stop everything
|
||||
./start-prod.sh stop
|
||||
./start.sh prod stop
|
||||
```
|
||||
|
||||
**Common scenarios:**
|
||||
|
||||
```bash
|
||||
# Scenario 1: Working on frontend only
|
||||
./start-prod.sh # Start everything once
|
||||
./start.sh prod # Start everything once
|
||||
./start-frontend.sh restart # Restart frontend multiple times (fast!)
|
||||
|
||||
# Scenario 2: Debugging a single backend
|
||||
./start-prod.sh stop # Stop all
|
||||
./ssh-tunnel-prod.sh start # Infrastructure only
|
||||
./backend-reports.sh start # Just the backend you need
|
||||
./start-frontend.sh start # Just the frontend
|
||||
./start.sh prod stop # Stop all
|
||||
./ssh-tunnel.sh start # SSH tunnel (if needed)
|
||||
./start-backend.sh start # Just the backend
|
||||
./start-frontend.sh start # Just the frontend
|
||||
|
||||
# Scenario 3: Testing mode
|
||||
./start-test.sh # Starts everything in TEST mode
|
||||
./start.sh test # Starts everything in TEST mode
|
||||
# All subsequent individual script calls use TEST .env files
|
||||
|
||||
# Scenario 4: Check what's running
|
||||
./status.sh # See all services + health checks
|
||||
```
|
||||
|
||||
**Note**: For automated testing and validation (`/validate` command), use `start-test.sh` which starts all services connected to Oracle TEST server (LXC 10.0.20.121) with test credentials.
|
||||
**Note**: For automated testing and validation (`/validate` command), use `start.sh test` which starts all services connected to Oracle TEST server (LXC 10.0.20.121) with test credentials.
|
||||
|
||||
**API Documentation** (when backend running):
|
||||
- Swagger UI: http://localhost:8001/docs
|
||||
|
||||
Reference in New Issue
Block a user