Alle .md einmal aufgeräumt
Dieser Commit ist enthalten in:
521
API_REFERENCE.md
Normale Datei
521
API_REFERENCE.md
Normale Datei
@@ -0,0 +1,521 @@
|
||||
# V2-Docker API Reference
|
||||
|
||||
## License Server API
|
||||
|
||||
### Public Endpoints
|
||||
|
||||
#### POST /api/v1/activate
|
||||
Activate a license on a new system.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"hardware_id": {
|
||||
"mac_address": "00:1B:44:11:3A:B7",
|
||||
"cpu_id": "BFEBFBFF000906EA",
|
||||
"system_uuid": "4C4C4544-0052-3410-8036-B8C04F303832"
|
||||
},
|
||||
"machine_name": "DESKTOP-ABC123",
|
||||
"app_version": "1.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"activation_id": "act_123456",
|
||||
"features": ["feature1", "feature2"],
|
||||
"max_users": 10,
|
||||
"valid_until": "2026-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### POST /api/v1/validate
|
||||
Validate an active license.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"activation_id": "act_123456",
|
||||
"hardware_id": {
|
||||
"mac_address": "00:1B:44:11:3A:B7",
|
||||
"cpu_id": "BFEBFBFF000906EA",
|
||||
"system_uuid": "4C4C4544-0052-3410-8036-B8C04F303832"
|
||||
},
|
||||
"current_users": 5,
|
||||
"app_version": "1.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"valid": true,
|
||||
"features": ["feature1", "feature2"],
|
||||
"max_users": 10,
|
||||
"message": "License valid"
|
||||
}
|
||||
```
|
||||
|
||||
#### POST /api/v1/heartbeat
|
||||
Send usage heartbeat.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"activation_id": "act_123456",
|
||||
"current_users": 5,
|
||||
"feature_usage": {
|
||||
"feature1": 150,
|
||||
"feature2": 75
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"next_heartbeat": "2025-01-01T12:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### POST /api/v1/deactivate
|
||||
Deactivate a license.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"activation_id": "act_123456",
|
||||
"reason": "System upgrade"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "License deactivated successfully"
|
||||
}
|
||||
```
|
||||
|
||||
### Admin API Endpoints
|
||||
|
||||
#### Authentication
|
||||
All admin endpoints require JWT authentication:
|
||||
```
|
||||
Authorization: Bearer <jwt_token>
|
||||
```
|
||||
|
||||
#### GET /api/v1/admin/licenses
|
||||
List all licenses.
|
||||
|
||||
**Query Parameters:**
|
||||
- `page` (default: 1)
|
||||
- `per_page` (default: 50)
|
||||
- `status` (active, inactive, expired)
|
||||
- `customer_id`
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"licenses": [
|
||||
{
|
||||
"id": 1,
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"customer_name": "ACME Corp",
|
||||
"type": "subscription",
|
||||
"status": "active",
|
||||
"valid_from": "2025-01-01",
|
||||
"valid_until": "2026-01-01",
|
||||
"max_activations": 5,
|
||||
"current_activations": 3
|
||||
}
|
||||
],
|
||||
"total": 100,
|
||||
"page": 1,
|
||||
"per_page": 50
|
||||
}
|
||||
```
|
||||
|
||||
#### POST /api/v1/admin/licenses
|
||||
Create a new license.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"customer_id": 123,
|
||||
"type": "subscription",
|
||||
"valid_from": "2025-01-01",
|
||||
"valid_until": "2026-01-01",
|
||||
"max_activations": 5,
|
||||
"max_users": 10,
|
||||
"features": ["feature1", "feature2"]
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"id": 456,
|
||||
"license_key": "NEW1-NEW2-NEW3-NEW4",
|
||||
"message": "License created successfully"
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /api/v1/admin/licenses/{id}
|
||||
Get license details.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"customer": {
|
||||
"id": 123,
|
||||
"name": "ACME Corp",
|
||||
"email": "admin@acme.com"
|
||||
},
|
||||
"activations": [
|
||||
{
|
||||
"id": "act_123456",
|
||||
"machine_name": "DESKTOP-ABC123",
|
||||
"activated_at": "2025-01-01T10:00:00Z",
|
||||
"last_heartbeat": "2025-06-19T14:30:00Z",
|
||||
"status": "active"
|
||||
}
|
||||
],
|
||||
"usage_stats": {
|
||||
"total_users": 150,
|
||||
"peak_users": 10,
|
||||
"feature_usage": {
|
||||
"feature1": 5000,
|
||||
"feature2": 2500
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### PUT /api/v1/admin/licenses/{id}
|
||||
Update license.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"valid_until": "2027-01-01",
|
||||
"max_activations": 10,
|
||||
"features": ["feature1", "feature2", "feature3"]
|
||||
}
|
||||
```
|
||||
|
||||
#### DELETE /api/v1/admin/licenses/{id}
|
||||
Revoke a license.
|
||||
|
||||
#### GET /api/v1/admin/activations
|
||||
List all activations.
|
||||
|
||||
**Query Parameters:**
|
||||
- `license_id`
|
||||
- `status` (active, inactive)
|
||||
- `from_date`
|
||||
- `to_date`
|
||||
|
||||
#### GET /api/v1/admin/statistics
|
||||
Get usage statistics.
|
||||
|
||||
**Query Parameters:**
|
||||
- `from_date`
|
||||
- `to_date`
|
||||
- `customer_id`
|
||||
- `license_id`
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"summary": {
|
||||
"total_licenses": 100,
|
||||
"active_licenses": 85,
|
||||
"total_activations": 250,
|
||||
"active_users": 1500
|
||||
},
|
||||
"usage_trends": [
|
||||
{
|
||||
"date": "2025-06-01",
|
||||
"active_users": 1200,
|
||||
"new_activations": 5
|
||||
}
|
||||
],
|
||||
"feature_usage": {
|
||||
"feature1": 50000,
|
||||
"feature2": 25000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Lead Management API
|
||||
|
||||
### Institutions
|
||||
|
||||
#### GET /api/institutions
|
||||
List all institutions.
|
||||
|
||||
**Query Parameters:**
|
||||
- `search`: Search term
|
||||
- `tags`: Comma-separated tags
|
||||
- `page`: Page number
|
||||
- `per_page`: Items per page
|
||||
|
||||
#### POST /api/institutions
|
||||
Create new institution.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"name": "Example University",
|
||||
"type": "university",
|
||||
"address": "123 Main St",
|
||||
"tags": ["education", "research"],
|
||||
"metadata": {
|
||||
"student_count": 5000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### GET /api/institutions/{id}
|
||||
Get institution details.
|
||||
|
||||
#### PUT /api/institutions/{id}
|
||||
Update institution.
|
||||
|
||||
#### DELETE /api/institutions/{id}
|
||||
Delete institution.
|
||||
|
||||
### Contact Persons
|
||||
|
||||
#### GET /api/institutions/{id}/contacts
|
||||
List contacts for institution.
|
||||
|
||||
#### POST /api/institutions/{id}/contacts
|
||||
Add contact to institution.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"name": "John Doe",
|
||||
"email": "john@example.com",
|
||||
"phone": "+1234567890",
|
||||
"position": "IT Manager",
|
||||
"is_primary": true
|
||||
}
|
||||
```
|
||||
|
||||
### Notes
|
||||
|
||||
#### GET /api/institutions/{id}/notes
|
||||
Get notes for institution.
|
||||
|
||||
#### POST /api/institutions/{id}/notes
|
||||
Add note to institution.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"content": "Discussed pricing options",
|
||||
"type": "meeting",
|
||||
"tags": ["sales", "followup"]
|
||||
}
|
||||
```
|
||||
|
||||
## Analytics API
|
||||
|
||||
### GET /api/v1/analytics/usage
|
||||
Get detailed usage analytics.
|
||||
|
||||
**Query Parameters:**
|
||||
- `from_date`: Start date (ISO 8601)
|
||||
- `to_date`: End date (ISO 8601)
|
||||
- `license_id`: Filter by license
|
||||
- `granularity`: hour, day, week, month
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"period": {
|
||||
"from": "2025-06-01T00:00:00Z",
|
||||
"to": "2025-06-19T23:59:59Z"
|
||||
},
|
||||
"metrics": {
|
||||
"total_heartbeats": 50000,
|
||||
"unique_activations": 150,
|
||||
"average_users_per_activation": 8.5,
|
||||
"peak_concurrent_users": 1200
|
||||
},
|
||||
"time_series": [
|
||||
{
|
||||
"timestamp": "2025-06-01T00:00:00Z",
|
||||
"active_users": 800,
|
||||
"heartbeat_count": 2500
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### GET /api/v1/analytics/features
|
||||
Get feature usage statistics.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"features": [
|
||||
{
|
||||
"name": "feature1",
|
||||
"total_usage": 150000,
|
||||
"unique_users": 500,
|
||||
"usage_trend": "increasing"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Common Response Codes
|
||||
|
||||
- `200 OK`: Successful request
|
||||
- `201 Created`: Resource created
|
||||
- `400 Bad Request`: Invalid request data
|
||||
- `401 Unauthorized`: Missing or invalid authentication
|
||||
- `403 Forbidden`: Insufficient permissions
|
||||
- `404 Not Found`: Resource not found
|
||||
- `409 Conflict`: Resource conflict (e.g., duplicate)
|
||||
- `429 Too Many Requests`: Rate limit exceeded
|
||||
- `500 Internal Server Error`: Server error
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
- Public API: 100 requests per minute per IP
|
||||
- Admin API: 1000 requests per minute per token
|
||||
- Heartbeat endpoint: 1 request per minute per activation
|
||||
|
||||
## Error Response Format
|
||||
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "INVALID_LICENSE",
|
||||
"message": "The provided license key is invalid",
|
||||
"details": {
|
||||
"field": "license_key",
|
||||
"reason": "format_invalid"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Client Integration Examples
|
||||
|
||||
### Python
|
||||
```python
|
||||
import requests
|
||||
import json
|
||||
|
||||
class LicenseClient:
|
||||
def __init__(self, base_url):
|
||||
self.base_url = base_url
|
||||
|
||||
def activate(self, license_key, hardware_id):
|
||||
response = requests.post(
|
||||
f"{self.base_url}/api/v1/activate",
|
||||
json={
|
||||
"license_key": license_key,
|
||||
"hardware_id": hardware_id,
|
||||
"machine_name": socket.gethostname(),
|
||||
"app_version": "1.0.0"
|
||||
}
|
||||
)
|
||||
return response.json()
|
||||
|
||||
def validate(self, license_key, activation_id, hardware_id):
|
||||
response = requests.post(
|
||||
f"{self.base_url}/api/v1/validate",
|
||||
json={
|
||||
"license_key": license_key,
|
||||
"activation_id": activation_id,
|
||||
"hardware_id": hardware_id,
|
||||
"app_version": "1.0.0"
|
||||
}
|
||||
)
|
||||
return response.json()
|
||||
```
|
||||
|
||||
### C# Example
|
||||
```csharp
|
||||
public class LicenseClient
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly string _baseUrl;
|
||||
|
||||
public LicenseClient(string baseUrl)
|
||||
{
|
||||
_baseUrl = baseUrl;
|
||||
_httpClient = new HttpClient();
|
||||
}
|
||||
|
||||
public async Task<ActivationResponse> ActivateAsync(
|
||||
string licenseKey,
|
||||
HardwareInfo hardwareId)
|
||||
{
|
||||
var request = new
|
||||
{
|
||||
license_key = licenseKey,
|
||||
hardware_id = hardwareId,
|
||||
machine_name = Environment.MachineName,
|
||||
app_version = "1.0.0"
|
||||
};
|
||||
|
||||
var response = await _httpClient.PostAsJsonAsync(
|
||||
$"{_baseUrl}/api/v1/activate",
|
||||
request
|
||||
);
|
||||
|
||||
return await response.Content.ReadFromJsonAsync<ActivationResponse>();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Webhooks
|
||||
|
||||
### Configuration
|
||||
Configure webhooks in the admin panel to receive notifications for:
|
||||
- License activation
|
||||
- License expiration
|
||||
- Suspicious activity
|
||||
- Usage threshold alerts
|
||||
|
||||
### Webhook Payload
|
||||
```json
|
||||
{
|
||||
"event": "license.activated",
|
||||
"timestamp": "2025-06-19T10:30:00Z",
|
||||
"data": {
|
||||
"license_id": 123,
|
||||
"activation_id": "act_456",
|
||||
"customer_id": 789
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
### Test Credentials
|
||||
- License Key: `TEST-TEST-TEST-TEST`
|
||||
- API Key: `test_api_key_123`
|
||||
- JWT Secret: `test_jwt_secret`
|
||||
|
||||
### Test Endpoints
|
||||
- Development: `http://localhost:8080`
|
||||
- Staging: `https://staging-api.example.com`
|
||||
- Production: `https://api.example.com`
|
||||
@@ -1,176 +0,0 @@
|
||||
# Lead-Management System - Dokumentation
|
||||
|
||||
## Übersicht
|
||||
Das Lead-Management System ist ein integriertes CRM-Modul für die Verwaltung potentieller Kunden (Leads). Es wurde mit einer zukunftssicheren Architektur entwickelt, die Erweiterungen ohne Refactoring ermöglicht.
|
||||
|
||||
## Zugang
|
||||
- **Kein Navbar-Eintrag** (bewusste Entscheidung)
|
||||
- Zugang über **"Leads" Button** auf der Kunden & Lizenzen Seite
|
||||
- URL: `/leads`
|
||||
|
||||
## Architektur-Prinzipien
|
||||
|
||||
### 1. **Modularer Aufbau**
|
||||
```
|
||||
leads/
|
||||
├── __init__.py # Blueprint Definition
|
||||
├── routes.py # HTTP Endpoints
|
||||
├── models.py # Datenmodelle
|
||||
├── services.py # Business Logic
|
||||
├── repositories.py # Datenbankzugriffe
|
||||
└── templates/leads/ # HTML Templates
|
||||
```
|
||||
|
||||
### 2. **Service Layer Pattern**
|
||||
```python
|
||||
# Klare Trennung von Präsentation und Logik
|
||||
class LeadService:
|
||||
def create_institution(self, name, user):
|
||||
# Validierung
|
||||
# Business Logic
|
||||
# Audit Log
|
||||
# Repository Aufruf
|
||||
```
|
||||
|
||||
### 3. **Repository Pattern**
|
||||
```python
|
||||
# Alle DB-Operationen gekapselt
|
||||
class LeadRepository:
|
||||
def get_institutions_with_counts(self):
|
||||
# Optimierte SQL Queries
|
||||
# Keine Business Logic
|
||||
```
|
||||
|
||||
### 4. **RESTful API Design**
|
||||
```
|
||||
GET /leads/api/institutions
|
||||
POST /leads/api/institutions
|
||||
PUT /leads/api/institutions/<id>
|
||||
GET /leads/api/contacts
|
||||
POST /leads/api/contacts
|
||||
PUT /leads/api/contacts/<id>
|
||||
POST /leads/api/contacts/<id>/phones
|
||||
POST /leads/api/contacts/<id>/emails
|
||||
POST /leads/api/contacts/<id>/notes
|
||||
PUT /leads/api/notes/<id>
|
||||
DELETE /leads/api/notes/<id>
|
||||
```
|
||||
|
||||
## Datenmodell
|
||||
|
||||
### Tabellen-Übersicht
|
||||
1. **lead_institutions** - Organisationen/Firmen
|
||||
2. **lead_contacts** - Kontaktpersonen
|
||||
3. **lead_contact_details** - Telefon/E-Mail (flexibel)
|
||||
4. **lead_notes** - Notizen mit Versionierung
|
||||
|
||||
### Erweiterbarkeit ohne Schema-Änderungen
|
||||
- **JSONB Felder**: `metadata` und `extra_fields` für zukünftige Attribute
|
||||
- **Flexible Details**: `detail_type` erlaubt neue Kontaktarten (social, etc.)
|
||||
- **Versionierte Notizen**: Vollständige Historie ohne Datenverlust
|
||||
|
||||
## Features
|
||||
|
||||
### Institutionen-Verwaltung
|
||||
- Einfache Erfassung (nur Name erforderlich)
|
||||
- Kontakt-Zähler in der Übersicht
|
||||
- Schnelle Suche
|
||||
- Umbenennung möglich
|
||||
|
||||
### Kontaktpersonen
|
||||
- Vorname, Nachname, Position (Freitext)
|
||||
- Verknüpfung mit Institution
|
||||
- Beliebig viele Telefonnummern
|
||||
- Beliebig viele E-Mail-Adressen
|
||||
- Labels für Kontaktdaten (Mobil, Geschäftlich, Privat)
|
||||
|
||||
### Notiz-System
|
||||
- **Historie**: Alle Notizen bleiben erhalten
|
||||
- **Versionierung**: Bearbeitungen erstellen neue Version
|
||||
- **Zeitstempel**: Automatisch bei Erstellung
|
||||
- **Benutzer-Tracking**: Wer hat was wann geschrieben
|
||||
- **Soft Delete**: Gelöschte Notizen bleiben in DB
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Migration anwenden
|
||||
```bash
|
||||
docker exec -it v2_adminpanel python apply_lead_migration.py
|
||||
```
|
||||
|
||||
### 2. Verfügbare Tabellen prüfen
|
||||
```sql
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_name LIKE 'lead_%';
|
||||
```
|
||||
|
||||
## Verwendung
|
||||
|
||||
### Workflow
|
||||
1. **Institution anlegen** (z.B. "Musterfirma GmbH")
|
||||
2. **Kontakte hinzufügen** (Geschäftsführer, Vertrieb, etc.)
|
||||
3. **Kontaktdaten pflegen** (Telefon, E-Mail)
|
||||
4. **Notizen erfassen** (Gesprächsnotizen, Kontext)
|
||||
|
||||
### Typische Szenarien
|
||||
- **Messe-Kontakte**: Schnelle Erfassung vor Ort
|
||||
- **Follow-Up**: Notizen zu Gesprächen
|
||||
- **Kontakt-Historie**: Wer wurde wann getroffen
|
||||
|
||||
## Technische Details
|
||||
|
||||
### Audit-Trail Integration
|
||||
Alle Aktionen werden automatisch geloggt:
|
||||
- `lead.institution.create`
|
||||
- `lead.contact.create`
|
||||
- `lead.contact.update`
|
||||
- `lead.contact.note.add`
|
||||
- etc.
|
||||
|
||||
### Performance-Optimierungen
|
||||
- Indizes auf häufig gesuchten Feldern
|
||||
- Eager Loading für Kontakt-Details
|
||||
- Optimierte Queries mit COUNT für Übersichten
|
||||
|
||||
### Sicherheit
|
||||
- SQL Injection Prevention durch Parameterized Queries
|
||||
- XSS Prevention durch Template Escaping
|
||||
- CSRF Protection durch Flask-WTF
|
||||
- Zugangskontrolle durch Login-Requirement
|
||||
|
||||
## Zukünftige Erweiterungen (ohne Breaking Changes)
|
||||
|
||||
### Mögliche Features
|
||||
1. **Tags/Labels** für Institutionen (via metadata JSONB)
|
||||
2. **Lead-Status** (Interessent, Verhandlung, etc.)
|
||||
3. **Dokumente anhängen** (neue Tabelle lead_documents)
|
||||
4. **Import/Export** (CSV, Excel)
|
||||
5. **Duplikat-Erkennung** bei E-Mail/Telefon
|
||||
6. **Konvertierung zu Kunde** (One-Click)
|
||||
|
||||
### Event-System Ready
|
||||
```python
|
||||
# Vorbereitet für lose Kopplung
|
||||
lead_events.publish('contact.created', contact_data)
|
||||
# Andere Services können darauf reagieren
|
||||
```
|
||||
|
||||
## Wichtige Hinweise
|
||||
|
||||
### Trennung von Kunden-System
|
||||
- **Keine Verknüpfung** zu existierenden Kunden
|
||||
- **Eigene Tabellen** mit `lead_` Prefix
|
||||
- **Eigene Navigation** (kein Navbar-Eintrag)
|
||||
- **Unabhängige Entwicklung** möglich
|
||||
|
||||
### Best Practices
|
||||
1. **Notizen nutzen**: Kontext ist wichtig
|
||||
2. **Labels vergeben**: Mobil vs. Geschäftlich
|
||||
3. **Position ausfüllen**: Hilft bei Priorisierung
|
||||
4. **Regelmäßig pflegen**: Aktuelle Daten sind wertvoll
|
||||
|
||||
## Stand: 19.06.2025 - 15:07 Uhr
|
||||
✅ Vollständig implementiert und einsatzbereit
|
||||
✅ Refactoring-freie Architektur
|
||||
✅ Erweiterbar ohne Breaking Changes
|
||||
✅ Performance-optimiert
|
||||
981
LIZENZSERVER.md
981
LIZENZSERVER.md
@@ -1,981 +0,0 @@
|
||||
# Lizenzserver - Architektur & Implementierungsplan
|
||||
|
||||
## Übersicht
|
||||
Der Lizenzserver ist das zentrale Herzstück des v2-Docker Systems, das für die Validierung, Verwaltung und Überwachung aller Lizenzen verantwortlich ist. Diese Dokumentation beschreibt eine zukunftssichere Architektur, die von Anfang an auf Skalierbarkeit, Wartbarkeit und Erweiterbarkeit ausgelegt ist.
|
||||
|
||||
## Architektur-Prinzipien (Kein Refactoring nötig!)
|
||||
|
||||
### 1. **Klare Trennung von Anfang an**
|
||||
- **API Layer**: Strikte Trennung zwischen Public API (Clients) und Admin API
|
||||
- **Business Logic**: Zentral in Service-Klassen, nicht in Routes
|
||||
- **Data Access**: Repository Pattern für alle DB-Zugriffe
|
||||
- **No Spaghetti Code**: Keine Vermischung von Präsentation und Logik
|
||||
|
||||
### 2. **Konsistente Namenskonventionen**
|
||||
```python
|
||||
# Datenbank-Felder (snake_case, eindeutig)
|
||||
is_active # NICHT: active
|
||||
hardware_id # NICHT: device_id
|
||||
created_at # NICHT: created
|
||||
updated_at # NICHT: updated
|
||||
is_test # NICHT: test
|
||||
|
||||
# API Responses (camelCase für JSON)
|
||||
{
|
||||
"licenseId": "uuid",
|
||||
"isActive": true,
|
||||
"hardwareId": "hash",
|
||||
"createdAt": "2025-01-18T10:00:00Z"
|
||||
}
|
||||
|
||||
# Python (snake_case)
|
||||
def validate_license(license_key: str, hardware_id: str) -> dict:
|
||||
pass
|
||||
```
|
||||
|
||||
### 3. **Modulare Service-Architektur**
|
||||
```python
|
||||
# services/license_service.py
|
||||
class LicenseService:
|
||||
def __init__(self, db_repo, cache_repo, event_bus):
|
||||
self.db = db_repo
|
||||
self.cache = cache_repo
|
||||
self.events = event_bus
|
||||
|
||||
def validate_license(self, key, hw_id):
|
||||
# Business Logic hier, NICHT in Routes!
|
||||
pass
|
||||
|
||||
# routes/api_routes.py
|
||||
@api.route('/validate')
|
||||
def validate():
|
||||
# NUR Request handling, keine Business Logic
|
||||
data = request.get_json()
|
||||
result = license_service.validate_license(
|
||||
data['licenseKey'],
|
||||
data['hardwareId']
|
||||
)
|
||||
return jsonify(result)
|
||||
```
|
||||
|
||||
### 4. **Event-Driven Architecture**
|
||||
```python
|
||||
# Lose Kopplung durch Events
|
||||
class EventBus:
|
||||
def publish(self, event_type, data):
|
||||
# Analytics Service hört zu
|
||||
# Audit Service hört zu
|
||||
# Email Service hört zu
|
||||
pass
|
||||
|
||||
# Neue Features = Neue Listener, kein Code ändern!
|
||||
```
|
||||
|
||||
### 5. **Klare API-Struktur**
|
||||
```
|
||||
/api/license/validate # Einheitliche API ohne Versionierung
|
||||
/api/license/activate # Konsistente Endpoints
|
||||
/api/admin/license/status # Klare Trennung Admin vs. Public
|
||||
```
|
||||
|
||||
### 6. **Feature Flags von Anfang an**
|
||||
```python
|
||||
if feature_flags.is_enabled('anomaly_detection'):
|
||||
anomaly_service.check(license_id)
|
||||
# Neue Features ohne Deployment aktivieren
|
||||
```
|
||||
|
||||
### 7. **Dependency Injection**
|
||||
```python
|
||||
# Keine harten Dependencies!
|
||||
def create_app(config):
|
||||
db = Database(config.db_url)
|
||||
cache = Redis(config.redis_url)
|
||||
|
||||
# Services bekommen Dependencies injiziert
|
||||
license_service = LicenseService(db, cache)
|
||||
|
||||
# Routes bekommen Services injiziert
|
||||
api_blueprint = create_api_routes(license_service)
|
||||
|
||||
app.register_blueprint(api_blueprint)
|
||||
return app
|
||||
```
|
||||
|
||||
### 8. **Klare Verzeichnisstruktur**
|
||||
```
|
||||
lizenzserver/
|
||||
├── api/
|
||||
│ ├── v1/
|
||||
│ │ ├── routes/
|
||||
│ │ ├── schemas/ # Validation schemas
|
||||
│ │ └── middleware/
|
||||
│ └── v2/
|
||||
├── services/ # Business Logic
|
||||
│ ├── license_service.py
|
||||
│ ├── analytics_service.py
|
||||
│ └── anomaly_service.py
|
||||
├── repositories/ # Data Access
|
||||
│ ├── license_repo.py
|
||||
│ └── cache_repo.py
|
||||
├── models/ # Domain Models
|
||||
├── events/ # Event System
|
||||
├── utils/ # Helpers
|
||||
└── tests/ # Umfassende Tests!
|
||||
```
|
||||
|
||||
### 9. **Database Migrations von Anfang an**
|
||||
```python
|
||||
# Alembic/Flyway für versioned migrations
|
||||
# NIEMALS manuelle SQL changes!
|
||||
alembic revision -m "add_anomaly_detection_table"
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
### 10. **Dokumentation als Code**
|
||||
```python
|
||||
# OpenAPI/Swagger von Anfang an
|
||||
from flask_restx import Api, Resource, fields
|
||||
|
||||
api = Api(doc='/docs')
|
||||
|
||||
@api.route('/license/validate')
|
||||
class LicenseValidation(Resource):
|
||||
@api.doc('validate_license')
|
||||
@api.expect(license_model)
|
||||
@api.marshal_with(validation_result)
|
||||
def post(self):
|
||||
"""Validate a license key with hardware ID"""
|
||||
pass
|
||||
```
|
||||
|
||||
## Kernfunktionen
|
||||
|
||||
### 1. Lizenzvalidierung
|
||||
- **Online-Validierung**: Echtzeit-Prüfung von Lizenzen
|
||||
- **Offline-Grace-Period**: 72h Offline-Betrieb mit gecachten Tokens
|
||||
- **Hardware-Binding**: Geräte-spezifische Lizenzierung
|
||||
- **Multi-Device-Support**: Verwaltung mehrerer Geräte pro Lizenz
|
||||
|
||||
### 2. Aktivierungsmanagement
|
||||
- **Erste Aktivierung**: Hardware-ID Registrierung
|
||||
- **Re-Aktivierung**: Bei Hardware-Wechsel
|
||||
- **Deaktivierung**: Manuell oder automatisch
|
||||
- **Transfer**: Lizenz auf neues Gerät übertragen
|
||||
|
||||
### 3. Nutzungsüberwachung
|
||||
- **Heartbeat-System**: Regelmäßige Lebenszeichen
|
||||
- **Usage-Tracking**: Detaillierte Nutzungsstatistiken
|
||||
- **Anomalie-Erkennung**: Verdächtige Aktivitäten
|
||||
- **Concurrent-Use-Prevention**: Mehrfachnutzung verhindern
|
||||
|
||||
## Architektur-Design
|
||||
|
||||
### Microservices-Ansatz
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Load Balancer │
|
||||
│ (HAProxy/Nginx) │
|
||||
└────────────┬────────────────┬────────────────┬─────────┘
|
||||
│ │ │
|
||||
┌───────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐
|
||||
│ Auth Service │ │License API │ │ Analytics │
|
||||
│ (JWT) │ │ Service │ │ Service │
|
||||
└───────┬──────┘ └──────┬──────┘ └──────┬──────┘
|
||||
│ │ │
|
||||
┌───────▼────────────────▼────────────────▼──────┐
|
||||
│ Message Queue (RabbitMQ) │
|
||||
└─────────────────────┬───────────────────────────┘
|
||||
│
|
||||
┌─────────────────────▼───────────────────────────┐
|
||||
│ Database Cluster (PostgreSQL) │
|
||||
│ Master-Slave Replication │
|
||||
└─────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Service-Trennung
|
||||
|
||||
#### 1. **Auth Service** (Port 5001)
|
||||
- JWT Token Generation/Validation
|
||||
- API Key Management
|
||||
- Rate Limiting
|
||||
- IP Whitelisting
|
||||
|
||||
#### 2. **License API Service** (Port 5002)
|
||||
- License Validation Endpoints
|
||||
- Activation/Deactivation
|
||||
- Device Management
|
||||
- License Status Queries
|
||||
|
||||
#### 3. **Analytics Service** (Port 5003)
|
||||
- Usage Statistics
|
||||
- Performance Metrics
|
||||
- Anomaly Detection
|
||||
- Report Generation
|
||||
|
||||
#### 4. **Admin API Service** (Port 5004)
|
||||
- CRUD Operations
|
||||
- Batch Processing
|
||||
- System Configuration
|
||||
- Audit Logging
|
||||
|
||||
## Datenbankschema (Erweiterung)
|
||||
|
||||
### Neue Tabellen
|
||||
|
||||
```sql
|
||||
-- Lizenz-Token für Offline-Validierung
|
||||
CREATE TABLE license_tokens (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
license_id UUID REFERENCES licenses(id) ON DELETE CASCADE,
|
||||
token VARCHAR(512) NOT NULL UNIQUE,
|
||||
hardware_id VARCHAR(255) NOT NULL,
|
||||
valid_until TIMESTAMP NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
last_validated TIMESTAMP,
|
||||
validation_count INTEGER DEFAULT 0,
|
||||
INDEX idx_token (token),
|
||||
INDEX idx_hardware (hardware_id),
|
||||
INDEX idx_valid_until (valid_until)
|
||||
);
|
||||
|
||||
-- Heartbeat-Tracking
|
||||
CREATE TABLE license_heartbeats (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
license_id UUID REFERENCES licenses(id) ON DELETE CASCADE,
|
||||
hardware_id VARCHAR(255) NOT NULL,
|
||||
ip_address INET,
|
||||
user_agent VARCHAR(500),
|
||||
app_version VARCHAR(50),
|
||||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
session_data JSONB,
|
||||
INDEX idx_license_time (license_id, timestamp DESC),
|
||||
INDEX idx_hardware_time (hardware_id, timestamp DESC)
|
||||
) PARTITION BY RANGE (timestamp);
|
||||
|
||||
-- Aktivierungs-Events
|
||||
CREATE TABLE activation_events (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
license_id UUID REFERENCES licenses(id) ON DELETE CASCADE,
|
||||
event_type VARCHAR(50) NOT NULL, -- 'activation', 'deactivation', 'reactivation', 'transfer'
|
||||
hardware_id VARCHAR(255),
|
||||
previous_hardware_id VARCHAR(255),
|
||||
ip_address INET,
|
||||
user_agent VARCHAR(500),
|
||||
success BOOLEAN DEFAULT true,
|
||||
error_message TEXT,
|
||||
metadata JSONB,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_license_events (license_id, created_at DESC),
|
||||
INDEX idx_event_type (event_type, created_at DESC)
|
||||
);
|
||||
|
||||
-- API Rate Limiting
|
||||
CREATE TABLE api_rate_limits (
|
||||
id SERIAL PRIMARY KEY,
|
||||
api_key VARCHAR(255) NOT NULL UNIQUE,
|
||||
requests_per_minute INTEGER DEFAULT 60,
|
||||
requests_per_hour INTEGER DEFAULT 1000,
|
||||
requests_per_day INTEGER DEFAULT 10000,
|
||||
burst_size INTEGER DEFAULT 100,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Anomalie-Erkennung
|
||||
CREATE TABLE anomaly_detections (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
license_id UUID REFERENCES licenses(id),
|
||||
anomaly_type VARCHAR(100) NOT NULL, -- 'multiple_ips', 'rapid_hardware_change', 'suspicious_pattern'
|
||||
severity VARCHAR(20) NOT NULL, -- 'low', 'medium', 'high', 'critical'
|
||||
details JSONB NOT NULL,
|
||||
detected_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
resolved BOOLEAN DEFAULT false,
|
||||
resolved_at TIMESTAMP,
|
||||
resolved_by VARCHAR(255),
|
||||
action_taken TEXT,
|
||||
INDEX idx_unresolved (resolved, severity, detected_at DESC),
|
||||
INDEX idx_license_anomalies (license_id, detected_at DESC)
|
||||
);
|
||||
```
|
||||
|
||||
## Neue Service-Endpunkte (18.06.2025)
|
||||
|
||||
### Analytics Service API (Port 5003)
|
||||
```yaml
|
||||
# Usage Statistics
|
||||
GET /api/v1/analytics/usage
|
||||
Query: days, customer_id
|
||||
Response: Daily usage trends with active licenses/devices
|
||||
|
||||
# Performance Metrics
|
||||
GET /api/v1/analytics/performance
|
||||
Query: days
|
||||
Response: Hourly performance metrics
|
||||
|
||||
# Anomaly Statistics
|
||||
GET /api/v1/analytics/anomalies
|
||||
Query: days
|
||||
Response: Anomaly breakdown by type and severity
|
||||
|
||||
# License Distribution
|
||||
GET /api/v1/analytics/distribution
|
||||
Response: License distribution by type and status
|
||||
|
||||
# Revenue Impact
|
||||
GET /api/v1/analytics/revenue
|
||||
Query: days
|
||||
Response: Revenue analysis by license type
|
||||
|
||||
# Geographic Distribution
|
||||
GET /api/v1/analytics/geographic
|
||||
Response: Top 100 locations by usage
|
||||
|
||||
# Usage Patterns
|
||||
GET /api/v1/analytics/patterns
|
||||
Query: license_id (optional)
|
||||
Response: Hourly/daily usage patterns
|
||||
|
||||
# Churn Risk Analysis
|
||||
GET /api/v1/analytics/churn-risk
|
||||
Response: Customers sorted by churn risk
|
||||
|
||||
# Customer Summary
|
||||
GET /api/v1/analytics/summary/{customer_id}
|
||||
Response: Comprehensive customer analytics
|
||||
|
||||
# Real-time Stats
|
||||
GET /api/v1/analytics/realtime
|
||||
Response: Current live statistics
|
||||
```
|
||||
|
||||
### Admin API Service (Port 5004)
|
||||
```yaml
|
||||
# License Management
|
||||
GET /api/v1/admin/licenses
|
||||
Query: page, per_page, customer_id, is_active, license_type
|
||||
POST /api/v1/admin/licenses
|
||||
GET /api/v1/admin/licenses/{id}
|
||||
PUT /api/v1/admin/licenses/{id}
|
||||
DELETE /api/v1/admin/licenses/{id}
|
||||
|
||||
# Batch Operations
|
||||
POST /api/v1/admin/licenses/batch
|
||||
POST /api/v1/admin/licenses/batch/activate
|
||||
|
||||
# Device Management
|
||||
GET /api/v1/admin/licenses/{id}/devices
|
||||
DELETE /api/v1/admin/licenses/{id}/devices/{hardware_id}
|
||||
|
||||
# Customer Management
|
||||
GET /api/v1/admin/customers
|
||||
Query: page, per_page, search
|
||||
|
||||
# Configuration
|
||||
GET /api/v1/admin/config/feature-flags
|
||||
PUT /api/v1/admin/config/feature-flags/{id}
|
||||
|
||||
# API Key Management
|
||||
GET /api/v1/admin/api-keys
|
||||
POST /api/v1/admin/api-keys
|
||||
|
||||
# Audit Log
|
||||
GET /api/v1/admin/audit-log
|
||||
Query: page, per_page, action, username, start_date, end_date
|
||||
|
||||
# System Statistics
|
||||
GET /api/v1/admin/stats/overview
|
||||
```
|
||||
|
||||
## API-Endpunkte
|
||||
|
||||
### Public API (Client-Software)
|
||||
|
||||
```yaml
|
||||
# Lizenz-Validierung
|
||||
POST /api/v1/license/validate
|
||||
Headers:
|
||||
X-API-Key: {client_api_key}
|
||||
Body:
|
||||
license_key: string
|
||||
hardware_id: string
|
||||
app_version: string
|
||||
|
||||
# Aktivierung
|
||||
POST /api/v1/license/activate
|
||||
Headers:
|
||||
X-API-Key: {client_api_key}
|
||||
Body:
|
||||
license_key: string
|
||||
hardware_id: string
|
||||
device_name: string
|
||||
os_info: object
|
||||
|
||||
# Heartbeat
|
||||
POST /api/v1/license/heartbeat
|
||||
Headers:
|
||||
Authorization: Bearer {token}
|
||||
Body:
|
||||
session_data: object
|
||||
|
||||
# Offline-Token anfordern
|
||||
POST /api/v1/license/offline-token
|
||||
Headers:
|
||||
Authorization: Bearer {token}
|
||||
Body:
|
||||
duration_hours: number (max: 72)
|
||||
```
|
||||
|
||||
### Admin API (Admin Panel)
|
||||
|
||||
```yaml
|
||||
# Lizenz-Details mit Echtzeit-Status
|
||||
GET /api/v1/admin/license/{id}/status
|
||||
Response:
|
||||
license_info: object
|
||||
active_devices: array
|
||||
recent_activity: array
|
||||
anomalies: array
|
||||
|
||||
# Geräte-Management
|
||||
DELETE /api/v1/admin/license/{id}/device/{hardware_id}
|
||||
POST /api/v1/admin/license/{id}/transfer
|
||||
Body:
|
||||
from_hardware_id: string
|
||||
to_hardware_id: string
|
||||
|
||||
# Anomalie-Management
|
||||
GET /api/v1/admin/anomalies
|
||||
PATCH /api/v1/admin/anomaly/{id}/resolve
|
||||
```
|
||||
|
||||
## Sicherheitskonzepte
|
||||
|
||||
### 1. **Token-Strategie**
|
||||
```python
|
||||
# JWT Token Struktur
|
||||
{
|
||||
"sub": "license_id",
|
||||
"hwid": "hardware_id",
|
||||
"exp": timestamp,
|
||||
"iat": timestamp,
|
||||
"features": ["feature1", "feature2"],
|
||||
"limits": {
|
||||
"api_calls": 1000,
|
||||
"concurrent_sessions": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. **Rate Limiting**
|
||||
- Per API Key
|
||||
- Per License
|
||||
- Per IP Address
|
||||
- Sliding Window Algorithm
|
||||
|
||||
### 3. **Encryption**
|
||||
- License Keys: AES-256-GCM
|
||||
- API Communication: TLS 1.3
|
||||
- Database: Transparent Data Encryption
|
||||
- Backups: GPG Encryption
|
||||
|
||||
## Monitoring & Observability
|
||||
|
||||
### Metriken (Prometheus)
|
||||
```yaml
|
||||
# Business Metrics
|
||||
license_validations_total
|
||||
license_activations_total
|
||||
active_licenses_gauge
|
||||
license_revenue_total
|
||||
|
||||
# Technical Metrics
|
||||
api_request_duration_seconds
|
||||
database_query_duration_seconds
|
||||
cache_hit_ratio
|
||||
error_rate
|
||||
```
|
||||
|
||||
### Logging (ELK Stack)
|
||||
```json
|
||||
{
|
||||
"timestamp": "2025-01-18T10:00:00Z",
|
||||
"level": "INFO",
|
||||
"service": "license-api",
|
||||
"trace_id": "uuid",
|
||||
"event": "license_validation",
|
||||
"license_id": "uuid",
|
||||
"hardware_id": "hash",
|
||||
"result": "success",
|
||||
"duration_ms": 23
|
||||
}
|
||||
```
|
||||
|
||||
### Alerting
|
||||
- License-Abuse Detection
|
||||
- System Health Checks
|
||||
- Performance Degradation
|
||||
- Security Incidents
|
||||
|
||||
## Skalierungsstrategien
|
||||
|
||||
### Horizontal Scaling
|
||||
1. **Stateless Services**: Alle Services zustandslos
|
||||
2. **Load Balancing**: Round-Robin mit Health Checks
|
||||
3. **Auto-Scaling**: CPU/Memory basiert
|
||||
4. **Database Read Replicas**: Für Read-Heavy Operations
|
||||
|
||||
### Caching-Strategie
|
||||
```yaml
|
||||
Cache-Layer:
|
||||
- Redis Cluster
|
||||
- TTL: 5 Minuten für Validierungen
|
||||
- Invalidation: Event-basiert
|
||||
|
||||
Cache-Keys:
|
||||
- license:{id}:status
|
||||
- license:{id}:devices
|
||||
- hardware:{id}:licenses
|
||||
- token:{token}:valid
|
||||
```
|
||||
|
||||
### Queue-basierte Verarbeitung
|
||||
- Heartbeat Processing
|
||||
- Email Notifications
|
||||
- Report Generation
|
||||
- Batch Operations
|
||||
|
||||
## Implementierungs-Roadmap
|
||||
|
||||
### Phase 1: Foundation (Woche 1-2) ✅ ERLEDIGT
|
||||
- [x] Docker-Setup für alle Services
|
||||
- [x] Basis-Datenbankschema
|
||||
- [x] JWT Authentication
|
||||
- [x] Basis API-Endpoints
|
||||
|
||||
### Phase 2: Core Features (Woche 3-4) ✅ ERLEDIGT
|
||||
- [x] License Validation Logic
|
||||
- [x] Device Management
|
||||
- [x] Heartbeat System
|
||||
- [x] Admin API
|
||||
|
||||
### Phase 3: Advanced Features (Woche 5-6) 🚧 IN ARBEIT
|
||||
- [x] Offline Token System
|
||||
- [x] Anomaly Detection (Basis)
|
||||
- [ ] Analytics Service (Detailliert)
|
||||
- [ ] Monitoring Setup (Prometheus)
|
||||
|
||||
### Phase 4: Optimization (Woche 7-8) 📋 GEPLANT
|
||||
- [x] Caching Layer (Redis implementiert)
|
||||
- [ ] Performance Tuning
|
||||
- [ ] Load Testing
|
||||
- [ ] Documentation
|
||||
|
||||
## Aktueller Implementierungsstand (Stand: 18.06.2025 - UPDATED)
|
||||
|
||||
### ✅ Fertiggestellte Komponenten:
|
||||
|
||||
#### 1. **Microservices-Architektur**
|
||||
- **Auth Service** (Port 5001): JWT-Token-Generierung und -Validierung ✅
|
||||
- **License API Service** (Port 5002): Lizenzvalidierung, Aktivierung, Heartbeat ✅
|
||||
- **Analytics Service** (Port 5003): Umfassende Analyse-Funktionen ✅ NEU!
|
||||
- **Admin API Service** (Port 5004): CRUD-Operationen und Batch-Processing ✅ NEU!
|
||||
- **Docker Compose**: Vollständiges Setup mit Redis, RabbitMQ, PostgreSQL ✅
|
||||
- **Netzwerk**: Gemeinsames `internal_net` für Service-Kommunikation ✅
|
||||
|
||||
#### 2. **Datenbank-Erweiterungen**
|
||||
Alle neuen Tabellen wurden erfolgreich implementiert:
|
||||
- `license_tokens` - Offline-Validierung mit Token-Management
|
||||
- `license_heartbeats` - Partitionierte Tabelle für Heartbeat-Tracking
|
||||
- `activation_events` - Vollständige Aktivierungshistorie
|
||||
- `anomaly_detections` - Anomalie-Tracking mit Severity-Levels
|
||||
- `api_clients` & `api_rate_limits` - API-Key-Verwaltung
|
||||
- `feature_flags` - Feature Toggle System
|
||||
- `active_sessions` - Session-Management für Concurrent-Use-Prevention
|
||||
|
||||
#### 3. **Repository Pattern & Services**
|
||||
- `BaseRepository`: Abstrakte Basis für DB-Operationen
|
||||
- `LicenseRepository`: Spezifische Lizenz-Operationen
|
||||
- `CacheRepository`: Redis-Integration für Performance
|
||||
- `EventBus`: RabbitMQ-basiertes Event-System für lose Kopplung
|
||||
|
||||
#### 4. **API Endpoints (Implementiert)**
|
||||
##### Public API:
|
||||
- `POST /api/v1/license/validate` - Online-Lizenzvalidierung
|
||||
- `POST /api/v1/license/activate` - Lizenzaktivierung auf neuem Gerät
|
||||
- `POST /api/v1/license/heartbeat` - Heartbeat für aktive Sessions
|
||||
- `POST /api/v1/license/offline-token` - Offline-Token-Generierung
|
||||
- `POST /api/v1/license/validate-offline` - Offline-Token-Validierung
|
||||
|
||||
##### Auth API:
|
||||
- `POST /api/v1/auth/token` - Access Token generieren
|
||||
- `POST /api/v1/auth/refresh` - Token erneuern
|
||||
- `POST /api/v1/auth/verify` - Token verifizieren
|
||||
- `POST /api/v1/auth/api-key` - API-Key erstellen (Admin)
|
||||
|
||||
#### 5. **Admin Panel Integration**
|
||||
Neuer Menüpunkt "Lizenzserver" mit folgenden Unterseiten:
|
||||
- **Live Monitor** (`/lizenzserver/monitor`): ✅
|
||||
- Echtzeit-Statistiken (aktive Lizenzen, Validierungen/Min)
|
||||
- Top 10 aktive Lizenzen
|
||||
- Aktuelle Anomalien
|
||||
- Validierungs-Timeline mit Chart.js
|
||||
- **Analytics** (`/lizenzserver/analytics`): ✅ FERTIG!
|
||||
- Integration mit Analytics Service API
|
||||
- Nutzungstrends und Performance-Metriken
|
||||
- Revenue Analysis und Churn Risk
|
||||
- Interaktive Charts mit Chart.js
|
||||
- **Anomalien** (`/lizenzserver/anomalies`): ✅
|
||||
- Anomalie-Liste mit Filterung
|
||||
- Anomalie-Resolution mit Audit-Log
|
||||
- **Konfiguration** (`/lizenzserver/config`): ✅
|
||||
- Feature Flag Management
|
||||
- API Client Verwaltung
|
||||
- Rate Limit Konfiguration
|
||||
|
||||
#### 6. **Integration in Kunden & Lizenzen Übersicht**
|
||||
- Neue Spalte "Server Status" zeigt:
|
||||
- 💚 Online (aktive Heartbeats in letzten 5 Min)
|
||||
- ⏱️ X Min (letzte Aktivität)
|
||||
- 💤 Offline (länger als 1h inaktiv)
|
||||
- ⚠️ Anzahl ungelöster Anomalien
|
||||
|
||||
### ✅ NEU: Fertiggestellte Services (18.06.2025):
|
||||
|
||||
1. **Analytics Service** (Port 5003) ✅ FERTIG!
|
||||
- Vollständige Implementierung mit allen geplanten Features:
|
||||
- Usage Statistics API
|
||||
- Performance Metrics
|
||||
- Anomaly Statistics
|
||||
- Revenue Impact Analysis
|
||||
- Geographic Distribution
|
||||
- Usage Patterns & Churn Risk Calculation
|
||||
- Integration in Admin Panel Analytics-Seite
|
||||
- JWT-basierte Authentifizierung
|
||||
- Redis-Caching für Performance
|
||||
|
||||
2. **Admin API Service** (Port 5004) ✅ FERTIG!
|
||||
- Vollständige CRUD-API für License Management:
|
||||
- License CRUD mit Pagination und Filterung
|
||||
- Batch-Operationen (Bulk Create/Update)
|
||||
- Customer Management API
|
||||
- Device Management
|
||||
- Feature Flag Management
|
||||
- API Key Management
|
||||
- Audit Log API
|
||||
- System Overview Statistics
|
||||
- JWT-basierte Admin-Authentifizierung
|
||||
- Comprehensive Audit Logging
|
||||
|
||||
### ✅ UPDATE: Monitoring für PoC optimiert (19.06.2025)
|
||||
|
||||
**Entscheidung**: Prometheus/Grafana/Alertmanager wurden für die PoC-Phase entfernt
|
||||
- Spart ~3GB RAM und vereinfacht das Setup erheblich
|
||||
- Alle wichtigen Monitoring-Features bleiben über das Admin Panel verfügbar
|
||||
- Für Production-Deployment später einfach wieder aktivierbar
|
||||
|
||||
**Integriertes Monitoring im Admin Panel**:
|
||||
1. **Live Dashboard** (/monitoring/live-dashboard)
|
||||
- Echtzeit-Anzeige aktiver Sessions
|
||||
- Validierungsstatistiken
|
||||
- Direkte Datenbankabfragen
|
||||
|
||||
2. **System Status** (/monitoring/system-status)
|
||||
- Service Health Checks
|
||||
- Response Time Monitoring
|
||||
- Keine externen Dependencies
|
||||
|
||||
3. **Analytics** (/monitoring/analytics)
|
||||
- Kombiniert aus Lizenzserver Status + Analytics
|
||||
- Echte Statistiken statt Demo-Daten
|
||||
- Auto-Refresh alle 30 Sekunden
|
||||
- Basis-Metriken ohne Pricing
|
||||
|
||||
### ✅ UPDATE: License Heartbeats & Dashboard-Konsolidierung (19.06.2025 - 13:15 Uhr)
|
||||
|
||||
**Implementierte Verbesserungen**:
|
||||
|
||||
1. **License Heartbeats Tabelle erstellt**:
|
||||
- Partitionierte Tabellenstruktur für optimale Performance
|
||||
- Monatliche Partitionen für effiziente Datenverwaltung
|
||||
- Migration-Script bereitgestellt: `apply_license_heartbeats_migration.py`
|
||||
- Unterstützt Echtzeit-Tracking von Lizenznutzung
|
||||
|
||||
2. **Dashboard-Konsolidierung**:
|
||||
- Live Dashboard & Analytics zu einer umfassenden Ansicht kombiniert
|
||||
- 3-Tab-Interface: Übersicht, Sessions, Analytics
|
||||
- Alle Monitoring-Features zentral verfügbar
|
||||
- Export-Funktionen für Reporting integriert
|
||||
|
||||
3. **Finale Navigation**:
|
||||
```
|
||||
📊 Monitoring → (Live Dashboard & Analytics)
|
||||
├── System Status
|
||||
└── Lizenz-Anomalien
|
||||
|
||||
🔧 Administration → (Lizenzserver Config)
|
||||
├── Audit-Log
|
||||
├── Backups
|
||||
└── Gesperrte IPs
|
||||
```
|
||||
|
||||
**Technische Details**:
|
||||
- Heartbeats-Tabelle mit automatischer Partition-Verwaltung
|
||||
- Performance-optimierte Indizes für schnelle Abfragen
|
||||
- Nahtlose Integration vorhandener Analytics-Features
|
||||
- Keine redundanten Menüpunkte mehr
|
||||
|
||||
### ✅ UPDATE: Navigation komplett überarbeitet (19.06.2025 - 12:46 Uhr)
|
||||
|
||||
**Verbesserungen der Admin Panel Navigation**:
|
||||
|
||||
1. **Fehler behoben**:
|
||||
- 500 Fehler auf /live-dashboard durch korrigierte DB-Abfragen
|
||||
- Session-Route-Referenzen korrigiert
|
||||
|
||||
2. **Navigation aufgeräumt**:
|
||||
- "Admin Sessions" entfernt (nicht benötigt)
|
||||
- "Alerts & Anomalien" entfernt (redundant)
|
||||
- "Lizenzserver Status" + "Analytics" zusammengeführt
|
||||
- Grafana-Links entfernt
|
||||
|
||||
3. **Neue Struktur**:
|
||||
```
|
||||
📊 Monitoring → (Live Dashboard)
|
||||
├── System Status
|
||||
├── Lizenz-Anomalien
|
||||
└── Analytics (kombiniert)
|
||||
|
||||
🔧 Administration → (Lizenzserver Config)
|
||||
├── Audit-Log
|
||||
├── Backups
|
||||
└── Gesperrte IPs
|
||||
```
|
||||
|
||||
4. **Vorteile**:
|
||||
- Intuitive Navigation ohne Redundanzen
|
||||
- Klare Trennung: Monitoring vs. Administration
|
||||
- Direkte Links zu Hauptfunktionen (kein unnötiges Klicken)
|
||||
|
||||
### ✅ UPDATE: Lead-Management System implementiert (19.06.2025 - 15:07 Uhr)
|
||||
|
||||
**Neues CRM-Modul für potentielle Kunden**:
|
||||
|
||||
1. **Architektur**:
|
||||
- Separates `leads` Modul mit eigenem Blueprint
|
||||
- Service Layer & Repository Pattern
|
||||
- RESTful API von Anfang an
|
||||
- Kein Refactoring nötig durch JSONB-Felder
|
||||
|
||||
2. **Features**:
|
||||
- Institutionen-Verwaltung (nur Name erforderlich)
|
||||
- Kontaktpersonen mit flexiblen Details
|
||||
- Mehrere Telefonnummern/E-Mails pro Person
|
||||
- Versionierte Notiz-Historie mit Zeitstempel
|
||||
- Vollständige Audit-Trail Integration
|
||||
|
||||
3. **Zugang**:
|
||||
- Über "Leads" Button auf Kunden & Lizenzen Seite
|
||||
- Bewusst kein Navbar-Eintrag
|
||||
- Komplett getrennt vom Kundensystem
|
||||
|
||||
**Dokumentation**: Siehe `LEAD_MANAGEMENT.md` für Details
|
||||
|
||||
### 📋 Noch zu implementieren:
|
||||
|
||||
1. **Erweiterte Anomalie-Erkennung**
|
||||
- Machine Learning basierte Pattern-Erkennung
|
||||
- Geo-Location Anomalien
|
||||
- Automatische Aktionen bei kritischen Anomalien
|
||||
|
||||
2. **Performance Optimierungen**
|
||||
- Connection Pooling
|
||||
- Query Optimization
|
||||
- Batch Processing für Heartbeats
|
||||
|
||||
3. **Erweiterte Features**
|
||||
- WebSocket für Live-Updates
|
||||
- Bulk-Operationen
|
||||
- Export-Funktionen
|
||||
- API Documentation (OpenAPI/Swagger)
|
||||
|
||||
### 🔧 Technische Details:
|
||||
|
||||
- **Python Version**: 3.11
|
||||
- **Flask Version**: 3.0.0 (Analytics & Admin Services)
|
||||
- **FastAPI**: License Server
|
||||
- **PostgreSQL**: 15 mit UUID-Extension
|
||||
- **Redis**: 7-alpine für Caching (3 separate Datenbanken)
|
||||
- **RabbitMQ**: 3-management für Event Bus
|
||||
- **JWT**: PyJWT 2.8.0
|
||||
- **Psycopg2**: 2.9.9 für PostgreSQL
|
||||
- **Nginx**: Reverse Proxy mit SSL/TLS
|
||||
|
||||
### 📝 Nächste Schritte:
|
||||
|
||||
1. ~~Analytics Service vollständig implementieren~~ ✅ ERLEDIGT!
|
||||
2. ~~Admin API Service implementieren~~ ✅ ERLEDIGT!
|
||||
3. Prometheus Monitoring aufsetzen
|
||||
4. Grafana Dashboards erstellen
|
||||
5. Load Testing durchführen
|
||||
6. API-Dokumentation mit Swagger erstellen
|
||||
7. Kubernetes Deployment vorbereiten
|
||||
8. WebSocket für Real-time Updates implementieren
|
||||
|
||||
## Testing-Strategie
|
||||
|
||||
### Unit Tests
|
||||
- Service Logic
|
||||
- Validation Rules
|
||||
- Token Generation
|
||||
|
||||
### Integration Tests
|
||||
- API Endpoints
|
||||
- Database Operations
|
||||
- Cache Integration
|
||||
|
||||
### Load Tests
|
||||
- 10k concurrent validations
|
||||
- 100k active licenses
|
||||
- Sustained load scenarios
|
||||
|
||||
### Security Tests
|
||||
- Penetration Testing
|
||||
- Token Manipulation
|
||||
- Rate Limit Bypass
|
||||
|
||||
## Deployment
|
||||
|
||||
### Docker Compose (Development)
|
||||
```yaml
|
||||
services:
|
||||
license-auth:
|
||||
build: ./services/auth
|
||||
environment:
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
ports:
|
||||
- "5001:5001"
|
||||
|
||||
license-api:
|
||||
build: ./services/api
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
ports:
|
||||
- "5002:5002"
|
||||
|
||||
license-analytics:
|
||||
build: ./services/analytics
|
||||
depends_on:
|
||||
- postgres
|
||||
- rabbitmq
|
||||
ports:
|
||||
- "5003:5003"
|
||||
```
|
||||
|
||||
### Kubernetes (Production)
|
||||
- Helm Charts
|
||||
- ConfigMaps für Konfiguration
|
||||
- Secrets für Credentials
|
||||
- HPA für Auto-Scaling
|
||||
|
||||
## Wartung & Updates
|
||||
|
||||
### Zero-Downtime Deployments
|
||||
1. Blue-Green Deployment
|
||||
2. Database Migrations mit Flyway
|
||||
3. Feature Flags für schrittweise Rollouts
|
||||
|
||||
### Backup-Strategie
|
||||
- Stündliche Snapshots
|
||||
- Tägliche Full Backups
|
||||
- Geo-Redundante Speicherung
|
||||
- Point-in-Time Recovery
|
||||
|
||||
## Admin Panel Integration
|
||||
|
||||
### Dashboard-Erweiterungen
|
||||
Das bestehende Admin Panel wird um folgende Lizenzserver-Funktionen erweitert:
|
||||
|
||||
#### 1. **Lizenzserver Status Dashboard**
|
||||
- Echtzeit-Übersicht aller aktiven Validierungen
|
||||
- Heartbeat-Monitor mit Karte der aktiven Geräte
|
||||
- Performance-Metriken (Response Times, Success Rate)
|
||||
- Anomalie-Warnungen mit Quick Actions
|
||||
|
||||
#### 2. **Lizenz-Detailansicht (Erweitert)**
|
||||
```
|
||||
Bestehende Ansicht + neue Tabs:
|
||||
- [Basis Info] [Geräte] [Aktivität] [Anomalien] [Logs]
|
||||
|
||||
Aktivität-Tab:
|
||||
- Timeline der letzten 100 Validierungen
|
||||
- Heartbeat-Grafik (24h, 7d, 30d)
|
||||
- IP-Adressen und Locations
|
||||
- API-Nutzungsstatistiken
|
||||
|
||||
Anomalien-Tab:
|
||||
- Verdächtige Aktivitäten
|
||||
- Automatische Warnungen
|
||||
- Manuelle Actions (Block, Warn, etc.)
|
||||
```
|
||||
|
||||
#### 3. **Neue Menüpunkte im Admin Panel**
|
||||
```
|
||||
📊 Lizenzserver
|
||||
├── 🔍 Live Monitor
|
||||
├── 📈 Analytics
|
||||
├── ⚠️ Anomalien
|
||||
├── 🔧 Konfiguration
|
||||
└── 📝 API Logs
|
||||
```
|
||||
|
||||
#### 4. **Live Monitor Features**
|
||||
- WebSocket-basierte Echtzeit-Updates
|
||||
- Aktive Sessions Counter
|
||||
- Validierungen pro Minute Graph
|
||||
- Top 10 aktivste Lizenzen
|
||||
- Geografische Verteilung
|
||||
|
||||
#### 5. **Analytics Dashboard**
|
||||
- Nutzungsstatistiken pro Kunde/Lizenz
|
||||
- Revenue Impact Analysis
|
||||
- Churn Prediction
|
||||
- Usage Patterns
|
||||
|
||||
### Integration in bestehende Views
|
||||
|
||||
#### Kunden & Lizenzen Übersicht
|
||||
```html
|
||||
<!-- Neue Spalten in der Lizenz-Tabelle -->
|
||||
<td>💚 Online (2 Geräte)</td> <!-- Live Status -->
|
||||
<td>⏱️ Vor 5 Min</td> <!-- Letzte Aktivität -->
|
||||
<td>🔴 2 Warnungen</td> <!-- Anomalien -->
|
||||
```
|
||||
|
||||
#### Audit Log Erweiterung
|
||||
Neue Event-Typen:
|
||||
- `license.validation.success`
|
||||
- `license.validation.failed`
|
||||
- `license.anomaly.detected`
|
||||
- `license.device.blocked`
|
||||
- `license.transfer.completed`
|
||||
|
||||
### Admin Panel Routes (Neue)
|
||||
```python
|
||||
# Lizenzserver Monitoring
|
||||
@app.route('/lizenzserver/monitor')
|
||||
@app.route('/lizenzserver/analytics')
|
||||
@app.route('/lizenzserver/anomalies')
|
||||
@app.route('/lizenzserver/config')
|
||||
|
||||
# API für Live-Updates
|
||||
@app.route('/api/admin/lizenzserver/live-stats')
|
||||
@app.websocket('/ws/lizenzserver/updates')
|
||||
```
|
||||
|
||||
## Fazit
|
||||
|
||||
Diese Architektur ist darauf ausgelegt, von Anfang an skalierbar und wartbar zu sein. Durch die Microservices-Architektur, Event-Driven Design und sorgfältige Planung der Datenbankstruktur wird sichergestellt, dass zukünftige Erweiterungen ohne größere Refactorings möglich sind.
|
||||
|
||||
**Wichtig**: Alle Lizenzserver-Funktionen sind vollständig im Admin Panel integriert und bieten eine einheitliche Oberfläche für die Verwaltung. Die Implementierung sollte schrittweise erfolgen, wobei jede Phase vollständig getestet wird, bevor zur nächsten übergegangen wird. Besonderes Augenmerk sollte auf Security, Performance und Monitoring gelegt werden, da diese Aspekte für einen Lizenzserver kritisch sind.
|
||||
@@ -1,125 +0,0 @@
|
||||
# Lizenzserver Implementierungsstatus
|
||||
|
||||
## Aktueller Stand (19.06.2025)
|
||||
|
||||
### ✅ Erledigte Aufgaben
|
||||
|
||||
1. **Monitoring Integration im Admin Panel**
|
||||
- "Sitzungen" aus der Navigation entfernt
|
||||
- Neues "Monitoring" Menü erstellt mit:
|
||||
- Live Dashboard (zeigt Kunden-Sessions)
|
||||
- System Status (Service-Überwachung)
|
||||
- Alerts (Warnungen und Anomalien)
|
||||
- Analytics (Detaillierte Berichte)
|
||||
- Alle Templates und Routes implementiert in:
|
||||
- `/v2_adminpanel/routes/monitoring_routes.py`
|
||||
- `/v2_adminpanel/templates/monitoring/`
|
||||
|
||||
2. **Docker Services bereinigt**
|
||||
- Problematische Services temporär deaktiviert:
|
||||
- auth-service (config.py erstellt, aber Implementierung fehlt)
|
||||
- analytics-service (Verzeichnis leer)
|
||||
- admin-api-service (Verzeichnis leer)
|
||||
- nginx.conf entsprechend angepasst
|
||||
- Admin Panel läuft wieder stabil
|
||||
|
||||
3. **JWT_SECRET konfiguriert**
|
||||
- In `.env` hinzugefügt
|
||||
- $ Zeichen entfernt um Docker-Variablen-Probleme zu vermeiden
|
||||
|
||||
### 🚧 Offene Aufgaben laut lizenzserver.md
|
||||
|
||||
#### 1. Auth Service (`/lizenzserver/services/auth/`)
|
||||
- **Status**: Teilweise begonnen
|
||||
- **Vorhanden**:
|
||||
- `app.py` (Framework vorhanden)
|
||||
- `config.py` (neu erstellt)
|
||||
- `requirements.txt`
|
||||
- **Fehlt**:
|
||||
- JWT Token Verwaltung
|
||||
- User Authentication Endpoints
|
||||
- Permission System
|
||||
- Redis Session Management
|
||||
|
||||
#### 2. Analytics Service (`/lizenzserver/services/analytics/`)
|
||||
- **Status**: Nicht begonnen
|
||||
- **Verzeichnis**: Leer
|
||||
- **Benötigt**:
|
||||
- Metrics Collection
|
||||
- Data Aggregation
|
||||
- Reporting Endpoints
|
||||
- Prometheus Integration
|
||||
|
||||
#### 3. Admin API Service (`/lizenzserver/services/admin_api/`)
|
||||
- **Status**: Nicht begonnen
|
||||
- **Verzeichnis**: Leer
|
||||
- **Benötigt**:
|
||||
- CRUD Operations für Lizenzen
|
||||
- Customer Management API
|
||||
- Audit Logging
|
||||
- Rate Limiting
|
||||
|
||||
#### 4. Monitoring Stack
|
||||
- **Prometheus**: Konfiguration fehlt (`/monitoring/prometheus/`)
|
||||
- **Grafana**: Dashboards fehlen (`/monitoring/grafana/`)
|
||||
- **Alertmanager**: Rules fehlen (`/monitoring/alertmanager/`)
|
||||
|
||||
### 📋 Nächste Schritte
|
||||
|
||||
1. **Auth Service vervollständigen**
|
||||
```python
|
||||
# Implementiere in /lizenzserver/services/auth/app.py:
|
||||
- POST /api/v1/auth/login
|
||||
- POST /api/v1/auth/refresh
|
||||
- POST /api/v1/auth/logout
|
||||
- GET /api/v1/auth/verify
|
||||
```
|
||||
|
||||
2. **Analytics Service implementieren**
|
||||
```python
|
||||
# Neue Dateien erstellen:
|
||||
- app.py (Flask App mit Metrics Endpoints)
|
||||
- models.py (Datenmodelle für Analytics)
|
||||
- collectors.py (Metrics Collectors)
|
||||
- Dockerfile
|
||||
- requirements.txt
|
||||
```
|
||||
|
||||
3. **Admin API Service implementieren**
|
||||
```python
|
||||
# API Endpoints erstellen:
|
||||
- /api/v1/admin/licenses (CRUD)
|
||||
- /api/v1/admin/customers (CRUD)
|
||||
- /api/v1/admin/metrics
|
||||
- /api/v1/admin/audit
|
||||
```
|
||||
|
||||
4. **Monitoring Stack aufsetzen**
|
||||
```yaml
|
||||
# docker-compose.yaml erweitern mit:
|
||||
- prometheus service
|
||||
- grafana service
|
||||
- alertmanager service
|
||||
```
|
||||
|
||||
### 🔧 Technische Details
|
||||
|
||||
- **Docker Network**: `internal_net`
|
||||
- **Datenbank**: PostgreSQL (`v2_adminpanel` database)
|
||||
- **Cache**: Redis (verschiedene DBs für Services)
|
||||
- **Message Queue**: RabbitMQ
|
||||
- **Reverse Proxy**: nginx
|
||||
|
||||
### 📝 Wichtige Hinweise
|
||||
|
||||
- Die Services wurden in `docker-compose.yaml` auskommentiert statt gelöscht
|
||||
- nginx.conf hat die Service-Routen ebenfalls auskommentiert
|
||||
- Sobald Services implementiert sind, können sie einfach wieder aktiviert werden
|
||||
- Das Admin Panel selbst funktioniert vollständig
|
||||
|
||||
### 🚀 Deployment-Status
|
||||
|
||||
- Admin Panel: ✅ Läuft auf https://admin-panel-undso.z5m7q9dk3ah2v1plx6ju.com
|
||||
- API Server: ✅ Läuft auf https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com
|
||||
- Monitoring UI: ✅ Integriert im Admin Panel
|
||||
- Externe Monitoring Tools: ❌ Noch nicht konfiguriert
|
||||
282
OPERATIONS_GUIDE.md
Normale Datei
282
OPERATIONS_GUIDE.md
Normale Datei
@@ -0,0 +1,282 @@
|
||||
# V2-Docker Operations Guide
|
||||
|
||||
## Deployment
|
||||
|
||||
### Prerequisites
|
||||
- Docker and Docker Compose
|
||||
- PostgreSQL 13+
|
||||
- Python 3.8+
|
||||
- Minimum 4GB RAM
|
||||
- 20GB disk space
|
||||
|
||||
### Initial Setup
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone <repository-url>
|
||||
cd v2-Docker
|
||||
|
||||
# Set environment variables
|
||||
cp .env.example .env
|
||||
# Edit .env with your configuration
|
||||
|
||||
# Start services
|
||||
docker-compose up -d
|
||||
|
||||
# Run database migrations
|
||||
docker exec v2_adminpanel python manage.py migrate
|
||||
```
|
||||
|
||||
### Service Configuration
|
||||
|
||||
#### License Server
|
||||
```yaml
|
||||
v2_lizenzserver:
|
||||
image: v2_lizenzserver:latest
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://user:pass@db:5432/v2
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- API_KEY=${API_KEY}
|
||||
ports:
|
||||
- "8080:8080"
|
||||
```
|
||||
|
||||
#### Admin Panel
|
||||
```yaml
|
||||
v2_adminpanel:
|
||||
image: v2_adminpanel:latest
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://user:pass@db:5432/v2
|
||||
- SECRET_KEY=${SECRET_KEY}
|
||||
ports:
|
||||
- "5000:5000"
|
||||
```
|
||||
|
||||
## Monitoring
|
||||
|
||||
### Prometheus Configuration
|
||||
|
||||
#### Scrape Configs
|
||||
```yaml
|
||||
scrape_configs:
|
||||
- job_name: 'license-server'
|
||||
static_configs:
|
||||
- targets: ['v2_lizenzserver:8080']
|
||||
|
||||
- job_name: 'postgres'
|
||||
static_configs:
|
||||
- targets: ['postgres_exporter:9187']
|
||||
```
|
||||
|
||||
#### Alert Rules
|
||||
- License server down: `up{job="license-server"} == 0`
|
||||
- High error rate: `rate(http_requests_total{status=~"5.."}[5m]) > 0.05`
|
||||
- Database connections: `pg_stat_database_numbackends > 100`
|
||||
|
||||
### Grafana Dashboards
|
||||
|
||||
1. **System Overview Dashboard**
|
||||
- CPU and memory usage
|
||||
- Network traffic
|
||||
- Disk usage
|
||||
- Container status
|
||||
|
||||
2. **License Server Dashboard**
|
||||
- Active licenses
|
||||
- Heartbeat frequency
|
||||
- API response times
|
||||
- Error rates
|
||||
|
||||
3. **Database Performance Dashboard**
|
||||
- Query performance
|
||||
- Connection pool status
|
||||
- Table sizes
|
||||
- Slow queries
|
||||
|
||||
### Accessing Monitoring
|
||||
|
||||
- Prometheus: http://localhost:9090
|
||||
- Grafana: http://localhost:3001 (admin/admin)
|
||||
- Alertmanager: http://localhost:9093
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Database Maintenance
|
||||
|
||||
#### Partition Management
|
||||
```sql
|
||||
-- Check existing partitions
|
||||
SELECT tablename FROM pg_tables
|
||||
WHERE tablename LIKE 'license_heartbeats_%'
|
||||
ORDER BY tablename;
|
||||
|
||||
-- Create future partitions manually
|
||||
CALL create_monthly_partitions('license_heartbeats', 3);
|
||||
|
||||
-- Drop old partitions
|
||||
DROP TABLE IF EXISTS license_heartbeats_2024_01;
|
||||
```
|
||||
|
||||
#### Backup Procedures
|
||||
```bash
|
||||
# Full database backup
|
||||
docker exec v2_db pg_dump -U postgres v2 > backup_$(date +%Y%m%d).sql
|
||||
|
||||
# Backup specific tables
|
||||
docker exec v2_db pg_dump -U postgres -t licenses -t license_activations v2 > licenses_backup.sql
|
||||
|
||||
# Restore from backup
|
||||
docker exec -i v2_db psql -U postgres v2 < backup_20250619.sql
|
||||
```
|
||||
|
||||
### Log Management
|
||||
|
||||
#### Log Locations
|
||||
- License Server: `/var/log/license-server/`
|
||||
- Admin Panel: `/var/log/adminpanel/`
|
||||
- Nginx: `/var/log/nginx/`
|
||||
|
||||
#### Log Rotation
|
||||
```bash
|
||||
# Configure logrotate
|
||||
/var/log/license-server/*.log {
|
||||
daily
|
||||
rotate 7
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create 0640 www-data www-data
|
||||
}
|
||||
```
|
||||
|
||||
### Performance Optimization
|
||||
|
||||
#### Database Tuning
|
||||
```sql
|
||||
-- Update statistics
|
||||
ANALYZE;
|
||||
|
||||
-- Reindex tables
|
||||
REINDEX TABLE licenses;
|
||||
REINDEX TABLE license_activations;
|
||||
|
||||
-- Vacuum tables
|
||||
VACUUM ANALYZE licenses;
|
||||
```
|
||||
|
||||
#### Resource Limits
|
||||
```yaml
|
||||
# Docker resource constraints
|
||||
services:
|
||||
v2_lizenzserver:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '1'
|
||||
memory: 1G
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### License Server Not Responding
|
||||
1. Check container status: `docker ps`
|
||||
2. View logs: `docker logs v2_lizenzserver`
|
||||
3. Test database connection: `docker exec v2_lizenzserver pg_isready`
|
||||
4. Verify JWT_SECRET is set
|
||||
|
||||
#### Database Connection Issues
|
||||
1. Check PostgreSQL status: `docker exec v2_db pg_isready`
|
||||
2. Verify credentials in .env
|
||||
3. Check network connectivity: `docker network ls`
|
||||
4. Review PostgreSQL logs: `docker logs v2_db`
|
||||
|
||||
#### High Memory Usage
|
||||
1. Check container stats: `docker stats`
|
||||
2. Review memory limits in docker-compose.yml
|
||||
3. Analyze database queries for optimization
|
||||
4. Consider scaling horizontally
|
||||
|
||||
### Health Checks
|
||||
|
||||
```bash
|
||||
# License server health
|
||||
curl http://localhost:8080/health
|
||||
|
||||
# Database health
|
||||
docker exec v2_db pg_isready
|
||||
|
||||
# Admin panel health
|
||||
curl http://localhost:5000/health
|
||||
|
||||
# Monitoring stack
|
||||
curl http://localhost:9090/-/healthy # Prometheus
|
||||
curl http://localhost:3001/api/health # Grafana
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### API Security
|
||||
- Use strong JWT_SECRET (minimum 32 characters)
|
||||
- Rotate API keys regularly
|
||||
- Implement rate limiting
|
||||
- Use HTTPS in production
|
||||
|
||||
### Database Security
|
||||
- Use strong passwords
|
||||
- Limit database access
|
||||
- Enable SSL for connections
|
||||
- Regular security updates
|
||||
|
||||
### Container Security
|
||||
- Use official base images
|
||||
- Scan images for vulnerabilities
|
||||
- Don't run containers as root
|
||||
- Keep Docker updated
|
||||
|
||||
## Scaling Strategies
|
||||
|
||||
### Horizontal Scaling
|
||||
```yaml
|
||||
# Scale license server
|
||||
docker-compose up -d --scale v2_lizenzserver=3
|
||||
|
||||
# Load balancing with Nginx
|
||||
upstream license_servers {
|
||||
server v2_lizenzserver_1:8080;
|
||||
server v2_lizenzserver_2:8080;
|
||||
server v2_lizenzserver_3:8080;
|
||||
}
|
||||
```
|
||||
|
||||
### Database Scaling
|
||||
- Read replicas for reporting
|
||||
- Connection pooling
|
||||
- Query optimization
|
||||
- Partitioning for large tables
|
||||
|
||||
## Disaster Recovery
|
||||
|
||||
### Backup Strategy
|
||||
- Daily automated backups
|
||||
- Off-site backup storage
|
||||
- Test restore procedures
|
||||
- Document recovery steps
|
||||
|
||||
### High Availability
|
||||
- Database replication
|
||||
- Service redundancy
|
||||
- Load balancing
|
||||
- Automated failover
|
||||
|
||||
## Monitoring Best Practices
|
||||
|
||||
1. **Set up alerts for critical metrics**
|
||||
2. **Create runbooks for common issues**
|
||||
3. **Regular review of dashboards**
|
||||
4. **Capacity planning based on trends**
|
||||
5. **Document all custom configurations**
|
||||
203
SYSTEM_DOCUMENTATION.md
Normale Datei
203
SYSTEM_DOCUMENTATION.md
Normale Datei
@@ -0,0 +1,203 @@
|
||||
# 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
|
||||
|
||||
#### Services
|
||||
1. **License Service** - Core license validation
|
||||
2. **Analytics Service** - Usage statistics and reporting
|
||||
3. **Admin API Service** - Administrative operations
|
||||
4. **Notification Service** - Email/webhook notifications
|
||||
5. **Backup Service** - Automated backups
|
||||
|
||||
#### Communication
|
||||
- REST APIs for external communication
|
||||
- Message queuing for internal communication
|
||||
- Event-driven architecture for real-time updates
|
||||
|
||||
### Database Schema
|
||||
|
||||
#### Core Tables
|
||||
- `licenses` - License definitions
|
||||
- `license_activations` - Active installations
|
||||
- `license_heartbeats` - Usage tracking (partitioned monthly)
|
||||
- `license_usage_stats` - Aggregated statistics
|
||||
- `license_features` - Feature flags
|
||||
- `license_limits` - Usage limits
|
||||
|
||||
#### Partitioning Strategy
|
||||
- Monthly partitions for `license_heartbeats`
|
||||
- Automatic partition creation
|
||||
- 90-day retention policy
|
||||
|
||||
### Security Concepts
|
||||
- JWT-based authentication
|
||||
- API key management
|
||||
- Rate limiting (100 requests/minute)
|
||||
- Hardware fingerprint validation
|
||||
- Encrypted communication
|
||||
|
||||
### Implementation Status (June 19, 2025)
|
||||
|
||||
#### Completed
|
||||
- Basic license server functionality
|
||||
- Admin Panel integration
|
||||
- Monitoring dashboard
|
||||
- Docker services configuration
|
||||
- JWT secret management
|
||||
- Basic API endpoints
|
||||
|
||||
#### In Progress
|
||||
- Analytics service
|
||||
- Advanced monitoring
|
||||
- Backup automation
|
||||
- Performance optimization
|
||||
|
||||
## Lead Management System
|
||||
|
||||
### Architecture
|
||||
- **Modular Architecture**: Clean separation of concerns
|
||||
- **Service Layer Pattern**: Business logic isolation
|
||||
- **Repository Pattern**: Data access abstraction
|
||||
- **RESTful API Design**: Standard HTTP methods
|
||||
|
||||
### Data Model
|
||||
- **Institutions**: Core entity for organizations
|
||||
- **Contact Persons**: Multiple contacts per institution
|
||||
- **Notes System**: Versioned notes with timestamps
|
||||
- **Future-proof Design**: JSONB fields for extensibility
|
||||
|
||||
### Features
|
||||
1. Institution management (CRUD operations)
|
||||
2. Contact person management
|
||||
3. Advanced search and filtering
|
||||
4. Export functionality
|
||||
5. Activity tracking
|
||||
6. Note versioning
|
||||
|
||||
## Monitoring Stack
|
||||
|
||||
### Components
|
||||
- **Prometheus**: Metrics collection
|
||||
- **Grafana**: Visualization (port 3001)
|
||||
- **Alertmanager**: Alert management (port 9093)
|
||||
- **Node Exporter**: System metrics
|
||||
- **Postgres Exporter**: Database metrics
|
||||
- **cAdvisor**: Container metrics
|
||||
|
||||
### Dashboards
|
||||
1. System Overview
|
||||
2. License Server Metrics
|
||||
3. Database Performance
|
||||
4. Container Resources
|
||||
5. Admin Panel Usage
|
||||
|
||||
### Alert Rules
|
||||
- High CPU usage (>80%)
|
||||
- High memory usage (>90%)
|
||||
- Database connection issues
|
||||
- License server downtime
|
||||
- Disk space warnings
|
||||
|
||||
## Admin Panel Integration
|
||||
|
||||
### Features
|
||||
- License management interface
|
||||
- Customer creation and editing
|
||||
- License monitoring dashboard
|
||||
- Real-time statistics
|
||||
- Alert notifications
|
||||
|
||||
### Technical Details
|
||||
- Flask-based web application
|
||||
- PostgreSQL database
|
||||
- Bootstrap UI framework
|
||||
- AJAX for real-time updates
|
||||
- Responsive design
|
||||
|
||||
## Deployment Configuration
|
||||
|
||||
### Docker Services
|
||||
- `v2_db`: PostgreSQL database
|
||||
- `v2_adminpanel`: Admin interface
|
||||
- `v2_nginx`: Reverse proxy
|
||||
- `v2_lizenzserver`: License server
|
||||
- `prometheus`: Metrics collection
|
||||
- `grafana`: Monitoring dashboards
|
||||
|
||||
### Environment Variables
|
||||
- `JWT_SECRET`: Authentication key
|
||||
- `DATABASE_URL`: PostgreSQL connection
|
||||
- `API_KEY`: Service authentication
|
||||
- `MONITORING_ENABLED`: Feature flag
|
||||
|
||||
### Network Configuration
|
||||
- Internal network for service communication
|
||||
- External access through Nginx
|
||||
- SSL/TLS termination at proxy level
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Unit Tests
|
||||
- Service layer logic
|
||||
- API endpoint validation
|
||||
- Database operations
|
||||
|
||||
### Integration Tests
|
||||
- Service communication
|
||||
- Database transactions
|
||||
- API workflows
|
||||
|
||||
### Performance Tests
|
||||
- Load testing
|
||||
- Stress testing
|
||||
- Scalability verification
|
||||
|
||||
## Future Roadmap
|
||||
|
||||
### Phase 1: Core Completion
|
||||
- Finish analytics service
|
||||
- Complete backup automation
|
||||
- Implement all monitoring dashboards
|
||||
|
||||
### Phase 2: Advanced Features
|
||||
- Machine learning for usage prediction
|
||||
- Advanced reporting
|
||||
- Multi-tenant support
|
||||
|
||||
### Phase 3: Enterprise Features
|
||||
- High availability setup
|
||||
- Disaster recovery
|
||||
- Advanced security features
|
||||
@@ -1,272 +0,0 @@
|
||||
# V2 Docker Monitoring Stack
|
||||
|
||||
## Übersicht
|
||||
|
||||
Die Monitoring-Lösung für V2 Docker basiert auf dem Prometheus-Stack und bietet umfassende Einblicke in die Performance und Gesundheit aller Services.
|
||||
|
||||
## Komponenten
|
||||
|
||||
### 1. **Prometheus** (Port 9090)
|
||||
- Zentrale Metrik-Sammlung
|
||||
- Konfigurierte Scrape-Jobs für alle Services
|
||||
- 30 Tage Datenaufbewahrung
|
||||
- Alert-Rules für kritische Ereignisse
|
||||
|
||||
### 2. **Grafana** (Port 3000)
|
||||
- Visualisierung der Metriken
|
||||
- Vorkonfigurierte Dashboards
|
||||
- Alerting-Integration
|
||||
- Standard-Login: admin/admin (beim ersten Login ändern)
|
||||
|
||||
### 3. **Alertmanager** (Port 9093)
|
||||
- Alert-Routing und -Gruppierung
|
||||
- Email-Benachrichtigungen
|
||||
- Webhook-Integration
|
||||
- Alert-Silencing und -Inhibition
|
||||
|
||||
### 4. **Exporters**
|
||||
- **PostgreSQL Exporter**: Datenbank-Metriken
|
||||
- **Redis Exporter**: Cache-Metriken
|
||||
- **Node Exporter**: System-Metriken
|
||||
- **Nginx Exporter**: Proxy-Metriken
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Monitoring-Stack starten
|
||||
|
||||
```bash
|
||||
cd monitoring
|
||||
docker-compose -f docker-compose.monitoring.yml up -d
|
||||
```
|
||||
|
||||
### 2. Services überprüfen
|
||||
|
||||
```bash
|
||||
docker-compose -f docker-compose.monitoring.yml ps
|
||||
```
|
||||
|
||||
### 3. Grafana-Zugang
|
||||
|
||||
1. Öffnen Sie https://monitoring.v2-docker.com (oder http://localhost:3000)
|
||||
2. Login mit admin/admin
|
||||
3. Neues Passwort setzen
|
||||
4. Dashboard "License Server Overview" öffnen
|
||||
|
||||
## Konfiguration
|
||||
|
||||
### Environment-Variablen
|
||||
|
||||
Erstellen Sie eine `.env` Datei im monitoring-Verzeichnis:
|
||||
|
||||
```env
|
||||
# Grafana
|
||||
GRAFANA_USER=admin
|
||||
GRAFANA_PASSWORD=secure-password
|
||||
|
||||
# PostgreSQL Connection
|
||||
POSTGRES_PASSWORD=your-postgres-password
|
||||
|
||||
# Alertmanager SMTP
|
||||
SMTP_USERNAME=alerts@yourdomain.com
|
||||
SMTP_PASSWORD=smtp-password
|
||||
|
||||
# Webhook URLs
|
||||
WEBHOOK_CRITICAL=https://your-webhook-url/critical
|
||||
WEBHOOK_SECURITY=https://your-webhook-url/security
|
||||
```
|
||||
|
||||
### Alert-Konfiguration
|
||||
|
||||
Alerts sind in `prometheus/rules/license-server-alerts.yml` definiert:
|
||||
|
||||
- **HighLicenseValidationErrorRate**: Fehlerrate > 5%
|
||||
- **PossibleLicenseAbuse**: Verdächtige Aktivitäten
|
||||
- **LicenseServerDown**: Service nicht erreichbar
|
||||
- **HighLicenseValidationLatency**: Antwortzeit > 500ms
|
||||
- **DatabaseConnectionPoolExhausted**: DB-Verbindungen > 90%
|
||||
|
||||
### Neue Alerts hinzufügen
|
||||
|
||||
1. Editieren Sie `prometheus/rules/license-server-alerts.yml`
|
||||
2. Fügen Sie neue Alert-Regel hinzu:
|
||||
|
||||
```yaml
|
||||
- alert: YourAlertName
|
||||
expr: your_prometheus_query > threshold
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
service: your-service
|
||||
annotations:
|
||||
summary: "Alert summary"
|
||||
description: "Detailed description"
|
||||
```
|
||||
|
||||
3. Prometheus neu laden:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:9090/-/reload
|
||||
```
|
||||
|
||||
## Dashboards
|
||||
|
||||
### License Server Overview
|
||||
|
||||
Zeigt wichtige Metriken:
|
||||
- Aktive Lizenzen
|
||||
- Validierungen pro Sekunde
|
||||
- Fehlerrate
|
||||
- Response Time Percentiles
|
||||
- Anomalie-Erkennung
|
||||
- Top 10 aktivste Lizenzen
|
||||
|
||||
### Neue Dashboards erstellen
|
||||
|
||||
1. In Grafana einloggen
|
||||
2. Create → Dashboard
|
||||
3. Panel hinzufügen
|
||||
4. Prometheus-Query eingeben
|
||||
5. Dashboard speichern
|
||||
6. Export als JSON für Backup
|
||||
|
||||
## Metriken
|
||||
|
||||
### License Server Metriken
|
||||
|
||||
- `license_validation_total`: Anzahl der Validierungen
|
||||
- `license_validation_duration_seconds`: Validierungs-Dauer
|
||||
- `active_licenses_total`: Aktive Lizenzen
|
||||
- `anomaly_detections_total`: Erkannte Anomalien
|
||||
|
||||
### System Metriken
|
||||
|
||||
- `node_cpu_seconds_total`: CPU-Auslastung
|
||||
- `node_memory_MemAvailable_bytes`: Verfügbarer Speicher
|
||||
- `node_filesystem_avail_bytes`: Verfügbarer Festplattenspeicher
|
||||
|
||||
### Datenbank Metriken
|
||||
|
||||
- `pg_stat_database_numbackends`: Aktive DB-Verbindungen
|
||||
- `pg_stat_database_tup_fetched`: Abgerufene Tupel
|
||||
- `pg_stat_database_conflicts`: Konflikte
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Prometheus erreicht Service nicht
|
||||
|
||||
1. Netzwerk überprüfen:
|
||||
```bash
|
||||
docker network inspect v2_internal_net
|
||||
```
|
||||
|
||||
2. Service-Discovery testen:
|
||||
```bash
|
||||
docker exec prometheus wget -O- http://license-server:8443/metrics
|
||||
```
|
||||
|
||||
### Keine Daten in Grafana
|
||||
|
||||
1. Datasource überprüfen:
|
||||
- Settings → Data Sources → Prometheus
|
||||
- Test Connection
|
||||
|
||||
2. Prometheus Targets checken:
|
||||
- http://localhost:9090/targets
|
||||
- Alle Targets sollten "UP" sein
|
||||
|
||||
### Alerts werden nicht gesendet
|
||||
|
||||
1. Alertmanager Logs prüfen:
|
||||
```bash
|
||||
docker logs alertmanager
|
||||
```
|
||||
|
||||
2. SMTP-Konfiguration verifizieren
|
||||
3. Webhook-URLs testen
|
||||
|
||||
## Wartung
|
||||
|
||||
### Backup
|
||||
|
||||
1. Prometheus-Daten:
|
||||
```bash
|
||||
docker exec prometheus tar czf /prometheus/backup.tar.gz /prometheus
|
||||
docker cp prometheus:/prometheus/backup.tar.gz ./backups/
|
||||
```
|
||||
|
||||
2. Grafana-Dashboards:
|
||||
- Export über UI als JSON
|
||||
- Speichern in `grafana/dashboards/`
|
||||
|
||||
### Updates
|
||||
|
||||
1. Images updaten:
|
||||
```bash
|
||||
docker-compose -f docker-compose.monitoring.yml pull
|
||||
docker-compose -f docker-compose.monitoring.yml up -d
|
||||
```
|
||||
|
||||
2. Konfiguration neu laden:
|
||||
```bash
|
||||
# Prometheus
|
||||
curl -X POST http://localhost:9090/-/reload
|
||||
|
||||
# Alertmanager
|
||||
curl -X POST http://localhost:9093/-/reload
|
||||
```
|
||||
|
||||
## Performance-Optimierung
|
||||
|
||||
### Retention anpassen
|
||||
|
||||
In `docker-compose.monitoring.yml`:
|
||||
```yaml
|
||||
command:
|
||||
- '--storage.tsdb.retention.time=15d' # Reduzieren für weniger Speicher
|
||||
```
|
||||
|
||||
### Scrape-Intervalle
|
||||
|
||||
In `prometheus/prometheus.yml`:
|
||||
```yaml
|
||||
global:
|
||||
scrape_interval: 30s # Erhöhen für weniger Last
|
||||
```
|
||||
|
||||
### Resource Limits
|
||||
|
||||
Passen Sie die Limits in `docker-compose.monitoring.yml` an Ihre Umgebung an.
|
||||
|
||||
## Sicherheit
|
||||
|
||||
1. **Grafana**: Ändern Sie das Standard-Passwort sofort
|
||||
2. **Prometheus**: Kein öffentlicher Zugriff (nur intern)
|
||||
3. **Alertmanager**: Webhook-URLs geheim halten
|
||||
4. **Exporters**: Nur im internen Netzwerk erreichbar
|
||||
|
||||
## Integration
|
||||
|
||||
### In CI/CD Pipeline
|
||||
|
||||
```bash
|
||||
# Deployment-Metriken senden
|
||||
curl -X POST http://prometheus-pushgateway:9091/metrics/job/deployment \
|
||||
-d 'deployment_status{version="1.2.3",environment="production"} 1'
|
||||
```
|
||||
|
||||
### Custom Metriken
|
||||
|
||||
In Ihrer Anwendung:
|
||||
```python
|
||||
from prometheus_client import Counter, Histogram
|
||||
|
||||
custom_metric = Counter('my_custom_total', 'Description')
|
||||
custom_metric.inc()
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Bei Problemen:
|
||||
1. Logs überprüfen: `docker-compose -f docker-compose.monitoring.yml logs [service]`
|
||||
2. Dokumentation: https://prometheus.io/docs/
|
||||
3. Grafana Docs: https://grafana.com/docs/
|
||||
@@ -1,77 +0,0 @@
|
||||
# License Heartbeats Partition Management
|
||||
|
||||
## Overview
|
||||
|
||||
The `license_heartbeats` table uses PostgreSQL partitioning to efficiently store and query time-series data. Each partition contains data for one month.
|
||||
|
||||
## Problem
|
||||
|
||||
The monitoring dashboard may fail with "relation does not exist" errors when:
|
||||
1. The current month's partition hasn't been created
|
||||
2. The license_heartbeats table hasn't been properly initialized
|
||||
|
||||
## Solution
|
||||
|
||||
### Automatic Partition Creation
|
||||
|
||||
The monitoring routes now automatically:
|
||||
1. Check if the `license_heartbeats` table exists
|
||||
2. Create missing partitions for the current month
|
||||
3. Handle missing table/partition gracefully by returning empty data
|
||||
|
||||
### Manual Partition Creation
|
||||
|
||||
If needed, you can manually create partitions:
|
||||
|
||||
1. **Using the migration script:**
|
||||
```bash
|
||||
docker exec -it v2_adminpanel python apply_partition_migration.py
|
||||
```
|
||||
|
||||
2. **Using SQL directly:**
|
||||
```sql
|
||||
-- Create June 2025 partition
|
||||
CREATE TABLE IF NOT EXISTS license_heartbeats_2025_06 PARTITION OF license_heartbeats
|
||||
FOR VALUES FROM ('2025-06-01') TO ('2025-07-01');
|
||||
```
|
||||
|
||||
### Partition Naming Convention
|
||||
|
||||
Partitions follow the naming pattern: `license_heartbeats_YYYY_MM`
|
||||
|
||||
Examples:
|
||||
- `license_heartbeats_2025_01` - January 2025
|
||||
- `license_heartbeats_2025_06` - June 2025
|
||||
- `license_heartbeats_2025_12` - December 2025
|
||||
|
||||
### Best Practices
|
||||
|
||||
1. **Pre-create partitions**: Create partitions for the next 6 months to avoid runtime issues
|
||||
2. **Monitor partition usage**: Check which partitions exist regularly
|
||||
3. **Archive old data**: Consider dropping very old partitions to save space
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If you see "relation does not exist" errors:
|
||||
|
||||
1. Check if the base table exists:
|
||||
```sql
|
||||
SELECT EXISTS (
|
||||
SELECT 1 FROM information_schema.tables
|
||||
WHERE table_name = 'license_heartbeats'
|
||||
);
|
||||
```
|
||||
|
||||
2. List existing partitions:
|
||||
```sql
|
||||
SELECT tablename FROM pg_tables
|
||||
WHERE tablename LIKE 'license_heartbeats_%'
|
||||
ORDER BY tablename;
|
||||
```
|
||||
|
||||
3. Create missing partition for current month:
|
||||
```sql
|
||||
-- Replace YYYY_MM with current year and month
|
||||
CREATE TABLE IF NOT EXISTS license_heartbeats_YYYY_MM PARTITION OF license_heartbeats
|
||||
FOR VALUES FROM ('YYYY-MM-01') TO ('YYYY-MM-01'::date + interval '1 month');
|
||||
```
|
||||
@@ -1,75 +0,0 @@
|
||||
# Database Migrations
|
||||
|
||||
## License Heartbeats Table Migration
|
||||
|
||||
### Overview
|
||||
The `create_license_heartbeats_table.sql` migration creates a partitioned table for storing real-time license validation data. This table is essential for the Live Dashboard & Analytics functionality.
|
||||
|
||||
### Features
|
||||
- Monthly partitioning for efficient data management
|
||||
- Automatic creation of current and next month partitions
|
||||
- Optimized indexes for performance
|
||||
- Foreign key relationship with licenses table
|
||||
|
||||
### Running the Migration
|
||||
|
||||
#### Option 1: Using the Python Script
|
||||
```bash
|
||||
cd /path/to/v2_adminpanel
|
||||
python apply_license_heartbeats_migration.py
|
||||
```
|
||||
|
||||
#### Option 2: Manual SQL Execution
|
||||
```bash
|
||||
psql -h postgres -U postgres -d v2_adminpanel -f migrations/create_license_heartbeats_table.sql
|
||||
```
|
||||
|
||||
#### Option 3: Docker Exec
|
||||
```bash
|
||||
docker exec -it v2_adminpanel_postgres psql -U postgres -d v2_adminpanel -f /migrations/create_license_heartbeats_table.sql
|
||||
```
|
||||
|
||||
### Verification
|
||||
After running the migration, verify the table was created:
|
||||
|
||||
```sql
|
||||
-- Check if table exists
|
||||
SELECT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.tables
|
||||
WHERE table_name = 'license_heartbeats'
|
||||
);
|
||||
|
||||
-- List all partitions
|
||||
SELECT tablename
|
||||
FROM pg_tables
|
||||
WHERE tablename LIKE 'license_heartbeats_%'
|
||||
ORDER BY tablename;
|
||||
```
|
||||
|
||||
### Partition Management
|
||||
The system automatically creates partitions as needed. To manually create future partitions:
|
||||
|
||||
```python
|
||||
from utils.partition_helper import create_future_partitions
|
||||
import psycopg2
|
||||
|
||||
conn = psycopg2.connect(...)
|
||||
create_future_partitions(conn, 'license_heartbeats', months_ahead=6)
|
||||
```
|
||||
|
||||
### Data Retention
|
||||
Consider implementing a data retention policy to remove old partitions:
|
||||
|
||||
```sql
|
||||
-- Drop partitions older than 3 months
|
||||
DROP TABLE IF EXISTS license_heartbeats_2025_03;
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
1. **Table already exists**: The migration is idempotent and will skip creation if the table exists.
|
||||
|
||||
2. **Permission denied**: Ensure the database user has CREATE privileges.
|
||||
|
||||
3. **Foreign key violation**: The licenses table must exist before running this migration.
|
||||
@@ -1,335 +0,0 @@
|
||||
# Lizenzserver Nutzungsanleitung
|
||||
|
||||
## Übersicht
|
||||
Der Lizenzserver läuft unter: `https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com`
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### 1. Lizenz aktivieren
|
||||
**POST** `/api/license/activate`
|
||||
|
||||
Aktiviert eine Lizenz für eine bestimmte Maschine.
|
||||
|
||||
```json
|
||||
{
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"machine_id": "UNIQUE-MACHINE-ID",
|
||||
"hardware_hash": "SHA256-HARDWARE-FINGERPRINT",
|
||||
"os_info": {
|
||||
"os": "Windows",
|
||||
"version": "10.0.19041"
|
||||
},
|
||||
"app_version": "1.0.0"
|
||||
}
|
||||
```
|
||||
|
||||
**Antwort bei Erfolg:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "License activated successfully",
|
||||
"activation_id": 123,
|
||||
"expires_at": "2025-12-31T23:59:59",
|
||||
"features": {
|
||||
"all_features": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Lizenz verifizieren (Heartbeat)
|
||||
**POST** `/api/license/verify`
|
||||
|
||||
Sollte alle 15 Minuten aufgerufen werden.
|
||||
|
||||
```json
|
||||
{
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX",
|
||||
"machine_id": "UNIQUE-MACHINE-ID",
|
||||
"hardware_hash": "SHA256-HARDWARE-FINGERPRINT",
|
||||
"activation_id": 123
|
||||
}
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
```json
|
||||
{
|
||||
"valid": true,
|
||||
"message": "License is valid",
|
||||
"expires_at": "2025-12-31T23:59:59",
|
||||
"features": {
|
||||
"all_features": true
|
||||
},
|
||||
"requires_update": false,
|
||||
"update_url": null
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Version prüfen
|
||||
**POST** `/api/version/check`
|
||||
|
||||
```json
|
||||
{
|
||||
"current_version": "1.0.0",
|
||||
"license_key": "XXXX-XXXX-XXXX-XXXX"
|
||||
}
|
||||
```
|
||||
|
||||
**Antwort:**
|
||||
```json
|
||||
{
|
||||
"latest_version": "1.1.0",
|
||||
"current_version": "1.0.0",
|
||||
"update_available": true,
|
||||
"is_mandatory": false,
|
||||
"download_url": "https://download.example.com/v1.1.0",
|
||||
"release_notes": "Bug fixes and improvements"
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Lizenzinfo abrufen
|
||||
**GET** `/api/license/info/{license_key}`
|
||||
|
||||
Liefert detaillierte Informationen über eine Lizenz.
|
||||
|
||||
## Authentifizierung
|
||||
|
||||
Alle API-Anfragen benötigen einen API-Key im Authorization Header:
|
||||
|
||||
```
|
||||
Authorization: Bearer YOUR-API-KEY-HERE
|
||||
```
|
||||
|
||||
## Client-Integration Beispiel (Python)
|
||||
|
||||
```python
|
||||
import requests
|
||||
import hashlib
|
||||
import platform
|
||||
import uuid
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
class LicenseClient:
|
||||
def __init__(self, api_key, server_url="https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com"):
|
||||
self.api_key = api_key
|
||||
self.server_url = server_url
|
||||
self.headers = {"Authorization": f"Bearer {api_key}"}
|
||||
|
||||
def get_machine_id(self):
|
||||
"""Eindeutige Maschinen-ID generieren"""
|
||||
return str(uuid.getnode()) # MAC-Adresse
|
||||
|
||||
def get_hardware_hash(self):
|
||||
"""Hardware-Fingerprint erstellen"""
|
||||
machine_id = self.get_machine_id()
|
||||
cpu_info = platform.processor()
|
||||
system_info = f"{platform.system()}-{platform.machine()}"
|
||||
|
||||
combined = f"{machine_id}-{cpu_info}-{system_info}"
|
||||
return hashlib.sha256(combined.encode()).hexdigest()
|
||||
|
||||
def activate_license(self, license_key):
|
||||
"""Lizenz aktivieren"""
|
||||
data = {
|
||||
"license_key": license_key,
|
||||
"machine_id": self.get_machine_id(),
|
||||
"hardware_hash": self.get_hardware_hash(),
|
||||
"os_info": {
|
||||
"os": platform.system(),
|
||||
"version": platform.version(),
|
||||
"machine": platform.machine()
|
||||
},
|
||||
"app_version": "1.0.0"
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{self.server_url}/api/license/activate",
|
||||
headers=self.headers,
|
||||
json=data,
|
||||
verify=True # SSL-Zertifikat prüfen
|
||||
)
|
||||
|
||||
return response.json()
|
||||
|
||||
def verify_license(self, license_key, activation_id):
|
||||
"""Lizenz verifizieren (Heartbeat)"""
|
||||
data = {
|
||||
"license_key": license_key,
|
||||
"machine_id": self.get_machine_id(),
|
||||
"hardware_hash": self.get_hardware_hash(),
|
||||
"activation_id": activation_id
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{self.server_url}/api/license/verify",
|
||||
headers=self.headers,
|
||||
json=data,
|
||||
verify=True
|
||||
)
|
||||
|
||||
return response.json()
|
||||
|
||||
def check_version(self, license_key, current_version):
|
||||
"""Version prüfen"""
|
||||
data = {
|
||||
"current_version": current_version,
|
||||
"license_key": license_key
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{self.server_url}/api/version/check",
|
||||
headers=self.headers,
|
||||
json=data,
|
||||
verify=True
|
||||
)
|
||||
|
||||
return response.json()
|
||||
|
||||
# Verwendungsbeispiel
|
||||
if __name__ == "__main__":
|
||||
client = LicenseClient("YOUR-API-KEY")
|
||||
|
||||
# Lizenz aktivieren
|
||||
result = client.activate_license("USER-LICENSE-KEY")
|
||||
if result["success"]:
|
||||
activation_id = result["activation_id"]
|
||||
print(f"Lizenz aktiviert! Activation ID: {activation_id}")
|
||||
|
||||
# Lizenz verifizieren
|
||||
verify_result = client.verify_license("USER-LICENSE-KEY", activation_id)
|
||||
if verify_result["valid"]:
|
||||
print("Lizenz ist gültig!")
|
||||
```
|
||||
|
||||
## Client-Integration Beispiel (C#)
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Cryptography;
|
||||
using System.Management;
|
||||
|
||||
public class LicenseClient
|
||||
{
|
||||
private readonly HttpClient httpClient;
|
||||
private readonly string apiKey;
|
||||
private readonly string serverUrl;
|
||||
|
||||
public LicenseClient(string apiKey, string serverUrl = "https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com")
|
||||
{
|
||||
this.apiKey = apiKey;
|
||||
this.serverUrl = serverUrl;
|
||||
|
||||
httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
|
||||
}
|
||||
|
||||
private string GetMachineId()
|
||||
{
|
||||
// CPU ID abrufen
|
||||
string cpuId = "";
|
||||
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT ProcessorId FROM Win32_Processor");
|
||||
foreach (ManagementObject obj in searcher.Get())
|
||||
{
|
||||
cpuId = obj["ProcessorId"].ToString();
|
||||
break;
|
||||
}
|
||||
return cpuId;
|
||||
}
|
||||
|
||||
private string GetHardwareHash()
|
||||
{
|
||||
string machineId = GetMachineId();
|
||||
string systemInfo = Environment.MachineName + Environment.OSVersion;
|
||||
|
||||
using (SHA256 sha256 = SHA256.Create())
|
||||
{
|
||||
byte[] hashBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(machineId + systemInfo));
|
||||
return BitConverter.ToString(hashBytes).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<LicenseActivationResponse> ActivateLicenseAsync(string licenseKey)
|
||||
{
|
||||
var requestData = new
|
||||
{
|
||||
license_key = licenseKey,
|
||||
machine_id = GetMachineId(),
|
||||
hardware_hash = GetHardwareHash(),
|
||||
os_info = new
|
||||
{
|
||||
os = "Windows",
|
||||
version = Environment.OSVersion.Version.ToString()
|
||||
},
|
||||
app_version = "1.0.0"
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(requestData);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = await httpClient.PostAsync($"{serverUrl}/api/license/activate", content);
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
return JsonSerializer.Deserialize<LicenseActivationResponse>(responseContent);
|
||||
}
|
||||
}
|
||||
|
||||
public class LicenseActivationResponse
|
||||
{
|
||||
public bool success { get; set; }
|
||||
public string message { get; set; }
|
||||
public int? activation_id { get; set; }
|
||||
public DateTime? expires_at { get; set; }
|
||||
}
|
||||
```
|
||||
|
||||
## Wichtige Hinweise
|
||||
|
||||
### Sicherheit
|
||||
- API-Keys niemals im Quellcode hartcodieren
|
||||
- SSL-Zertifikat immer prüfen (verify=True)
|
||||
- Hardware-Hash lokal zwischenspeichern
|
||||
|
||||
### Rate Limiting
|
||||
- Max. 100 Anfragen pro Minute pro API-Key
|
||||
- Heartbeat alle 15 Minuten (nicht öfter)
|
||||
|
||||
### Offline-Betrieb
|
||||
- 7 Tage Grace Period bei Verbindungsproblemen
|
||||
- Letzte gültige Lizenz lokal cachen
|
||||
- Bei Hardware-Änderung: Grace Period nutzen
|
||||
|
||||
### Fehlerbehandlung
|
||||
```python
|
||||
try:
|
||||
result = client.verify_license(license_key, activation_id)
|
||||
except requests.exceptions.ConnectionError:
|
||||
# Offline-Modus: Gecachte Lizenz prüfen
|
||||
if cached_license_valid():
|
||||
continue_execution()
|
||||
else:
|
||||
show_error("Keine Internetverbindung und Lizenz abgelaufen")
|
||||
except requests.exceptions.HTTPError as e:
|
||||
if e.response.status_code == 401:
|
||||
show_error("Ungültiger API-Key")
|
||||
elif e.response.status_code == 403:
|
||||
show_error("Lizenz ungültig oder abgelaufen")
|
||||
```
|
||||
|
||||
## Test-Zugangsdaten
|
||||
|
||||
Für Entwicklungszwecke:
|
||||
- Test API-Key: `test-api-key-12345`
|
||||
- Test Lizenz: `TEST-LICENSE-KEY-12345`
|
||||
|
||||
**WICHTIG:** Für Produktion eigene API-Keys und Lizenzen erstellen!
|
||||
|
||||
## Support
|
||||
|
||||
Bei Problemen:
|
||||
1. Logs prüfen: `docker logs license-server`
|
||||
2. API-Status: https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com/health
|
||||
3. Datenbank prüfen: Lizenzen und Aktivierungen
|
||||
@@ -1,29 +0,0 @@
|
||||
# License Server für v2-Docker
|
||||
|
||||
Dieser License Server ersetzt den Dummy-Container und bietet vollständige Lizenzmanagement-Funktionalität.
|
||||
|
||||
## Features
|
||||
- Lizenzaktivierung mit Hardware-Binding
|
||||
- Heartbeat/Verifizierung alle 15 Minuten
|
||||
- Versionskontrolle mit Update-Erzwingung
|
||||
- Offline Grace Period (7 Tage)
|
||||
- Multi-Aktivierung Support
|
||||
|
||||
## API Endpoints
|
||||
- POST `/api/license/activate` - Lizenz aktivieren
|
||||
- POST `/api/license/verify` - Lizenz verifizieren (Heartbeat)
|
||||
- POST `/api/version/check` - Version prüfen
|
||||
- GET `/api/license/info/{license_key}` - Lizenzinfo abrufen
|
||||
|
||||
## Deployment
|
||||
Der Server läuft im v2-Docker Stack und ist über nginx erreichbar:
|
||||
- Extern: https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com
|
||||
- Intern: http://license-server:8443
|
||||
|
||||
## Konfiguration
|
||||
Die Konfiguration erfolgt über die `.env` Datei:
|
||||
- `DATABASE_URL` - Verbindung zur PostgreSQL Datenbank
|
||||
- `SECRET_KEY` - JWT Secret Key für Token-Signierung
|
||||
|
||||
## Integration
|
||||
Siehe `LIZENZSERVER_ANLEITUNG.md` und die Beispiele in `client_examples/` für die Client-Integration.
|
||||
@@ -1,90 +0,0 @@
|
||||
# TODO - License Server & Admin Panel Erweiterungen
|
||||
|
||||
## 🎯 Phase 1: Admin Panel Integration (Priorität: Hoch)
|
||||
|
||||
### Neue Lizenz-Verwaltung im Admin Panel
|
||||
- [ ] Neuer Menüpunkt "Lizenzen" im Admin Panel
|
||||
- [ ] Dashboard mit Lizenz-Statistiken
|
||||
- [ ] Anzahl aktive/abgelaufene Lizenzen
|
||||
- [ ] Aktivierungen pro Lizenz
|
||||
- [ ] Grafische Auswertungen
|
||||
- [ ] Lizenz-Erstellung Formular
|
||||
- [ ] Lizenzschlüssel generieren
|
||||
- [ ] Ablaufdatum festlegen
|
||||
- [ ] Max. Aktivierungen definieren
|
||||
- [ ] Kundeninformationen speichern
|
||||
- [ ] Lizenz-Übersicht Tabelle
|
||||
- [ ] Suche/Filter-Funktionen
|
||||
- [ ] Status anzeigen (aktiv/abgelaufen/gesperrt)
|
||||
- [ ] Aktivierungen einsehen
|
||||
- [ ] Lizenzen deaktivieren/reaktivieren
|
||||
- [ ] API-Key Verwaltung
|
||||
- [ ] Neue API-Keys generieren
|
||||
- [ ] Bestehende Keys anzeigen/deaktivieren
|
||||
- [ ] Berechtigungen festlegen
|
||||
|
||||
## 🔒 Phase 2: Sicherheits-Optimierungen (Priorität: Mittel)
|
||||
|
||||
### Rate Limiting in Nginx
|
||||
- [ ] API Rate Limiting implementieren (10 Requests/Minute)
|
||||
- [ ] Burst-Handling konfigurieren
|
||||
- [ ] IP-basierte Limits für API-Endpoints
|
||||
|
||||
### Datenbank-Sicherheit
|
||||
- [ ] Separaten Read-Only DB-User für API erstellen
|
||||
- [ ] Admin-User mit eingeschränkten Rechten
|
||||
- [ ] Connection Pooling optimieren
|
||||
|
||||
### GeoIP-Blocking
|
||||
- [ ] GeoIP-Modul in Nginx installieren
|
||||
- [ ] Länder-Blacklist konfigurieren
|
||||
- [ ] VPN-Erkennung implementieren
|
||||
- [ ] Logging verdächtiger Zugriffe
|
||||
|
||||
## 📊 Phase 3: Monitoring & Backup (Priorität: Mittel)
|
||||
|
||||
### Monitoring-System
|
||||
- [ ] Prometheus einrichten
|
||||
- [ ] Grafana Dashboards erstellen
|
||||
- [ ] API-Zugriffe
|
||||
- [ ] Lizenz-Aktivierungen
|
||||
- [ ] System-Ressourcen
|
||||
- [ ] Alerting bei Anomalien
|
||||
- [ ] Zu viele fehlgeschlagene Aktivierungen
|
||||
- [ ] Verdächtige Zugriffsmuster
|
||||
- [ ] System-Ausfälle
|
||||
|
||||
### Backup-Strategie
|
||||
- [ ] Automatische tägliche DB-Backups
|
||||
- [ ] Backup-Rotation (30 Tage aufbewahren)
|
||||
- [ ] Verschlüsselung der Backups
|
||||
- [ ] Offsite-Backup zu Cloud-Storage
|
||||
- [ ] Restore-Tests durchführen
|
||||
|
||||
## 🚀 Phase 4: Performance & Features (Priorität: Niedrig)
|
||||
|
||||
### Performance-Optimierungen
|
||||
- [ ] Redis Cache für häufige Queries
|
||||
- [ ] Database Indexing optimieren
|
||||
- [ ] API Response Caching
|
||||
|
||||
### Erweiterte Features
|
||||
- [ ] Export-Funktionen (CSV/Excel)
|
||||
- [ ] Email-Benachrichtigungen
|
||||
- [ ] Bei Lizenz-Ablauf
|
||||
- [ ] Bei verdächtigen Aktivitäten
|
||||
- [ ] Lizenz-Templates für häufige Konfigurationen
|
||||
- [ ] Bulk-Operationen (mehrere Lizenzen gleichzeitig)
|
||||
|
||||
## 📝 Dokumentation
|
||||
|
||||
- [ ] API-Dokumentation erweitern
|
||||
- [ ] Admin Panel Benutzerhandbuch
|
||||
- [ ] Deployment-Guide aktualisieren
|
||||
- [ ] Troubleshooting-Guide erstellen
|
||||
|
||||
## Prioritäten:
|
||||
1. **Sofort**: Phase 1 - Admin Panel Integration
|
||||
2. **Nächste Woche**: Phase 2 - Sicherheits-Optimierungen
|
||||
3. **Nächster Monat**: Phase 3 - Monitoring & Backup
|
||||
4. **Bei Bedarf**: Phase 4 - Performance & Features
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren