Files
roa2web-service-auto/ssh-tunnel/docs/SSH_TUNNEL_DOCKER.md
Marius Mutu c5e051ad80 feat: Migrate to ultrathin monolith architecture
Consolidate 3 separate applications (reports-app, data-entry-app, telegram-bot) into a unified
architecture with single backend and frontend:

Backend Changes:
- Unified FastAPI backend at backend/ with modular structure
- Modules: reports, data_entry, telegram in backend/modules/
- Centralized config.py and main.py with all routers registered
- Single worker mode (--workers 1) for Telegram bot compatibility
- Shared Oracle connection pool and JWT authentication
- Unified requirements.txt and environment configuration

Frontend Changes:
- Single Vue.js SPA with module-based routing
- Unified frontend at src/ with modules in src/modules/{reports,data-entry}/
- Shared components and stores in src/shared/
- Error boundaries for module isolation
- Dual API proxy in Vite for module communication

Infrastructure:
- New unified startup scripts: start-prod.sh, start-test.sh, start-backend.sh
- Environment templates: .env.dev.example, .env.test.example, .env.prod.example
- Updated deployment scripts for Windows IIS
- Simplified SSH tunnel management

Documentation:
- Comprehensive CLAUDE.md with architecture overview
- Module-specific docs in docs/{data-entry,telegram}/
- Architecture decision records in docs/ARCHITECTURE-DECISIONS.md
- Deployment guides consolidated in deployment/windows/docs/

This migration reduces complexity, improves maintainability, and enables easier
deployment while maintaining all existing functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 23:48:14 +02:00

139 lines
3.2 KiB
Markdown

# SSH Tunnel Docker Integration
SSH tunnel-ul pentru conexiunea la Oracle database este acum complet integrat în Docker setup.
## 🔧 Configurare Automată
### Development Mode
SSH tunnel-ul pornește automat când rulezi:
```bash
docker-compose up
```
### Servicii incluse:
- **roa-ssh-tunnel**: Container dedicat pentru SSH tunnel
- **roa-backend**: Conectat prin tunnel la Oracle
- **roa-frontend**: Interface-ul web
- **roa-gateway**: Nginx reverse proxy
- **roa-redis**: Cache și sesiuni
## 📋 Cerințe
### SSH Key
Asigură-te că ai cheia SSH în locația corectă:
```bash
~/.ssh/roa_oracle_server
```
### Configurare Environment
Variabilele sunt setate automat din `.env.development`:
```env
SSH_SERVER=83.103.197.79
SSH_PORT=22122
SSH_USER=roa2web
REMOTE_HOST=10.0.20.36
ORACLE_HOST=localhost # Se conectează prin tunnel
```
## 🚀 Utilizare
### Start complet cu SSH tunnel:
```bash
# Copiază environment-ul de development
cp .env.development .env
# Pornește toate serviciile (inclusiv SSH tunnel)
docker-compose up --build
```
### Verificare SSH tunnel:
```bash
# Check tunnel health
docker-compose ps roa-ssh-tunnel
# Check tunnel logs
docker-compose logs -f roa-ssh-tunnel
# Test Oracle connection through tunnel
docker-compose exec roa-backend python -c "
from shared.database.oracle_pool import test_connection
test_connection()
"
```
## 🔍 Monitoring
### SSH Tunnel Status:
- **Health check**: Verifică portul 1521 la fiecare 30s
- **Auto-restart**: Tunnel-ul se restartează automat dacă se întrerupe
- **Logs**: Monitorizare în timp real cu `docker-compose logs -f roa-ssh-tunnel`
### Service Dependencies:
```
roa-ssh-tunnel (first)
roa-redis
roa-backend (depends on tunnel + redis)
roa-frontend
roa-gateway (last)
```
## 🏭 Producție
În producție, SSH tunnel-ul este automat dezactivat:
```bash
# Production deployment (fără SSH tunnel)
docker-compose -f docker-compose.yml -f docker-compose.production.yml up -d
```
Backend-ul se conectează direct la Oracle server în producție.
## 🛠️ Troubleshooting
### SSH Tunnel nu pornește:
```bash
# Verifică că ai cheia SSH
ls -la ~/.ssh/roa_oracle_server
# Verifică permissions
chmod 600 ~/.ssh/roa_oracle_server
# Restart tunnel container
docker-compose restart roa-ssh-tunnel
```
### Backend nu se conectează la Oracle:
```bash
# Check tunnel status
docker-compose exec roa-ssh-tunnel nc -z localhost 1521
# Check backend logs
docker-compose logs -f roa-backend
# Test manual connection
docker-compose exec roa-ssh-tunnel nc -z 10.0.20.36 1521
```
### Connection timeout:
```bash
# Verifică că serverul SSH rulează
ssh -p 22122 roa2web@83.103.197.79
# Restart toate serviciile
docker-compose down && docker-compose up --build
```
## 📊 Avantaje
**Automat**: Nu mai trebuie să pornești manual SSH tunnel-ul
**Robust**: Auto-restart dacă tunnel-ul se întrerupe
**Monitorizat**: Health checks și logging complet
**Development-only**: Exclus automat în producție
**Containerizat**: Izolat în propriul container
**Dependencies**: Backend așteaptă tunnel-ul să fie gata
Nu mai trebuie să rulezi `./ssh-tunnel-prod.sh start` manual - totul e automat în Docker! 🎉