stage22: Abschluss & Production Readiness — E2E-Tests, CHANGELOG, Dokumentation
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- **Docker** (≥ 24.0) und **Docker Compose** (≥ 2.23)
|
||||
- Mindestens 2 GB freier RAM
|
||||
- Zugang zu einem OpenAI-kompatiblen LLM-Endpunkt
|
||||
- PostgreSQL 16+ (wird mit docker-compose bereitgestellt)
|
||||
|
||||
## 2. Konfiguration
|
||||
|
||||
@@ -18,17 +19,17 @@ Trage folgende Werte ein:
|
||||
|
||||
```env
|
||||
# LLM (verpflichtend)
|
||||
NSCT_LLM_BASE_URL=http://192.168.80.199:8030/openai/v1
|
||||
NSCT_LLM_MODEL=Qwen3.6-6-35B
|
||||
NSCT_LLM_BASE_URL=http://your-llm-host:8030/openai/v1
|
||||
NSCT_LLM_MODEL=Qwen3.6-35B
|
||||
NSCT_LLM_MAX_CONCURRENCY=3
|
||||
NSCT_LLM_API_KEY=<dein-api-key>
|
||||
|
||||
# Vision (optional)
|
||||
NSCT_VISION_BASE_URL=http://192.168.80.199:8030/openai/visual/v1
|
||||
NSCT_VISION_MODEL=Qwen2-VL-3B
|
||||
NSCT_VISION_BASE_URL=http://your-vision-host:8030/openai/visual/v1
|
||||
NSCT_VISION_MODEL=Qwen2.5-VL-3B
|
||||
|
||||
# Audio (optional)
|
||||
NSCT_AUDIO_BASE_URL=http://192.168.80.199:8030/hermes-audio
|
||||
NSCT_AUDIO_BASE_URL=http://your-audio-host:8030/hermes-audio
|
||||
NSCT_AUDIO_MODEL=default
|
||||
|
||||
# PostgreSQL
|
||||
@@ -102,14 +103,16 @@ docker compose logs -f nsct-api
|
||||
|
||||
- `.env` **niemals** committen — `.gitignore` behandelt das
|
||||
- Verwende ein Secrets-Management Tool (Hashicorp Vault, AWS Secrets Manager)
|
||||
- API-Authentifizierung wird in Stage 2+ implementiert
|
||||
- Network-Policies für Docker (nur interner Traffic zwischen Services)
|
||||
- Non-Root-Docker-Container mit Read-Only-Filesystem
|
||||
- Dropped Capabilities (`cap_drop: [ALL]`)
|
||||
|
||||
### 5.2 Skalierung
|
||||
|
||||
- Derzeit: Single-Instance (kein horizontal scaling)
|
||||
- PostgreSQL: Connection Pooling über `pool_size=10, max_overflow=20`
|
||||
- LLM: Max. `NSCT_LLM_MAX_CONCURRENCY` parallele Requests (standard: 3)
|
||||
- LLM: Max. `NSCT_LLM_MAX_CONCURRENCY` parallele Requests (default: 3)
|
||||
- Concurrency-Semaphore im Provider-Layer
|
||||
|
||||
### 5.3 Datenpersistenz
|
||||
|
||||
@@ -122,8 +125,7 @@ volumes:
|
||||
driver: local
|
||||
```
|
||||
|
||||
Für Production: Verwende ein volumen-Plugin mit Backup-Unterstützung
|
||||
(например, Velero für Kubernetes).
|
||||
Für Production: Verwende ein volumen-Plugin mit Backup-Unterstützung.
|
||||
|
||||
### 5.4 Monitoring
|
||||
|
||||
@@ -136,6 +138,18 @@ docker compose logs --tail=100 nsct-api
|
||||
|
||||
# DB-Größe
|
||||
docker exec -it nsct-postgres psql -U nsct -d nsct -c "SELECT pg_database_size('nsct');"
|
||||
|
||||
# Prometheus Metrics
|
||||
curl http://localhost:8080/metrics
|
||||
```
|
||||
|
||||
### 5.5 Healthcheck
|
||||
|
||||
Das Dockerfile enthält einen HEALTHCHECK:
|
||||
|
||||
```dockerfile
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/health || exit 1
|
||||
```
|
||||
|
||||
## 6. Troubleshooting
|
||||
@@ -166,7 +180,7 @@ docker compose logs postgres
|
||||
|
||||
```bash
|
||||
# Network-Ping zum LLM-Host
|
||||
docker compose run --rm nsct-api curl -v http://192.168.80.199:8030/openai/v1/models
|
||||
docker compose run --rm nsct-api curl -v http://your-llm-host:8030/openai/v1/models
|
||||
```
|
||||
|
||||
## 7. Update / Migration
|
||||
@@ -180,4 +194,31 @@ docker compose up --build -d
|
||||
|
||||
# Datenbank-Migrationen (wenn benötigt)
|
||||
# werden in späteren Stages mit Alembic implementiert
|
||||
```
|
||||
```
|
||||
|
||||
## 8. CI/CD
|
||||
|
||||
### Unit Tests
|
||||
|
||||
```bash
|
||||
.docker compose run --rm nsct-api python -m pytest tests/ -v
|
||||
```
|
||||
|
||||
### Docker Build
|
||||
|
||||
```bash
|
||||
docker compose build nsct-api
|
||||
docker push your-registry/nsct:latest
|
||||
```
|
||||
|
||||
## 9. Production Checklist
|
||||
|
||||
- [ ] `.env` nicht in Git
|
||||
- [ ] Strong PostgreSQL Password
|
||||
- [ ] LLM API Key konfiguriert
|
||||
- [ ] Resource Limits gesetzt
|
||||
- [ ] Healthcheck konfiguriert
|
||||
- [ ] Logging zu externem System (ELK, Grafana, etc.)
|
||||
- [ ] Backup-Policy für PostgreSQL Volume
|
||||
- [ ] Network Policies für Docker
|
||||
- [ ] Monitoring Alerts (Prometheus + Alertmanager)
|
||||
Reference in New Issue
Block a user