Modern ERP Reports Application with microservices architecture Tech Stack: - Backend: FastAPI + python-oracledb (Oracle DB integration) - Frontend: Vue.js 3 + PrimeVue + Vite - Telegram Bot: python-telegram-bot + SQLite - Infrastructure: Shared database pool, JWT authentication, SSH tunnel Features: - FastAPI backend with async Oracle connection pool - Vue.js 3 responsive frontend with PrimeVue components - Telegram bot alternative interface - Microservices architecture with shared components - Complete deployment support (Linux Docker + Windows IIS) - Comprehensive testing (Playwright E2E + pytest) Repository Structure: - reports-app/ - Main application (backend, frontend, telegram-bot) - shared/ - Shared components (database pool, auth, utils) - deployment/ - Deployment scripts (Linux & Windows) - docs/ - Project documentation - security/ - Security scanning and git hooks
139 lines
3.2 KiB
Markdown
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.sh start` manual - totul e automat în Docker! 🎉 |