staging todos - smart-village-solutions/sva-studio GitHub Wiki
Dieses Dokument listet alle Features auf, die vorbereitet aber noch nicht implementiert sind, weil externe Services (Slack, S3) fehlen.
Status: ✅ Lokal vorbereitet, ⏳ Externe Integration TODO
- ✅ AlertManager läuft auf
http://localhost:9093 - ✅ Prometheus sendet Alerts an AlertManager
- ✅ Alert-Rules definiert (siehe
dev/monitoring/prometheus/alert-rules.yml) - ✅ Webhook-Receiver konfiguriert (localhost:5001)
Datei: dev/monitoring/alertmanager/alertmanager.yml
# Zeile 35–40: Slack Webhook hinzufügen
receivers:
- name: 'critical-alerts'
slack_configs:
- api_url: 'https://hooks.slack.com/services/YOUR/WEBHOOK/HERE'
channel: '#monitoring-alerts'
title: '🚨 Critical Alert: {{ .GroupLabels.alertname }}'
text: |
{{ range .Alerts }}
*Summary:* {{ .Annotations.summary }}
*Description:* {{ .Annotations.description }}
*Workspace:* {{ .Labels.workspace_id }}
{{ end }}
send_resolved: trueSchritte:
- Slack App erstellen: https://api.slack.com/apps
- Incoming Webhook aktivieren
- Webhook URL in
.envsetzen:SLACK_WEBHOOK_URL=... -
alertmanager.ymlmit${SLACK_WEBHOOK_URL}anpassen - AlertManager neu starten:
docker compose -f docker-compose.monitoring.yml restart alertmanager
Test:
# Fake-Alert senden
curl -X POST http://localhost:9093/api/v2/alerts -H "Content-Type: application/json" -d '[
{
"labels": {"alertname": "TestAlert", "severity": "critical"},
"annotations": {"summary": "Test Alert", "description": "Dies ist ein Test"}
}
]'
# Slack sollte Nachricht erhaltenDatei: dev/monitoring/alertmanager/alertmanager.yml
# Zeile 45–50: Email SMTP hinzufügen
global:
smtp_smarthost: 'smtp.example.com:587'
smtp_from: '[email protected]'
smtp_auth_username: '${SMTP_USERNAME}'
smtp_auth_password: '${SMTP_PASSWORD}'
receivers:
- name: 'warning-alerts'
email_configs:
- to: '[email protected]'
headers:
Subject: '⚠️ Warning Alert: {{ .GroupLabels.alertname }}'Schritte:
- SMTP-Server konfigurieren (z.B. SendGrid, AWS SES, Mailgun)
- Credentials in
.envsetzen -
alertmanager.ymlaktualisieren - Test-Email senden (siehe oben)
Datei: dev/monitoring/alertmanager/alertmanager.yml
Für 24/7 On-Call Rotation:
receivers:
- name: 'critical-alerts'
pagerduty_configs:
- service_key: '${PAGERDUTY_SERVICE_KEY}'
description: '{{ .GroupLabels.alertname }} - {{ .Annotations.summary }}'Schritte:
- PagerDuty Account erstellen
- Integration Key generieren
-
.envupdaten:PAGERDUTY_SERVICE_KEY=... - AlertManager neu starten
Status: ✅ Lokal vorbereitet, ⏳ S3 Integration TODO
- ✅ Backup-Script:
dev/scripts/backup-monitoring.sh - ✅ Restore-Script:
dev/scripts/restore-monitoring.sh - ✅ Snapshots von Prometheus, Loki, AlertManager
- ✅ Checksums (SHA256) für Integrität
- ✅ Automatische Rotation (> 30 Tage löschen)
Datei: dev/scripts/backup-monitoring.sh (Zeile 95–96)
# Aktuell: Nur lokale Backups
# TODO: S3 Upload hinzufügen
# AWS S3 (wenn Production auf AWS)
aws s3 cp "${BACKUP_PATH}" "s3://sva-monitoring-backups/${BACKUP_NAME}" --recursive
# ODER: MinIO (Self-Hosted S3-kompatibel)
mc cp --recursive "${BACKUP_PATH}" minio/sva-backups/${BACKUP_NAME}Schritte:
- S3 Bucket erstellen:
sva-monitoring-backups - IAM User mit S3 Permissions erstellen
- AWS CLI konfigurieren:
aws configure - Script-Kommentar entfernen (Zeile 95)
- Cron-Job einrichten (siehe unten)
Ziel: Täglich um 02:00 UTC Backup durchführen
Datei: /etc/cron.d/sva-monitoring-backup (auf Host-Server)
# Daily Backup at 2 AM UTC
0 2 * * * /path/to/sva-studio/dev/scripts/backup-monitoring.sh >> /var/log/sva-backup.log 2>&1Alternative: SystemD Timer (für moderne Linux Systeme)
# /etc/systemd/system/sva-backup.timer
[Unit]
Description=SVA Monitoring Daily Backup
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
[Install]
WantedBy=timers.target
# /etc/systemd/system/sva-backup.service
[Unit]
Description=SVA Monitoring Backup Service
[Service]
Type=oneshot
ExecStart=/path/to/sva-studio/dev/scripts/backup-monitoring.shAktivieren:
sudo systemctl enable sva-backup.timer
sudo systemctl start sva-backup.timer
sudo systemctl list-timers # VerifyZiel: Überwachen ob Backups erfolgreich laufen
Datei: dev/scripts/backup-monitoring.sh (am Ende hinzufügen)
# Prometheus Pushgateway Metric
cat <<EOF | curl --data-binary @- http://localhost:9091/metrics/job/backup
# TYPE sva_backup_duration_seconds gauge
sva_backup_duration_seconds{service="monitoring"} ${BACKUP_DURATION}
# TYPE sva_backup_size_bytes gauge
sva_backup_size_bytes{service="monitoring"} $(du -sb "${BACKUP_PATH}" | cut -f1)
# TYPE sva_backup_timestamp gauge
sva_backup_timestamp{service="monitoring"} $(date +%s)
EOFPrometheus Alert hinzufügen:
# dev/monitoring/prometheus/alert-rules.yml
- alert: BackupFailed
expr: |
(time() - sva_backup_timestamp{service="monitoring"}) > 86400 * 2
for: 1h
labels:
severity: critical
annotations:
summary: "Backup seit > 48h nicht durchgeführt"
description: "Letzter Backup-Timestamp: {{ $value }}s ago"Ziel: Automatisierte Restore-Tests in Dev-Umgebung
Datei: dev/scripts/test-restore.sh (neu erstellen)
#!/usr/bin/env bash
# Wöchentlicher Restore-Test in separate Docker-Umgebung
# 1. Neuesten Backup finden
LATEST_BACKUP=$(ls -td backups/monitoring-backup-* | head -1)
# 2. Test-Compose starten
docker compose -f docker-compose.monitoring-test.yml up -d
# 3. Restore durchführen
./dev/scripts/restore-monitoring.sh "${LATEST_BACKUP}"
# 4. Data Integrity Check
# ... (Metriken vergleichen)
# 5. Aufräumen
docker compose -f docker-compose.monitoring-test.yml downCron:
# Weekly Restore Test (Sonntag 03:00)
0 3 * * 0 /path/to/sva-studio/dev/scripts/test-restore.sh >> /var/log/sva-restore-test.log 2>&1Status: ✅ Implementiert (docker-compose.monitoring.yml)
- ✅ Memory Limits: Prometheus (1GB), Loki (512MB), Grafana (512MB)
- ✅ CPU Limits gesetzt
- ✅ Alerts bei > 80% Memory Usage
Ziel: Detaillierte Container-Resource-Metriken
Datei: docker-compose.monitoring.yml (Service hinzufügen)
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.0
container_name: sva-studio-cadvisor
ports:
- "127.0.0.1:8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
restart: unless-stoppedPrometheus Config:
# dev/monitoring/prometheus/prometheus.yml
scrape_configs:
- job_name: "cadvisor"
static_configs:
- targets: ["cadvisor:8080"]-
Alerting
- Slack Webhook konfiguriert
- Test-Alert erfolgreich empfangen
- Email SMTP konfiguriert
-
Backup
- S3 Bucket erstellt
- Cron-Job eingerichtet
- Restore-Test durchgeführt
- Backup-Monitoring aktiv
-
Monitoring
- cAdvisor deployed (optional)
- Resource Alerts getestet
- Dashboards zugänglich
-
High Availability
- Redis Cluster/Sentinel für Sessions
- Prometheus Federation oder Grafana Mimir
- AlertManager Cluster (3 Nodes)
-
Security
- TLS für alle Services
- Authentifizierung für Grafana (OAuth2/SSO)
- Network Policies (Kubernetes)
-
Compliance
- Backup-Retention Policy dokumentiert
- DSGVO: Logs > 90 Tage löschen
- Audit-Log für Admin-Zugriffe
- Prometheus Alerting: https://prometheus.io/docs/alerting/latest/configuration/
- Slack Incoming Webhooks: https://api.slack.com/messaging/webhooks
- AWS S3 CLI: https://docs.aws.amazon.com/cli/latest/reference/s3/
- MinIO Client: https://min.io/docs/minio/linux/reference/minio-mc.html
- cAdvisor: https://github.com/google/cadvisor
Erstellt: 2026-02-08 Nächstes Review: Bei Staging-Deployment Owner: DevOps/SRE Team