diff --git a/API_REFERENCE.md b/API_REFERENCE.md index b83a647..f3aac34 100644 --- a/API_REFERENCE.md +++ b/API_REFERENCE.md @@ -12,10 +12,12 @@ X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ``` **API Key Management:** -- API keys can be managed through the Admin Panel under Administration → API Keys +- API keys can be managed through the Admin Panel under "Lizenzserver Administration" → "System-API-Key generieren" - Keys follow the format: `AF-YYYY-[32 random characters]` - Only one system API key is active at a time - Regenerating the key will immediately invalidate the old key +- The initial API key is automatically generated on first startup +- To retrieve the initial API key from database: `SELECT api_key FROM system_api_key WHERE id = 1;` **Error Response (401 Unauthorized):** ```json @@ -28,6 +30,8 @@ X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ## License Server API +**Base URL:** `https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com` + ### Public Endpoints #### GET / @@ -136,7 +140,7 @@ Get license information. **Headers:** ``` -X-API-Key: your-api-key +X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ``` **Response:** @@ -168,6 +172,8 @@ X-API-Key: your-api-key ### Session Management API Endpoints +**Note:** Session endpoints require that the client application is configured in the `client_configs` table. The default client "Account Forger" is pre-configured. + #### POST /api/license/session/start Start a new session for a license. @@ -235,7 +241,7 @@ Check for available updates. **Headers:** ``` -X-API-Key: your-api-key +X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ``` **Request:** @@ -246,20 +252,38 @@ X-API-Key: your-api-key } ``` -**Response:** Update availability status with version info +**Response:** +```json +{ + "update_available": true, + "latest_version": "1.1.0", + "download_url": "https://example.com/download/v1.1.0", + "release_notes": "Bug fixes and performance improvements" +} +``` #### GET /api/version/latest Get latest version information. **Headers:** ``` -X-API-Key: your-api-key +X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ``` -**Response:** Latest version information +**Response:** +```json +{ + "version": "1.1.0", + "release_date": "2025-06-20", + "download_url": "https://example.com/download/v1.1.0", + "release_notes": "Bug fixes and performance improvements" +} +``` ## Admin Panel API +**Base URL:** `https://admin-panel-undso.z5m7q9dk3ah2v1plx6ju.com` + ### Customer API Endpoints #### GET /api/customers @@ -791,7 +815,7 @@ All errors return JSON with `error`, `code`, and `status` fields. Example request with required headers: ```bash -curl -X POST http://localhost/api/license/activate \ +curl -X POST https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com/api/license/activate \ -H "X-API-Key: AF-2025-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ @@ -810,7 +834,13 @@ curl -X POST http://localhost/api/license/activate \ - Username: `w@rh@mm3r` / Password: `Warhammer123!` - API Key: Generated in Admin Panel under "Lizenzserver Administration" +### Getting the Initial API Key +If you need to retrieve the API key directly from the database: +```bash +docker exec -it v2_postgres psql -U postgres -d v2_db -c "SELECT api_key FROM system_api_key WHERE id = 1;" +``` + ### Test Endpoints -- Admin Panel: `http://localhost:80` -- License Server API: `http://localhost:80/api` +- Admin Panel: `https://admin-panel-undso.z5m7q9dk3ah2v1plx6ju.com/` +- License Server API: `https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com/` - Monitoring: See OPERATIONS_GUIDE.md \ No newline at end of file diff --git a/OPERATIONS_GUIDE.md b/OPERATIONS_GUIDE.md index 65f5279..af2baf6 100644 --- a/OPERATIONS_GUIDE.md +++ b/OPERATIONS_GUIDE.md @@ -1,5 +1,19 @@ # V2-Docker Operations Guide +## WICHTIGER HINWEIS + +**NICHT VERWENDEN (für <100 Kunden nicht benötigt):** +- ❌ Redis - System verwendet direkte DB-Verbindungen +- ❌ RabbitMQ - System verwendet synchrone Verarbeitung +- ❌ Prometheus/Grafana/Alertmanager - Integrierte Überwachung ist ausreichend +- ❌ Externe Monitoring-Tools - Admin Panel hat alle benötigten Metriken + +**NUR DIESE SERVICES VERWENDEN:** +- ✅ PostgreSQL (db) +- ✅ License Server (license-server) +- ✅ Admin Panel (admin-panel) +- ✅ Nginx Proxy (nginx-proxy) + ## Deployment ### Prerequisites @@ -16,12 +30,12 @@ Database initializes automatically via init.sql. ### Standard-Zugangsdaten #### Admin Panel -- URL: http://localhost:80 (oder konfigurierte Domain) +- URL: https://admin-panel-undso.z5m7q9dk3ah2v1plx6ju.com/ - User 1: `rac00n` / `1248163264` - User 2: `w@rh@mm3r` / `Warhammer123!` #### License Server API -- URL: http://localhost:80/api (über Nginx Proxy) +- URL: https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com/ - API Key: Wird im Admin Panel unter "Lizenzserver Administration" verwaltet - Header: `X-API-Key: ` @@ -31,41 +45,38 @@ Database initializes automatically via init.sql. ```yaml license-server: build: ./v2_lizenzserver - container_name: v2_license_server + container_name: license-server environment: - - DATABASE_URL=postgresql://adminuser:supergeheimespasswort@postgres:5432/meinedatenbank + - DATABASE_URL=postgresql://adminuser:supergeheimespasswort@db:5432/meinedatenbank - JWT_SECRET=your-secret-jwt-key-here-minimum-32-chars - - REDIS_HOST=redis - - RABBITMQ_HOST=rabbitmq + # NICHT VERWENDEN: + # - REDIS_HOST=redis # NICHT BENÖTIGT + # - RABBITMQ_HOST=rabbitmq # NICHT BENÖTIGT expose: - - "8000" + - "8443" networks: - backend - - monitoring depends_on: - - postgres - - redis - - rabbitmq + - db # Nur PostgreSQL wird benötigt ``` #### Admin Panel ```yaml admin-panel: build: ./v2_adminpanel - container_name: v2_admin_panel + container_name: admin-panel environment: - - DATABASE_URL=postgresql://adminuser:supergeheimespasswort@postgres:5432/meinedatenbank + - DATABASE_URL=postgresql://adminuser:supergeheimespasswort@db:5432/meinedatenbank - SECRET_KEY=supersecretkey - JWT_SECRET=your-secret-jwt-key-here-minimum-32-chars - - REDIS_HOST=redis + # NICHT VERWENDEN: + # - REDIS_HOST=redis # NICHT BENÖTIGT expose: - "5000" networks: - backend - - monitoring depends_on: - - postgres - - redis + - db # Nur PostgreSQL wird benötigt volumes: - ./backups:/app/backups ``` @@ -74,7 +85,7 @@ admin-panel: ```yaml nginx: build: ./v2_nginx - container_name: v2_nginx + container_name: nginx-proxy ports: - "80:80" networks: @@ -91,82 +102,33 @@ nginx: ## Monitoring -### Prometheus Configuration +**WICHTIG**: Externe Monitoring-Tools werden NICHT verwendet! Die folgenden Konfigurationen sind VERALTET und sollten IGNORIERT werden. -#### Scrape Configs -```yaml -scrape_configs: - - job_name: 'license-server' - static_configs: - - targets: ['license-server:8000'] - metrics_path: /metrics - - - job_name: 'admin-panel' - static_configs: - - targets: ['admin-panel:5000'] - metrics_path: /metrics - - - job_name: 'postgres' - static_configs: - - targets: ['postgres-exporter:9187'] - - - job_name: 'redis' - static_configs: - - targets: ['redis-exporter:9121'] - - - job_name: 'node' - static_configs: - - targets: ['node-exporter:9100'] - - - job_name: 'cadvisor' - static_configs: - - targets: ['cadvisor:8080'] -``` +### Integrierte Überwachung (Admin Panel) -#### 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` +**HINWEIS**: Externe Monitoring-Tools (Grafana, Prometheus, etc.) werden NICHT verwendet! -### Grafana Dashboards +Das Admin Panel bietet alle benötigten Überwachungsfunktionen: -1. **System Overview Dashboard** - - CPU and memory usage - - Network traffic - - Disk usage - - Container status +1. **Dashboard** (Startseite) + - Aktive Lizenzen + - Aktive Sessions + - Heartbeat-Statistiken + - System-Metriken -2. **License Server Dashboard** - - Active licenses - - Heartbeat frequency - - API response times - - Error rates +2. **Log-Seite** + - Vollständiges Audit-Log aller Aktionen + - Filterbar nach Benutzer, Aktion, Entität + - Export in Excel/CSV -3. **Database Performance Dashboard** - - Query performance - - Connection pool status - - Table sizes - - Slow queries +3. **Lizenz-Übersicht** + - Aktive/Inaktive Lizenzen + - Session-Status in Echtzeit + - Letzte Heartbeats -### Accessing Monitoring - -- Prometheus: http://localhost:9090 -- Grafana: http://localhost:3001 - - Default Login: admin/admin - - Vorkonfigurierte Dashboards: - - System Overview - - License Server Metrics - - Database Performance -- Alertmanager: http://localhost:9093 - -### Monitoring Stack Services -- PostgreSQL Exporter: Sammelt DB-Metriken (Port 9187) -- Redis Exporter: Sammelt Cache-Metriken (Port 9121) -- Node Exporter: System-Level Metriken (Port 9100) -- cAdvisor: Container-Metriken (Port 8080) -- Prometheus: Metrics Collection (Port 9090) -- Grafana: Visualization (Port 3000) -- Alertmanager: Alert Management (Port 9093) +4. **Metriken-Endpoint** + - `/metrics` im License Server für basic monitoring + - Zeigt aktuelle Anfragen, Fehler, etc. ## Features Overview @@ -232,10 +194,10 @@ DROP TABLE IF EXISTS license_heartbeats_2024_01; #### Backup Procedures ```bash # Backup -docker exec v2_postgres pg_dump -U adminuser meinedatenbank | gzip > backup_$(date +%Y%m%d).sql.gz +docker exec db pg_dump -U adminuser meinedatenbank | gzip > backup_$(date +%Y%m%d).sql.gz # Restore -gunzip -c backup_20250619.sql.gz | docker exec -i v2_postgres psql -U adminuser meinedatenbank +gunzip -c backup_20250619.sql.gz | docker exec -i db psql -U adminuser meinedatenbank ``` ##### Integriertes Backup-System @@ -320,13 +282,13 @@ db: #### License Server Not Responding - Check status: `docker ps | grep license` -- View logs: `docker logs v2_license_server --tail 100` -- Test health: `docker exec v2_nginx curl http://license-server:8000/health` +- View logs: `docker logs license-server --tail 100` +- Test health: `docker exec nginx-proxy curl http://license-server:8443/health` #### Database Connection Issues -- Check status: `docker exec v2_postgres pg_isready` +- Check status: `docker exec db pg_isready` - Test connection: Use psql from admin panel container -- Check logs: `docker logs v2_postgres --tail 50` +- Check logs: `docker logs db --tail 50` #### High Memory Usage 1. Check container stats: `docker stats` @@ -342,7 +304,7 @@ Quick health check script: docker ps --format "table {{.Names}}\t{{.Status}}" # Key endpoints -curl -s http://localhost/api/health +curl -s https://api-software-undso.z5m7q9dk3ah2v1plx6ju.com/health curl -s http://localhost:9090/-/healthy ``` @@ -381,17 +343,18 @@ server { server_name api-software-undso.z5m7q9dk3ah2v1plx6ju.com; location / { - proxy_pass https://license_servers; + proxy_pass http://license_servers; proxy_http_version 1.1; proxy_set_header Connection ""; } } ``` -#### Scaling Considerations -- Redis für Session-Sharing zwischen Instanzen -- RabbitMQ für asynchrone Task-Verteilung -- Sticky Sessions bei Bedarf aktivieren +#### Scaling Considerations (für >100 Kunden) +**HINWEIS**: Für <100 Kunden ist keine Skalierung notwendig! +- Direkter DB-Zugriff ist ausreichend (kein Redis benötigt) +- Synchrone Verarbeitung ist schnell genug (kein RabbitMQ benötigt) +- Single Instance ist völlig ausreichend ### Database Scaling - Read replicas for reporting diff --git a/SYSTEM_DOCUMENTATION.md b/SYSTEM_DOCUMENTATION.md index f52d42e..bfacb62 100644 --- a/SYSTEM_DOCUMENTATION.md +++ b/SYSTEM_DOCUMENTATION.md @@ -1,8 +1,24 @@ # V2-Docker System Documentation +## WICHTIGER HINWEIS FÜR ZUKÜNFTIGE ENTWICKLUNG + +**DIESE SERVICES WERDEN NICHT VERWENDET:** +- ❌ Redis - NICHT BENÖTIGT für <100 Kunden +- ❌ RabbitMQ - NICHT BENÖTIGT für <100 Kunden +- ❌ Prometheus - NICHT BENÖTIGT +- ❌ Grafana - NICHT BENÖTIGT +- ❌ Alertmanager - NICHT BENÖTIGT +- ❌ Externe Monitoring-Tools - NICHT BENÖTIGT + +**Das System verwendet NUR:** +- ✅ PostgreSQL für alle Datenspeicherung +- ✅ Integrierte Überwachung im Admin Panel +- ✅ Direkte Datenbankverbindungen ohne Cache +- ✅ Synchrone Verarbeitung ohne Message Queue + ## 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. +V2-Docker is a streamlined system featuring a License Server, Admin Panel, and Lead Management with integrated monitoring. This document consolidates all architecture and implementation details. ## License Server Architecture @@ -221,17 +237,22 @@ Pre-configured dashboards and alerts for system health. ### Docker Services #### Aktive Services -- `v2_postgres`: PostgreSQL database (Port 5432) -- `v2_admin_panel`: Admin interface (interner Port 5000) -- `v2_nginx`: Reverse proxy (Port 80) -- `v2_license_server`: License server (interner Port 8000) -- `v2_redis`: Redis cache (Port 6379) -- `v2_rabbitmq`: Message queue (Ports 5672, 15672) +- `db`: PostgreSQL database (Port 5432) +- `admin-panel`: Admin interface (interner Port 5000) +- `nginx-proxy`: Reverse proxy (Ports 80, 443) +- `license-server`: License server (interner Port 8443) -See monitoring configuration in `monitoring/docker-compose.monitoring.yml`. +#### NICHT VERWENDETE Services (DO NOT USE) +- ❌ `redis`: Redis cache - NICHT BENÖTIGT für <100 Kunden +- ❌ `rabbitmq`: Message queue - NICHT BENÖTIGT für <100 Kunden +- ❌ External monitoring (Prometheus, Grafana, Alertmanager) - NICHT BENÖTIGT +- ❌ `monitoring/docker-compose.monitoring.yml` - NICHT VERWENDEN + +**WICHTIG**: Das System verwendet KEINE externen Monitoring-Tools, Redis oder RabbitMQ. Die eingebaute Überwachung im Admin Panel ist ausreichend für <100 Kunden. ### Environment Configuration Required: DATABASE_URL, SECRET_KEY, JWT_SECRET +NOT Required: REDIS_HOST, RABBITMQ_HOST (diese NICHT konfigurieren) See docker-compose.yaml for all environment variables. @@ -240,5 +261,5 @@ System is production-ready with all core features implemented: - ✅ License management with session enforcement - ✅ Lead management CRM - ✅ Resource pool management -- ✅ Complete monitoring stack +- ✅ Integrierte Überwachung (Admin Panel) - ✅ Backup and audit systems \ No newline at end of file