244 Zeilen
7.8 KiB
Markdown
244 Zeilen
7.8 KiB
Markdown
# V2-Docker System Documentation
|
|
|
|
## Overview
|
|
|
|
V2-Docker is a comprehensive system featuring a License Server, Admin Panel, Lead Management, and Monitoring Stack. This document consolidates all architecture and implementation details.
|
|
|
|
## License Server Architecture
|
|
|
|
### Core Principles
|
|
- Designed to avoid refactoring
|
|
- Microservices architecture
|
|
- Hardware-based license binding
|
|
- Offline grace period support (7 days)
|
|
- Version control with update enforcement
|
|
|
|
### Core Functionalities
|
|
|
|
#### 1. License Validation
|
|
- Real-time license verification
|
|
- Hardware binding (MAC address, CPU ID, system UUID)
|
|
- Version compatibility checks
|
|
- Usage limit enforcement
|
|
|
|
#### 2. Activation Management
|
|
- Initial activation with hardware fingerprint
|
|
- Multi-activation support
|
|
- Deactivation capabilities
|
|
- Transfer between systems
|
|
|
|
#### 3. Usage Monitoring
|
|
- Active user tracking
|
|
- Feature usage statistics
|
|
- Heartbeat monitoring (15-minute intervals)
|
|
- Historical data analysis
|
|
|
|
### Microservices Architecture
|
|
|
|
#### Aktive Services
|
|
1. **License Server** (`v2_lizenzserver`) - Core license validation
|
|
- Vollständig implementiert
|
|
- API-Endpunkte für Aktivierung, Verifizierung, Info
|
|
- Läuft auf internem Port über Nginx
|
|
|
|
2. **Admin Panel** (`v2_adminpanel`) - Web-basierte Verwaltung
|
|
- Vollständig implementiert auf Port 80
|
|
- Customer, License, Resource Management
|
|
- Integrierte Backup-Funktionalität
|
|
- Lead Management System
|
|
|
|
#### Infrastructure Services
|
|
- **PostgreSQL** - Main database
|
|
- **Redis** - Caching
|
|
- **RabbitMQ** - Message queue
|
|
- **Nginx** - Reverse proxy
|
|
|
|
*Note: Analytics, Admin API, and Auth services exist in code but are currently inactive.*
|
|
|
|
#### Communication
|
|
- REST APIs für externe Kommunikation
|
|
- Redis für Caching
|
|
- RabbitMQ für asynchrone Verarbeitung (vorbereitet)
|
|
|
|
### Database Schema
|
|
See `v2_adminpanel/init.sql` for complete schema.
|
|
Key feature: Monthly partitioned `license_heartbeats` table.
|
|
|
|
### Security Concepts
|
|
- JWT-based authentication
|
|
- API key management
|
|
- Rate limiting (100 requests/minute)
|
|
- Hardware fingerprint validation
|
|
- Encrypted communication
|
|
|
|
### Implementation Status (June 22, 2025)
|
|
|
|
#### Completed
|
|
- ✅ License Server mit vollständigen API-Endpunkten
|
|
- POST /api/license/activate
|
|
- POST /api/license/verify
|
|
- GET /api/license/info/{license_key}
|
|
- POST /api/license/session/start - Session-Initialisierung
|
|
- POST /api/license/session/heartbeat - Keep-alive
|
|
- POST /api/license/session/end - Session-Beendigung
|
|
- POST /api/version/check
|
|
- GET /api/version/latest
|
|
- ✅ Admin Panel mit voller Funktionalität
|
|
- Customer Management mit erweiterten Features
|
|
- License Management mit Resource Allocation
|
|
- Resource Pool Management (Domains, IPs, Telefonnummern)
|
|
- Session Management mit Live-Monitor
|
|
- Lead Management System (vollständiges CRM)
|
|
- Batch Operations für Bulk-Aktionen
|
|
- Export/Import Funktionalität
|
|
- Device Registration und Management
|
|
- API Key Management (System-wide)
|
|
- ✅ Monitoring Stack (Prometheus, Grafana, Alertmanager)
|
|
- Integriertes Monitoring Dashboard
|
|
- Vorkonfigurierte Dashboards
|
|
- Alert Rules für kritische Metriken
|
|
- ✅ Docker Services Konfiguration
|
|
- ✅ JWT/API Key Management
|
|
- ✅ Backup-System (integriert im Admin Panel)
|
|
- ✅ 2FA-Authentifizierung
|
|
- ✅ Audit Logging mit Request IDs
|
|
- ✅ Rate Limiting (konfigurierbar)
|
|
- ✅ Single-Session Enforcement (Account Forger)
|
|
- ✅ Partitionierte Datenbank für Heartbeats
|
|
|
|
#### Code vorhanden aber nicht aktiviert
|
|
- ⏸️ Analytics Service (auskommentiert)
|
|
- ⏸️ Admin API Service (auskommentiert)
|
|
- ⏸️ Auth Service (auskommentiert)
|
|
|
|
#### Geplant
|
|
- 📋 Notification Service
|
|
- 📋 Erweiterte Analytics
|
|
- 📋 Machine Learning Integration
|
|
|
|
## Lead Management System
|
|
|
|
### Status
|
|
**Vollständig implementiert** als Teil des Admin Panels unter `/leads/`
|
|
|
|
### Architecture
|
|
- **Modular Architecture**: Clean separation of concerns
|
|
- **Service Layer Pattern**: Business logic in `leads/services.py`
|
|
- **Repository Pattern**: Data access in `leads/repositories.py`
|
|
- **Blueprint Integration**: Routes in `leads/routes.py`
|
|
|
|
### Data Model (implementiert)
|
|
```
|
|
lead_institutions
|
|
├── lead_contacts (1:n)
|
|
│ └── lead_contact_details (1:n) - Telefon/E-Mail
|
|
└── lead_notes (1:n) - Versionierte Notizen
|
|
```
|
|
|
|
### Implementierte Features
|
|
1. ✅ Institution Management (CRUD)
|
|
2. ✅ Contact Person Management mit mehreren Telefon/E-Mail
|
|
3. ✅ Notes mit vollständiger Versionierung
|
|
4. ✅ Flexible Kontaktdetails (beliebig viele pro Person)
|
|
5. ✅ Audit Trail Integration
|
|
6. ✅ Service/Repository Pattern für Clean Code
|
|
7. ✅ JSONB Felder für zukünftige Erweiterungen
|
|
|
|
### API Endpoints
|
|
- GET /leads/ - Institutionen-Übersicht
|
|
- GET /leads/institutions - Institutionen-Liste
|
|
- POST /leads/institutions - Neue Institution
|
|
- GET /leads/institutions/{id} - Institution Details
|
|
- PUT /leads/institutions/{id} - Institution bearbeiten
|
|
- DELETE /leads/institutions/{id} - Institution löschen
|
|
- GET /leads/contacts/{id} - Kontakt Details
|
|
- POST /leads/contacts/{id}/details - Kontaktdetail hinzufügen
|
|
- PUT /leads/contacts/{id}/details/{detail_id} - Detail bearbeiten
|
|
- POST /leads/contacts/{id}/notes - Notiz hinzufügen
|
|
|
|
## Monitoring Stack
|
|
|
|
### Monitoring Stack
|
|
- **Prometheus**: Metrics collection (port 9090)
|
|
- **Grafana**: Dashboards (port 3000)
|
|
- **Alertmanager**: Alerts (port 9093)
|
|
- Exporters for PostgreSQL, Redis, Node, and containers
|
|
|
|
Pre-configured dashboards and alerts for system health.
|
|
|
|
## Admin Panel
|
|
|
|
### Implementierte Features
|
|
1. **Authentication & Security**
|
|
- ✅ Login mit 2FA-Unterstützung
|
|
- ✅ Session Management
|
|
- ✅ Rate Limiting
|
|
- ✅ IP-Blocking bei fehlgeschlagenen Logins
|
|
- ✅ Audit Logging aller Aktionen
|
|
|
|
2. **Customer Management**
|
|
- ✅ CRUD-Operationen für Kunden
|
|
- ✅ Kundensuche mit Autocomplete
|
|
- ✅ Kunden-Lizenz-Übersicht
|
|
- ✅ Quick Stats pro Kunde
|
|
|
|
3. **License Management**
|
|
- ✅ Lizenzerstellung (Einzel und Batch)
|
|
- ✅ Lizenzbearbeitung und -löschung
|
|
- ✅ Bulk-Operationen (Aktivieren/Deaktivieren)
|
|
- ✅ Device Management mit Hardware IDs
|
|
- ✅ Resource Allocation (Domains, IPs, Telefonnummern)
|
|
- ✅ Quick Edit Funktionalität
|
|
- ✅ Session Management und Monitoring
|
|
- ✅ Lizenz-Konfiguration für Account Forger
|
|
|
|
4. **Monitoring & Analytics**
|
|
- ✅ Dashboard mit Live-Statistiken
|
|
- ✅ Lizenzserver-Monitoring
|
|
- ✅ Session-Überwachung mit Live-Updates
|
|
- ✅ Resource Pool Monitoring
|
|
- ✅ Integriertes Monitoring Dashboard (/monitoring)
|
|
- ✅ Prometheus/Grafana Integration
|
|
- ✅ Alert Management
|
|
|
|
5. **System Administration**
|
|
- ✅ Backup & Restore (manuell und geplant)
|
|
- ✅ Export-Funktionen (CSV, JSON)
|
|
- ✅ Audit Log Viewer mit Filterung
|
|
- ✅ Blocked IPs Management
|
|
- ✅ Feature Flags Konfiguration
|
|
- ✅ API Key Generation und Management
|
|
- ✅ Lizenzserver Administration
|
|
- ✅ Session-Terminierung durch Admins
|
|
|
|
### Technical Stack
|
|
- Backend: Flask 3.0.3, PostgreSQL
|
|
- Frontend: Bootstrap 5.3, jQuery
|
|
- Security: bcrypt, pyotp (2FA), JWT
|
|
|
|
## Deployment Configuration
|
|
|
|
### Docker Services
|
|
|
|
#### Aktive Services
|
|
- `v2_postgres`: PostgreSQL database (Port 5432)
|
|
- `v2_admin_panel`: Admin interface (interner Port 5000)
|
|
- `v2_nginx`: Reverse proxy (Port 80)
|
|
- `v2_license_server`: License server (interner Port 8000)
|
|
- `v2_redis`: Redis cache (Port 6379)
|
|
- `v2_rabbitmq`: Message queue (Ports 5672, 15672)
|
|
|
|
See monitoring configuration in `monitoring/docker-compose.monitoring.yml`.
|
|
|
|
### Environment Configuration
|
|
Required: DATABASE_URL, SECRET_KEY, JWT_SECRET
|
|
See docker-compose.yaml for all environment variables.
|
|
|
|
|
|
## Current Status
|
|
System is production-ready with all core features implemented:
|
|
- ✅ License management with session enforcement
|
|
- ✅ Lead management CRM
|
|
- ✅ Resource pool management
|
|
- ✅ Complete monitoring stack
|
|
- ✅ Backup and audit systems |