From 1c8cd508bd5e1cc2d541f5d46517787fd67e7f39 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Wed, 21 Oct 2026 16:03:16 +0200 Subject: [PATCH] docs(storage): replace Alarik with RustFS --- .env.example | 13 +-- Makefile | 12 +-- docker/backup/README.md | 28 +++---- docker/docker-compose.backup.yml | 18 ++-- docker/docker-compose.prod.yml | 76 ++++++++--------- docker/docker-compose.yml | 38 +++------ .../{backup-alarik.sh => backup-rustfs.sh} | 30 +++---- docker/scripts/backup.sh | 16 ++-- docker/scripts/restore.sh | 10 +-- docs/MASTER_SPECIFICATION.md | 82 ++++++++----------- docs/README.md | 2 +- docs/hangfire-usage.md | 4 +- docs/implementation.md | 10 +-- docs/signalr-usage.md | 2 +- docs/specs.md | 12 +-- readme.md | 39 ++++++--- scripts/ci/validate-compose.sh | 2 +- 17 files changed, 191 insertions(+), 203 deletions(-) rename docker/scripts/{backup-alarik.sh => backup-rustfs.sh} (86%) diff --git a/.env.example b/.env.example index ca433e2..4791557 100644 --- a/.env.example +++ b/.env.example @@ -28,12 +28,13 @@ ASPNETCORE_URLS=http://+:8080 # CORS (default: allow all origins — restrict in production) Cors__AllowedOrigins=* -# Alarik (S3-compatible object storage) -ALARIK_API_PORT=9000 -ALARIK_CONSOLE_PORT=9001 -ALARIK_ADMIN_USERNAME=heimdall -ALARIK_ADMIN_PASSWORD=heimdall123 -ALARIK_JWT=ChangeMeAtLeast32BytesLongKeyInProd! +# RustFS (S3-compatible object storage) +RUSTFS_API_PORT=9000 +RUSTFS_CONSOLE_PORT=9001 +RUSTFS_ACCESS_KEY=heimdall +RUSTFS_SECRET_KEY=ChangeMeAtLeast32BytesLongKeyInProd! +RUSTFS_ENDPOINT=http://rustfs:9000 +RUSTFS_BUCKET=heimdall # Sentry / GlitchTip (error tracking, performance, structured logs) # Primary: Sentry__Dsn (ASP.NET Core config convention) diff --git a/Makefile b/Makefile index 4de7a02..8f4aaf4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # ─── Heimdall — Development & Deployment ────────────────────────── .DEFAULT_GOAL := help -.PHONY: help build test test-watch clean docker-up docker-down docker-build docker-logs docker-ps docker-reset deploy version version-tag version-tag-agent migration-add migration-remove dev-api dev-web backup backup-alarik restore restore-file backup-test backup-up backup-down backup-logs +.PHONY: help build test test-watch clean docker-up docker-down docker-build docker-logs docker-ps docker-reset deploy version version-tag version-tag-agent migration-add migration-remove dev-api dev-web backup backup-rustfs restore restore-file backup-test backup-up backup-down backup-logs help: ## Show this help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \ @@ -82,15 +82,15 @@ dev-web: ## Run combined API+Web+Jobs in development mode (single process) # ─── Backup & Restore ────────────────────────────────────────── -backup: ## Run PostgreSQL backup (daily — pg_dump + upload to Alarik/S3) +backup: ## Run PostgreSQL backup (daily — pg_dump + upload to RustFS/S3) chmod +x docker/scripts/backup.sh POSTGRES_HOST=localhost POSTGRES_PORT=5432 \ POSTGRES_DB=heimdall POSTGRES_USER=heimdall POSTGRES_PASSWORD=heimdall \ ./docker/scripts/backup.sh -backup-alarik: ## Run Alarik/S3 mirror backup (weekly — snapshots + recordings) - chmod +x docker/scripts/backup-alarik.sh - ./docker/scripts/backup-alarik.sh +backup-rustfs: ## Run RustFS/S3 mirror backup (weekly — snapshots + recordings) + chmod +x docker/scripts/backup-rustfs.sh + ./docker/scripts/backup-rustfs.sh restore: ## Restore PostgreSQL from latest backup (⚠️ drops current DB) chmod +x docker/scripts/restore.sh @@ -109,7 +109,7 @@ backup-test: ## Run backup/restore E2E test (isolated PostgreSQL) chmod +x docker/scripts/test-backup-restore.sh ./docker/scripts/test-backup-restore.sh -backup-up: ## Start backup cron service (daily PG + weekly Alarik mirror) +backup-up: ## Start backup cron service (daily PG + weekly RustFS mirror) docker compose -f docker/docker-compose.yml -f docker/docker-compose.backup.yml up -d backup backup-down: ## Stop backup cron service diff --git a/docker/backup/README.md b/docker/backup/README.md index cf05166..77093aa 100644 --- a/docker/backup/README.md +++ b/docker/backup/README.md @@ -1,13 +1,13 @@ # Heimdall — Backup & Restore -Sauvegarde automatisée de PostgreSQL (quotidien) et Alarik/S3 (hebdomadaire) avec test de restauration. +Sauvegarde automatisée de PostgreSQL (quotidien) et RustFS/S3 (hebdomadaire) avec test de restauration. ## Vue d'ensemble | Composant | Fréquence | Script | Rétention | |---|---|---|---| | PostgreSQL `pg_dump` | Quotidien 02:00 UTC | `docker/scripts/backup.sh` | 30 jours (local) + 30 jours (S3) | -| Alarik `mc mirror` | Hebdo dimanche 03:00 UTC | `docker/scripts/backup-alarik.sh` | 12 semaines | +| RustFS `mc mirror` | Hebdo dimanche 03:00 UTC | `docker/scripts/backup-rustfs.sh` | 12 semaines | | Test de restauration | Manuel / CI | `docker/scripts/test-backup-restore.sh` | — | ## Activation @@ -20,7 +20,7 @@ docker compose -f docker-compose.yml -f docker-compose.backup.yml up -d ``` Le service `backup` tourne dans un conteneur PostgreSQL 17-alpine avec crontab interne. -Les dumps sont stockés dans le volume `backup_data` et uploadés vers Alarik/S3 si configuré. +Les dumps sont stockés dans le volume `backup_data` et uploadés vers RustFS/S3 si configuré. ### Option 2 — Profil dans docker-compose.prod.yml @@ -40,12 +40,12 @@ Le service backup est activé via le profil Docker Compose `backup`. | `POSTGRES_DB` | `heimdall` | Nom de la base | | `POSTGRES_USER` | `heimdall` | Utilisateur PostgreSQL | | `POSTGRES_PASSWORD` | `heimdall` | Mot de passe PostgreSQL | -| `ALARIK_ENDPOINT` | — | Endpoint S3/Alarik (ex: `http://alarik:9000`) | -| `ALARIK_ACCESS_KEY` | — | Clé d'accès S3 | -| `ALARIK_SECRET_KEY` | — | Clé secrète S3 | -| `ALARIK_BUCKET` | `heimdall` | Bucket S3 | +| `RUSTFS_ENDPOINT` | `http://rustfs:9000` (Compose) | Endpoint S3/RustFS | +| `RUSTFS_ACCESS_KEY` | — | Clé d'accès S3 | +| `RUSTFS_SECRET_KEY` | — | Clé secrète S3 | +| `RUSTFS_BUCKET` | `heimdall` | Bucket S3 | | `BACKUP_RETENTION_DAYS` | `30` | Rétention jours (PostgreSQL) | -| `BACKUP_RETENTION_WEEKS` | `12` | Rétention semaines (Alarik) | +| `BACKUP_RETENTION_WEEKS` | `12` | Rétention semaines (RustFS) | | `BACKUP_LOCAL_DIR` | `/backups` | Répertoire local dans le conteneur | ## Structure des backups @@ -62,10 +62,10 @@ s3://heimdall/backup/postgresql/ └── ... ``` -### Alarik (S3 mirror) +### RustFS (S3 mirror) ``` -s3://heimdall/backup/alarik/ +s3://heimdall/backup/rustfs/ ├── 2026-W35/ │ ├── MANIFEST.txt │ ├── snapshots/... @@ -87,10 +87,10 @@ docker exec heimdall-backup /scripts/backup.sh docker exec heimdall-backup /scripts/backup.sh --dry-run ``` -### Lancer un mirror Alarik +### Lancer un mirror RustFS ```bash -docker exec heimdall-backup /scripts/backup-alarik.sh +docker exec heimdall-backup /scripts/backup-rustfs.sh ``` ### Restaurer PostgreSQL @@ -170,7 +170,7 @@ docker compose up -d # - Sites accessibles via l'UI # - Agents connectés (heartbeat) # - Événements présents -# - Snapshots accessibles dans Alarik +# - Snapshots accessibles dans RustFS ``` ### Vérification post-restauration @@ -180,7 +180,7 @@ docker compose up -d | Sites | `curl -s http://localhost:5000/api/sites -H "Authorization: Bearer $TOKEN" \| jq '.[].name'` | | Agents | `curl -s http://localhost:5000/api/agents -H "Authorization: Bearer $TOKEN" \| jq '.[].name'` | | Événements | `curl -s "http://localhost:5000/api/cameras/{id}/events" -H "Authorization: Bearer $TOKEN" \| jq 'length'` | -| Alarik | Ouvrir `http://localhost:9001` — vérifier les snapshots | +| RustFS | Ouvrir `http://localhost:9001` — vérifier les snapshots | ## Logs diff --git a/docker/docker-compose.backup.yml b/docker/docker-compose.backup.yml index 5caae7d..96a2f6c 100644 --- a/docker/docker-compose.backup.yml +++ b/docker/docker-compose.backup.yml @@ -1,12 +1,12 @@ # ─── Heimdall — Backup Cron Service ────────────────────────────── # Overlay for docker-compose.yml: adds a cron container that runs -# PostgreSQL backups daily and Alarik mirrors weekly. +# PostgreSQL backups daily and RustFS mirrors weekly. # # Usage: # docker compose -f docker/docker-compose.yml -f docker/docker-compose.backup.yml up -d # # The cron service mounts the scripts directory and a backup volume. -# PostgreSQL dumps are uploaded to Alarik/S3 when configured. +# PostgreSQL dumps are uploaded to RustFS/S3 when configured. # # Requires: .env with DATABASE_URL, S3 credentials (optional for local-only backups) # ────────────────────────────────────────────────────────────────── @@ -22,11 +22,11 @@ services: POSTGRES_DB: ${POSTGRES_DB:-heimdall} POSTGRES_USER: ${POSTGRES_USER:-heimdall} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} - # S3/Alarik config (optional — backup works local-only without these) - ALARIK_ENDPOINT: ${ALARIK_ENDPOINT:-} - ALARIK_ACCESS_KEY: ${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}} - ALARIK_SECRET_KEY: ${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}} - ALARIK_BUCKET: ${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}} + # S3/RustFS config (optional — backup works local-only without these) + RUSTFS_ENDPOINT: ${RUSTFS_ENDPOINT:-http://rustfs:9000} + RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-${S3_ACCESS_KEY:-}} + RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-${S3_SECRET_KEY:-}} + RUSTFS_BUCKET: ${RUSTFS_BUCKET:-${S3_BUCKET:-heimdall}} # Backup config BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-30} BACKUP_RETENTION_WEEKS: ${BACKUP_RETENTION_WEEKS:-12} @@ -53,8 +53,8 @@ services: # Create crontab echo "# Daily PostgreSQL backup at 02:00 UTC" > /tmp/crontab.txt echo "0 2 * * * /scripts/backup.sh >> /var/log/backup.log 2>&1" >> /tmp/crontab.txt - echo "# Weekly Alarik mirror on Sundays at 03:00 UTC" >> /tmp/crontab.txt - echo "0 3 * * 0 /scripts/backup-alarik.sh >> /var/log/backup-alarik.log 2>&1" >> /tmp/crontab.txt + echo "# Weekly RustFS mirror on Sundays at 03:00 UTC" >> /tmp/crontab.txt + echo "0 3 * * 0 /scripts/backup-rustfs.sh >> /var/log/backup-rustfs.log 2>&1" >> /tmp/crontab.txt echo "# Log rotation weekly" >> /tmp/crontab.txt echo "0 4 * * 0 if [ -f /var/log/backup.log ]; then mv /var/log/backup.log /var/log/backup.log.\$$(date +\%Y\%W); fi" >> /tmp/crontab.txt diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 2b47666..dd5a582 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -9,8 +9,8 @@ # openssl rand -base64 32 > docker/secrets/jwt_refresh_key # openssl rand -base64 32 > docker/secrets/coturn_secret # echo -n "your-db-password" > docker/secrets/db_password -# echo -n "your-alarik-admin-password" > docker/secrets/alarik_admin_password -# echo -n "your-alarik-jwt" > docker/secrets/alarik_jwt +# openssl rand -hex 12 > docker/secrets/rustfs_access_key +# openssl rand -base64 32 > docker/secrets/rustfs_secret_key # echo -n "your-smtp-password" > docker/secrets/smtp_password # # Images are published by the CI pipeline on main branch pushes: @@ -51,38 +51,24 @@ services: networks: - heimdall-net - alarik: - image: ghcr.io/achtungsoftware/alarik:latest + rustfs: + image: rustfs/rustfs:latest restart: unless-stopped ports: - - "${ALARIK_API_PORT:-9000}:8080" + - "${RUSTFS_API_PORT:-9000}:9000" + - "${RUSTFS_CONSOLE_PORT:-9001}:9001" environment: - API_BASE_URL: ${ALARIK_API_BASE_URL:-http://localhost:9000} - CONSOLE_BASE_URL: ${ALARIK_CONSOLE_BASE_URL:-http://localhost:9001} - ADMIN_USERNAME: ${ALARIK_ADMIN_USERNAME:-heimdall} - ADMIN_PASSWORD_FILE: /run/secrets/alarik_admin_password - JWT_FILE: /run/secrets/alarik_jwt - ALLOW_ACCOUNT_CREATION: false + RUSTFS_VOLUMES: /data + RUSTFS_ADDRESS: 0.0.0.0:9000 + RUSTFS_CONSOLE_ADDRESS: 0.0.0.0:9001 + RUSTFS_CONSOLE_ENABLE: "true" + RUSTFS_ACCESS_KEY_FILE: /run/secrets/rustfs_access_key + RUSTFS_SECRET_KEY_FILE: /run/secrets/rustfs_secret_key secrets: - - alarik_admin_password - - alarik_jwt + - rustfs_access_key + - rustfs_secret_key volumes: - - alarik_storage:/app/Storage - logging: *default-logging - networks: - - heimdall-net - - alarik-console: - image: ghcr.io/achtungsoftware/alarik-console:latest - restart: unless-stopped - ports: - - "${ALARIK_CONSOLE_PORT:-9001}:3000" - environment: - NUXT_PUBLIC_API_BASE_URL: ${ALARIK_API_BASE_URL:-http://localhost:9000} - NUXT_PUBLIC_CONSOLE_BASE_URL: ${ALARIK_CONSOLE_BASE_URL:-http://localhost:9001} - NUXT_PUBLIC_ALLOW_ACCOUNT_CREATION: false - depends_on: - - alarik + - rustfs_data:/data logging: *default-logging networks: - heimdall-net @@ -251,11 +237,11 @@ services: POSTGRES_DB: ${POSTGRES_DB:-heimdall} POSTGRES_USER: ${POSTGRES_USER:-heimdall} POSTGRES_PASSWORD_FILE: /run/secrets/db_password - # S3/Alarik config (optional — backup works local-only without these) - ALARIK_ENDPOINT: ${ALARIK_ENDPOINT:-} - ALARIK_ACCESS_KEY: ${ALARIK_ACCESS_KEY:-} - ALARIK_SECRET_KEY: ${ALARIK_SECRET_KEY:-} - ALARIK_BUCKET: ${ALARIK_BUCKET:-heimdall} + # S3/RustFS config (optional — backup works local-only without these) + RUSTFS_ENDPOINT: ${RUSTFS_ENDPOINT:-http://rustfs:9000} + RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:-} + RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:-} + RUSTFS_BUCKET: ${RUSTFS_BUCKET:-heimdall} # Backup config BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-30} BACKUP_RETENTION_WEEKS: ${BACKUP_RETENTION_WEEKS:-12} @@ -263,6 +249,8 @@ services: TZ: Europe/Paris secrets: - db_password + - rustfs_access_key + - rustfs_secret_key volumes: - ./scripts:/scripts:ro - backup_data:/backups @@ -280,6 +268,12 @@ services: if [ -f /run/secrets/db_password ]; then export POSTGRES_PASSWORD="$(cat /run/secrets/db_password)" fi + if [ -f /run/secrets/rustfs_access_key ]; then + export RUSTFS_ACCESS_KEY="$(cat /run/secrets/rustfs_access_key)" + fi + if [ -f /run/secrets/rustfs_secret_key ]; then + export RUSTFS_SECRET_KEY="$(cat /run/secrets/rustfs_secret_key)" + fi apk add --no-cache curl bash > /dev/null 2>&1 || true curl -sSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc 2>/dev/null || true @@ -289,8 +283,8 @@ services: # Create crontab echo "# Daily PostgreSQL backup at 02:00 UTC" > /tmp/crontab.txt echo "0 2 * * * /scripts/backup.sh >> /var/log/backup.log 2>&1" >> /tmp/crontab.txt - echo "# Weekly Alarik mirror on Sundays at 03:00 UTC" >> /tmp/crontab.txt - echo "0 3 * * 0 /scripts/backup-alarik.sh >> /var/log/backup-alarik.log 2>&1" >> /tmp/crontab.txt + echo "# Weekly RustFS mirror on Sundays at 03:00 UTC" >> /tmp/crontab.txt + echo "0 3 * * 0 /scripts/backup-rustfs.sh >> /var/log/backup-rustfs.log 2>&1" >> /tmp/crontab.txt echo "# Log rotation weekly" >> /tmp/crontab.txt echo "0 4 * * 0 if [ -f /var/log/backup.log ]; then mv /var/log/backup.log /var/log/backup.log.\$$(date +\%Y\%W); fi" >> /tmp/crontab.txt @@ -369,7 +363,7 @@ services: volumes: pgdata: driver: local - alarik_storage: + rustfs_data: driver: local agent_state: driver: local @@ -397,10 +391,10 @@ secrets: file: ./secrets/jwt_refresh_key coturn_secret: file: ./secrets/coturn_secret - alarik_admin_password: - file: ./secrets/alarik_admin_password - alarik_jwt: - file: ./secrets/alarik_jwt + rustfs_access_key: + file: ./secrets/rustfs_access_key + rustfs_secret_key: + file: ./secrets/rustfs_secret_key smtp_password: file: ./secrets/smtp_password rabbitmq_password: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 67ac298..58f0751 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -36,35 +36,21 @@ services: networks: - heimdall-net - alarik: - image: ghcr.io/achtungsoftware/alarik:latest + rustfs: + image: rustfs/rustfs:latest restart: unless-stopped ports: - - "${ALARIK_API_PORT:-9000}:8080" + - "${RUSTFS_API_PORT:-9000}:9000" + - "${RUSTFS_CONSOLE_PORT:-9001}:9001" environment: - API_BASE_URL: ${ALARIK_API_BASE_URL:-http://localhost:9000} - CONSOLE_BASE_URL: ${ALARIK_CONSOLE_BASE_URL:-http://localhost:9001} - ADMIN_USERNAME: ${ALARIK_ADMIN_USERNAME:-heimdall} - ADMIN_PASSWORD: ${ALARIK_ADMIN_PASSWORD:?ALARIK_ADMIN_PASSWORD is required} - JWT: ${ALARIK_JWT:?ALARIK_JWT is required} - ALLOW_ACCOUNT_CREATION: false + RUSTFS_VOLUMES: /data + RUSTFS_ADDRESS: 0.0.0.0:9000 + RUSTFS_CONSOLE_ADDRESS: 0.0.0.0:9001 + RUSTFS_CONSOLE_ENABLE: "true" + RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY:?RUSTFS_ACCESS_KEY is required} + RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY:?RUSTFS_SECRET_KEY is required} volumes: - - alarik_storage:/app/Storage - logging: *default-logging - networks: - - heimdall-net - - alarik-console: - image: ghcr.io/achtungsoftware/alarik-console:latest - restart: unless-stopped - ports: - - "${ALARIK_CONSOLE_PORT:-9001}:3000" - environment: - NUXT_PUBLIC_API_BASE_URL: ${ALARIK_API_BASE_URL:-http://localhost:9000} - NUXT_PUBLIC_CONSOLE_BASE_URL: ${ALARIK_CONSOLE_BASE_URL:-http://localhost:9001} - NUXT_PUBLIC_ALLOW_ACCOUNT_CREATION: false - depends_on: - - alarik + - rustfs_data:/data logging: *default-logging networks: - heimdall-net @@ -274,7 +260,7 @@ services: volumes: pgdata: driver: local - alarik_storage: + rustfs_data: driver: local agent_state: driver: local diff --git a/docker/scripts/backup-alarik.sh b/docker/scripts/backup-rustfs.sh similarity index 86% rename from docker/scripts/backup-alarik.sh rename to docker/scripts/backup-rustfs.sh index 0f32f2c..a9b87fb 100755 --- a/docker/scripts/backup-alarik.sh +++ b/docker/scripts/backup-rustfs.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -# ─── Heimdall — Alarik/S3 Mirror Backup (weekly) ──────────────── +# ─── Heimdall — RustFS/S3 Mirror Backup (weekly) ──────────────── # Mirrors the heimdall bucket to a backup prefix with versioning. # This captures snapshots, recordings, and other S3-stored data. # # Usage: -# ./backup-alarik.sh # defaults from env / .env -# ./backup-alarik.sh --dry-run # show what would be done -# BACKUP_RETENTION_WEEKS=8 ./backup-alarik.sh +# ./backup-rustfs.sh # defaults from env / .env +# ./backup-rustfs.sh --dry-run # show what would be done +# BACKUP_RETENTION_WEEKS=8 ./backup-rustfs.sh # # Required env vars: -# ALARIK_ENDPOINT (or S3_ENDPOINT), ALARIK_ACCESS_KEY (or S3_ACCESS_KEY), -# ALARIK_SECRET_KEY (or S3_SECRET_KEY), ALARIK_BUCKET (default: heimdall) +# RUSTFS_ENDPOINT, RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY, +# RUSTFS_BUCKET (default: heimdall; S3_* and legacy ALARIK_* aliases accepted) # # Optional: # BACKUP_RETENTION_WEEKS (default: 12) @@ -31,23 +31,23 @@ if [[ -f "$ENV_FILE" ]]; then fi # ── Configuration ─────────────────────────────────────────────── -S3_ENDPOINT="${ALARIK_ENDPOINT:-${S3_ENDPOINT:-}}" -S3_ACCESS_KEY="${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}}" -S3_SECRET_KEY="${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}}" -S3_BUCKET="${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}}" -BACKUP_PREFIX="backup/alarik" +S3_ENDPOINT="${RUSTFS_ENDPOINT:-${ALARIK_ENDPOINT:-${S3_ENDPOINT:-}}}" +S3_ACCESS_KEY="${RUSTFS_ACCESS_KEY:-${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}}}" +S3_SECRET_KEY="${RUSTFS_SECRET_KEY:-${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}}}" +S3_BUCKET="${RUSTFS_BUCKET:-${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}}}" +BACKUP_PREFIX="backup/rustfs" RETENTION_WEEKS="${BACKUP_RETENTION_WEEKS:-12}" TIMESTAMP="$(date -u +%Y-%m-%dT%H-%M-%SZ)" WEEK_TAG="$(date -u +%Y-W%V)" IS_DRY_RUN="${DRY_RUN:-0}" # ── Helpers ───────────────────────────────────────────────────── -log() { echo "[alarik-backup] $(date -u +%H:%M:%S) $*"; } +log() { echo "[rustfs-backup] $(date -u +%H:%M:%S) $*"; } warn() { log "WARN: $*"; } die() { log "FATAL: $*"; exit 1; } # ── Preflight ─────────────────────────────────────────────────── -[[ -z "$S3_ENDPOINT" ]] && die "S3_ENDPOINT not set — cannot mirror Alarik" +[[ -z "$S3_ENDPOINT" ]] && die "S3_ENDPOINT not set — cannot mirror RustFS" if command -v mc >/dev/null 2>&1; then CLIENT="mc" @@ -119,7 +119,7 @@ if [[ "$IS_DRY_RUN" != "1" ]]; then TOTAL_SIZE=$(echo "$STATS" | grep -oP 'Size: \K\d+' || echo "0") fi - MANIFEST="Heimdall Alarik Backup Manifest + MANIFEST="Heimdall RustFS Backup Manifest ================================ Week: ${WEEK_TAG} Created: ${TIMESTAMP} @@ -136,5 +136,5 @@ Total: ${TOTAL_SIZE} bytes log "Manifest written: ${MANIFEST_KEY}" fi -log "Alarik backup complete ✓" +log "RustFS backup complete ✓" log " Location: s3://${S3_BUCKET}/${BACKUP_PREFIX}/${WEEK_TAG}/" diff --git a/docker/scripts/backup.sh b/docker/scripts/backup.sh index 84c4c46..0bcc85a 100755 --- a/docker/scripts/backup.sh +++ b/docker/scripts/backup.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # ─── Heimdall — PostgreSQL Daily Backup ────────────────────────── # Runs pg_dump inside the PostgreSQL container, compresses, uploads -# to Alarik/S3 under backup/postgresql/YYYY-MM-DD/, and prunes +# to RustFS/S3 under backup/postgresql/YYYY-MM-DD/, and prunes # backups older than RETENTION_DAYS. # # Usage: @@ -11,8 +11,8 @@ # # Required env vars (set in .env or export): # POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD -# ALARIK_ENDPOINT (or S3_ENDPOINT), ALARIK_ACCESS_KEY (or S3_ACCESS_KEY), -# ALARIK_SECRET_KEY (or S3_SECRET_KEY), ALARIK_BUCKET (default: heimdall) +# RUSTFS_ENDPOINT, RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY, +# RUSTFS_BUCKET (default: heimdall; S3_* and legacy ALARIK_* aliases accepted) # # Optional: # BACKUP_RETENTION_DAYS (default: 30) @@ -40,10 +40,10 @@ PG_DB="${POSTGRES_DB:-heimdall}" PG_USER="${POSTGRES_USER:-heimdall}" PG_PASSWORD="${POSTGRES_PASSWORD:-heimdall}" -S3_ENDPOINT="${ALARIK_ENDPOINT:-${S3_ENDPOINT:-}}" -S3_ACCESS_KEY="${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}}" -S3_SECRET_KEY="${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}}" -S3_BUCKET="${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}}" +S3_ENDPOINT="${RUSTFS_ENDPOINT:-${ALARIK_ENDPOINT:-${S3_ENDPOINT:-}}}" +S3_ACCESS_KEY="${RUSTFS_ACCESS_KEY:-${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}}}" +S3_SECRET_KEY="${RUSTFS_SECRET_KEY:-${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}}}" +S3_BUCKET="${RUSTFS_BUCKET:-${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}}}" S3_PREFIX="backup/postgresql" RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-30}" @@ -86,7 +86,7 @@ else log "Dump created: $(du -h "$DUMP_FILE" | cut -f1) → $DUMP_FILE" fi -# ── Step 2: Upload to Alarik/S3 ──────────────────────────────── +# ── Step 2: Upload to RustFS/S3 ──────────────────────────────── S3_KEY="${S3_PREFIX}/${DATE_TAG}/heimdall-${TIMESTAMP}.sql.gz" S3_LATEST_KEY="${S3_PREFIX}/latest.sql.gz" diff --git a/docker/scripts/restore.sh b/docker/scripts/restore.sh index 830793d..8cc18ff 100755 --- a/docker/scripts/restore.sh +++ b/docker/scripts/restore.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # ─── Heimdall — PostgreSQL Restore from Backup ─────────────────── -# Downloads a backup from Alarik/S3 (or uses a local file) and +# Downloads a backup from RustFS/S3 (or uses a local file) and # restores it to the PostgreSQL database. # # Usage: @@ -36,10 +36,10 @@ PG_DB="${POSTGRES_DB:-heimdall}" PG_USER="${POSTGRES_USER:-heimdall}" PG_PASSWORD="${POSTGRES_PASSWORD:-heimdall}" -S3_ENDPOINT="${ALARIK_ENDPOINT:-${S3_ENDPOINT:-}}" -S3_ACCESS_KEY="${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}}" -S3_SECRET_KEY="${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}}" -S3_BUCKET="${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}}" +S3_ENDPOINT="${RUSTFS_ENDPOINT:-${ALARIK_ENDPOINT:-${S3_ENDPOINT:-}}}" +S3_ACCESS_KEY="${RUSTFS_ACCESS_KEY:-${ALARIK_ACCESS_KEY:-${S3_ACCESS_KEY:-}}}" +S3_SECRET_KEY="${RUSTFS_SECRET_KEY:-${ALARIK_SECRET_KEY:-${S3_SECRET_KEY:-}}}" +S3_BUCKET="${RUSTFS_BUCKET:-${ALARIK_BUCKET:-${S3_BUCKET:-heimdall}}}" LOCAL_DIR="${BACKUP_LOCAL_DIR:-/var/lib/heimdall/backups}" RESTORE_TMP="${LOCAL_DIR}/.restore-tmp" diff --git a/docs/MASTER_SPECIFICATION.md b/docs/MASTER_SPECIFICATION.md index 255a9fe..3ded4f9 100644 --- a/docs/MASTER_SPECIFICATION.md +++ b/docs/MASTER_SPECIFICATION.md @@ -101,7 +101,7 @@ Heimdall est une plateforme de vidéosurveillance IA locale, auto-hébergée, mu │ │ │ │ └────────────┘ │ │ └──────────────────┴─────────────────┘ │ │ │ PostgreSQL / Hangfire (schema séparé) │ -│ │ Alarik / S3 │ +│ │ RustFS / S3 │ └──────────────────────────────┼────────────────────────────────────────┘ │ HTTPS REST + SignalR (events + signaling) @@ -131,7 +131,7 @@ services: heimdall-central: # Api + Web + Workers fusionnés (1 conteneur) heimdall-agent: # SIPSorcery + FFmpeg + YOLOv8 + Hangfire InMemory postgresql: # Base de données (app + hangfire) - alarik: # Stockage S3 (enregistrements) + rustfs: # Stockage S3 (enregistrements) # L'IA lourde (détection, visages, LPR) tourne sur les agents GPU (ONNX Runtime) — pas de service central ollama: # LLM local (résumés quotidiens) coturn: # TURN relay (OBLIGATOIRE, pas optionnel) @@ -751,7 +751,7 @@ class HeimdallLiveView { ## PARTIE 7 : Stockage et Hangfire -### 7.1 Stockage Alarik/S3 +### 7.1 Stockage RustFS/S3 | File Type | Path Pattern | Rétention | |---|---|---| @@ -851,7 +851,7 @@ builder.Services.AddHangfireServer(options => | Job | Schedule | Queue | Description | |---|---|---|---| | `RetentionCheckJob` | Quotidien 3h | default | Purge enregistrements + S3 batch delete | -| `S3CleanupJob` | Quotidien 4h | default | Nettoie fichiers orphelins Alarik (pagination) | +| `S3CleanupJob` | Quotidien 4h | default | Nettoie fichiers orphelins RustFS (pagination) | | `CleanupUnknownFacesJob` | Dimanche 5h | default | Supprime visages inconnus > 30j | | `CleanupLicensePlatesJob` | Dimanche 6h | default | Plaques non associées > 30j | | `DatabaseMaintenanceJob` | Hebdomadaire dimanche 7h | default | VACUUM events + REINDEX (VACUUM FULL mensuel) | @@ -973,24 +973,24 @@ Phase 1 — Solution .NET 10 + Clean Architecture │ Infrastructure, Api, Web, Workers, Agent, Contracts) ├── Project references (flux inward) ├── NuGet packages (EF Core, Npgsql, Hangfire, SIPSorcery, Serilog...) -├── Docker Compose de dev (PostgreSQL + Alarik + Redis) +├── Docker Compose de dev (PostgreSQL + RustFS + Redis) ├── Verify: dotnet build → 0 errors │ ✅ Fonctionnel à la fin de cette phase : │ • dotnet build sur TOUS les projets : 0 erreur -│ • docker compose up central + postgresql + alarik : démarre +│ • docker compose up central + postgresql + rustfs : démarre │ • Solution navigable dans Rider/VS Phase 2 — Test Framework & Tooling ├── xUnit + Shouldly + NSubstitute + FluentAssertions -├── Testcontainers (PostgreSQL + Alarik réels) +├── Testcontainers (PostgreSQL + RustFS réels) ├── bUnit (Blazor UI), Playwright (E2E) ├── .editorconfig + analyzers + StyleCop ├── Verify: dotnet test → green (skeleton pass) │ ✅ Fonctionnel à la fin de cette phase : │ • dotnet test sur chaque projet : squelette vert -│ • Testcontainers lance PostgreSQL + Alarik pour les tests +│ • Testcontainers lance PostgreSQL + RustFS pour les tests │ • .editorconfig analysers appliqués Phase 3 — CI/CD @@ -1102,20 +1102,20 @@ Phase 7 — Infrastructure EF Core │ • CreatedAt/UpdatedAt auto-set sur toutes les entités │ • Tests intégration : Testcontainers PostgreSQL, vrai DB -Phase 8 — Storage Alarik/S3 -├── AlarikStorageProvider (IStorageProvider) +Phase 8 — Storage RustFS/S3 +├── RustFSStorageProvider (IStorageProvider) ├── Staging prefix pour uploads atomiques ├── Batch delete (RemoveObjectsAsync, 1000/appel) ├── Health check → /health -├── Verify: dotnet test → Testcontainers Alarik green +├── Verify: dotnet test → Testcontainers RustFS green │ ✅ Fonctionnel à la fin de cette phase : -│ • UploadAsync → fichier dans Alarik (bucket recordings/) -│ • DownloadAsync → fichier depuis Alarik +│ • UploadAsync → fichier dans RustFS (bucket recordings/) +│ • DownloadAsync → fichier depuis RustFS │ • DeleteBatchAsync → 1000 fichiers supprimés en 1 appel │ • Upload atomique : staging/ → move → recordings/ │ • Si crash pendant upload : staging nettoyé, pas de fichiers orphelins -│ • Tests intégration : Testcontainers Alarik, vrai S3 +│ • Tests intégration : Testcontainers RustFS, vrai S3 ┌──────────────────────────────────────────────────────────────────┐ @@ -1801,14 +1801,14 @@ Phase 19 — Jobs Métier (retention, cleanup) │ │ → ExecuteDelete : DELETE FROM recordings WHERE │ │ │ timestamp < NOW() - retention_days │ │ │ → Batch S3 : RemoveObjectsAsync (1000 clés par appel) │ -│ │ → Enregistrements supprimés = place libérée dans Alarik │ +│ │ → Enregistrements supprimés = place libérée dans RustFS │ │ │ │ │ │ Résultat : 5 lignes SQL, pas de boucle, pas de OOM │ │ └──────────────────────────────────────────────────────────────┘ │ │ ┌─ S3 CLEANUP ──────────────────────────────────────────────────┐ │ │ 4h du matin : S3CleanupJob s'exécute │ -│ │ → Liste les fichiers dans Alarik prefix "recordings/" │ +│ │ → Liste les fichiers dans RustFS prefix "recordings/" │ │ │ → Pagination : 1000 fichiers par page (continuation token) │ │ │ → Pour chaque page : vérifie StoragePath dans DB │ │ │ → Supprime ceux qui n'existent pas en DB │ @@ -2023,7 +2023,7 @@ Phase 24 — Production Hardening ├── Docker secrets (/run/secrets/) pour : │ ├── DB_PASSWORD, JWT_SIGNING_KEY │ ├── COTURN_SECRET, BROKER_AMQP_PASSWORD, SMTP_PASSWORD -│ └── ALARIK_ADMIN_USERNAME, ALARIK_ADMIN_PASSWORD, ALARIK_JWT +│ └── RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY ├── Serilog + Sentry/GlitchTip (PII stripping activé) │ ├── Sanitize : password, token, secret, snapshotUrl, ApiKey │ └── SendDefaultPii = false @@ -2033,11 +2033,11 @@ Phase 24 — Production Hardening │ └── heimdall.signalr.connections, heimdall.streaming.viewers ├── Health checks : │ ├── GET /health (basique : API répond) -│ ├── GET /health/ready (DB, Alarik, broker, Redis OK) +│ ├── GET /health/ready (DB, RustFS, broker, Redis OK) │ └── GET /health/live (ready + pas de degradation active) ├── Backup automatisé (cron) : -│ ├── PostgreSQL : pg_dump quotidien → Alarik backup/ -│ └── Alarik : alarik mirror hebdomadaire → backup/ (versionné) +│ ├── PostgreSQL : pg_dump quotidien → RustFS backup/ +│ └── RustFS : rustfs mirror hebdomadaire → backup/ (versionné) ├── k6 load tests : │ ├── 10 agents, 50 caméras, 20 viewers simultanés │ ├── Latence API < 200ms p95 @@ -2067,13 +2067,13 @@ Phase 24 — Production Hardening │ └──────────────────────────────────────────────────────────────┘ │ │ ┌─ BACKUP ─────────────────────────────────────────────────────┐ -│ │ Quotidien 2h : pg_dump → Alarik backup/heimdall_YYYY-MM-DD.sql.gz │ +│ │ Quotidien 2h : pg_dump → RustFS backup/heimdall_YYYY-MM-DD.sql.gz │ │ │ Hebdomadaire dimanche 3h : mc mirror → backup/ (versionné) │ │ │ │ │ │ Test de restauration : │ │ │ 1. docker compose down │ │ │ 2. Restaurer PostgreSQL depuis le dump │ -│ │ 3. Restaurer Alarik depuis le mirror │ +│ │ 3. Restaurer RustFS depuis le mirror │ │ │ 4. docker compose up │ │ │ 5. Vérifier les sites, agents, events toujours présents │ │ └──────────────────────────────────────────────────────────────┘ @@ -2131,7 +2131,7 @@ services: - ConnectionStrings__PostgreSQL=Server=postgresql;Database=heimdall;... - ConnectionStrings__Hangfire=Server=postgresql;Database=heimdall_hangfire;... - ConnectionStrings__Redis=redis:6379 - - Alarik__Endpoint=http://alarik:8080 + - S3 endpoint: http://rustfs:9000 (même API S3) # L'IA est exécutée par les agents (ONNX Runtime) — plus de service central - Ollama__Endpoint=http://ollama:11434 - Coturn__Url=turns:coturn:3478 @@ -2163,7 +2163,7 @@ services: depends_on: postgresql: condition: service_healthy - alarik: + rustfs: condition: service_started postgresql: @@ -2179,30 +2179,20 @@ services: ports: - "5432:5432" - alarik: - image: ghcr.io/achtungsoftware/alarik:latest + rustfs: + image: rustfs/rustfs:latest ports: - - "9000:8080" # S3 API + - "9000:9000" # S3 API + - "9001:9001" # Console environment: - API_BASE_URL: http://localhost:9000 - CONSOLE_BASE_URL: http://localhost:9001 - ADMIN_USERNAME: ${ALARIK_ADMIN_USERNAME} - ADMIN_PASSWORD: ${ALARIK_ADMIN_PASSWORD} - JWT: ${ALARIK_JWT} - ALLOW_ACCOUNT_CREATION: false + RUSTFS_VOLUMES: /data + RUSTFS_ADDRESS: 0.0.0.0:9000 + RUSTFS_CONSOLE_ADDRESS: 0.0.0.0:9001 + RUSTFS_CONSOLE_ENABLE: "true" + RUSTFS_ACCESS_KEY: ${RUSTFS_ACCESS_KEY} + RUSTFS_SECRET_KEY: ${RUSTFS_SECRET_KEY} volumes: - - alarik_storage:/app/Storage - - alarik-console: - image: ghcr.io/achtungsoftware/alarik-console:latest - ports: - - "9001:3000" # Console - environment: - NUXT_PUBLIC_API_BASE_URL: http://localhost:9000 - NUXT_PUBLIC_CONSOLE_BASE_URL: http://localhost:9001 - NUXT_PUBLIC_ALLOW_ACCOUNT_CREATION: false - depends_on: - - alarik + - rustfs_data:/data coturn: image: coturn/coturn:4.6 @@ -2299,7 +2289,7 @@ AnalysisWorker: concurrent requests from multiple cameras |---|---|---| | API | `/health` | 30s | | PostgreSQL | Ping DB | 30s | -| Alarik | GET /health | 30s | +| RustFS | GET /health | 30s | | Broker IA (RabbitMQ) | AMQP / healthcheck | 30s | | Ollama | `/api/tags` | 60s | | Agent | POST /api/agents/{id}/heartbeat | 30s | diff --git a/docs/README.md b/docs/README.md index 49ff38d..cf668d2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,7 +21,7 @@ vidéosurveillance IA locale, multi-site, auto-hébergée. | **Sites & Agents** | `docs/specs.md` (§11-12) | Sites, tokens, registration, heartbeat, bootstrap | | **Caméras & IA** | `docs/specs.md` (§14-19) | ONVIF, Imou, FFmpeg, GPU, AI Pipeline, détection | | **Streaming live** | `docs/specs.md` (§13) + `docs/signalr-usage.md` | WebRTC, SIPSorcery, SFU, signaling, JS Interop | -| **Enregistrements** | `docs/specs.md` (§20-21) + `docs/hangfire-usage.md` | Alarik/S3, rétention, stockage local | +| **Enregistrements** | `docs/specs.md` (§20-21) + `docs/hangfire-usage.md` | RustFS/S3, rétention, stockage local | | **Événements** | `docs/specs.md` (§16-19) | Personnes, véhicules, plaques, notifications | | **Notifications** | `docs/notifications.md` | Email SMTP, Gotify, templates Markdown i18n | diff --git a/docs/hangfire-usage.md b/docs/hangfire-usage.md index 67ad8bd..21a2e57 100644 --- a/docs/hangfire-usage.md +++ b/docs/hangfire-usage.md @@ -74,7 +74,7 @@ public class RetentionCheckJob _db.Recordings.RemoveRange(expired); - // 2. Supprimer les fichiers du storage (Alarik/S3) + // 2. Supprimer les fichiers du storage (RustFS/S3) foreach (var recording in expired) { await storageProvider.DeleteAsync(recording.StoragePath, ct); @@ -103,7 +103,7 @@ public class S3CleanupJob { public async Task ExecuteAsync(CancellationToken ct) { - // 1. Lister les fichiers dans Alarik (prefix recordings/) + // 1. Lister les fichiers dans RustFS (prefix recordings/) var allFiles = await _storage.ListAsync("recordings/", ct); // 2. Récupérer les chemins enregistrés en DB diff --git a/docs/implementation.md b/docs/implementation.md index 3c07905..5213618 100644 --- a/docs/implementation.md +++ b/docs/implementation.md @@ -19,7 +19,7 @@ La **vidéo live** arrive en dernier dans l'IHM. ✅ Phase 10 : Camera Management API [FAIT] ⏳ Phase 11 : Video Pipeline (FFmpeg) [EN ATTENTE - hardware requis] ⏳ Phase 12 : AI Pipeline [EN ATTENTE - hardware requis] -⏳ Phase 13 : Storage (Alarik/S3) [EN ATTENTE - v2] +⏳ Phase 13 : Storage (RustFS/S3) [EN ATTENTE - v2] ⏳ Phase 14 : SignalR Hubs [EN ATTENTE - v2] ✅ Phase 15 : Hangfire Central [FAIT - heartbeat monitor] ⏳ Phase 16 : Hangfire Agent (InMemory) [EN ATTENTE - v2] @@ -68,7 +68,7 @@ Heimdall/ ├── docker/ │ ├── Dockerfile.central # Multi-stage ✅ │ ├── Dockerfile.agent # Multi-stage ✅ -│ ├── docker-compose.yml # PostgreSQL + Alarik + Central + Agent + Workers ✅ +│ ├── docker-compose.yml # PostgreSQL + RustFS + Central + Agent + Workers ✅ │ └── docker-compose.local.yml # Local compose overrides ├── docs/ │ ├── MASTER_SPECIFICATION.md # Spec complète @@ -371,7 +371,7 @@ Reporté après le MVP logiciel. # Phase 11 — Video Pipeline (FFmpeg) # Phase 12 — AI Pipeline -# Phase 13 — Storage (Alarik/S3) +# Phase 13 — Storage (RustFS/S3) # Phase 14 — SignalR Hubs 🔴 **Nécessitent du hardware + dépendances natives.** @@ -499,7 +499,7 @@ Le client natif a été retiré. Voir [l’audit PWA](pwa.md) et le [plan actual - [ ] Serilog + Seq/GlitchTip - [ ] Métriques Prometheus - [ ] Backup PostgreSQL automatisé -- [ ] Backup Alarik (S3 → S3) +- [ ] Backup RustFS (S3 → S3) - [ ] Tests de charge (k6) - [ ] Security audit (pentest) @@ -515,5 +515,5 @@ Le client natif a été retiré. Voir [l’audit PWA](pwa.md) et le [plan actual | Tests | 34 (13 domain + 16 integration + 5 placeholder) | | Build | 0 errors, 0 warnings | | Commits | 45 | -| Conteneurs Docker | 6 (postgresql, alarik, alarik-console, central, workers, agent) | +| Conteneurs Docker | 5 (postgresql, rustfs, central, workers, agent) | | Endpoints API | 30+ | diff --git a/docs/signalr-usage.md b/docs/signalr-usage.md index e3a45d8..abda36b 100644 --- a/docs/signalr-usage.md +++ b/docs/signalr-usage.md @@ -214,7 +214,7 @@ public class MonitoringHub : Hub |---|---|---|---| | `AgentStatusChanged` | `AgentStatusDto` | Groupe monitoring du site | Agent online/offline | | `CameraStatusChanged` | `CameraStatusDto` | Groupe monitoring du site | Caméra online/offline | -| `StorageUsageUpdated` | `StorageDto` | Admin | Espace Alarik mis à jour | +| `StorageUsageUpdated` | `StorageDto` | Admin | Espace RustFS mis à jour | | `GpuUsageUpdated` | `GpuDto` | Admin | Utilisation GPU agent (ONNX Runtime) | | `JobStatusChanged` | `JobDto` | Admin | Un job Hangfire échoue | | `SystemHealthChanged` | `HealthDto` | Admin | Health check global | diff --git a/docs/specs.md b/docs/specs.md index 646f7a5..3f7d23b 100644 --- a/docs/specs.md +++ b/docs/specs.md @@ -25,7 +25,7 @@ Heimdall is a modern self-hosted intelligent video surveillance platform. - Live vidéo : WebRTC P2P (SIPSorcery), latence < 500 ms - IA locale : ONNX Runtime (GPU sur agents équipés, mutualisable inter-sites) + Ollama (LLM résumés) - Espace utilisateur : Admin (global) + User (site-scope) -- Stockage : Alarik/S3 centralisé +- Stockage : RustFS/S3 centralisé - Temps réel : SignalR (5 hubs) - Jobs planifiés : Hangfire (Central PGSQL + Agent InMemory) - Stack : .NET 10, Blazor MudBlazor, PostgreSQL @@ -42,11 +42,11 @@ Heimdall is a modern self-hosted intelligent video surveillance platform. │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │ │ API │ │ Web │ │ Workers │ │ Broker IA │ │ │ │ REST + │ │ Blazor │ │ Hangfire │ │ Ollama │ │ -│ │ SignalR │ │ MudBlazor│ │ Jobs │ │ Alarik │ │ +│ │ SignalR │ │ MudBlazor│ │ Jobs │ │ RustFS │ │ │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────────────────┘ │ │ │ │ │ │ │ └──────────────┴─────────────┘ │ -│ │ PostgreSQL / Alarik │ +│ │ PostgreSQL / RustFS │ └─────────────────────────┼────────────────────────────────────────┘ │ HTTPS REST + SignalR (signaling) @@ -171,7 +171,7 @@ Voir `docs/hangfire-usage.md` pour le code complet de chaque job. ## Stockage & Rétention — `docs/hangfire-usage.md` -- Alarik (par défaut), S3-compatible (AWS S3, MinIO), Local (fallback) +- RustFS (par défaut), S3-compatible (AWS S3, MinIO), Local (fallback) - L'Agent écrit les segments directement sur S3 - Retention configurable par caméra (7-90 jours) - Hangfire purge les fichiers expirés @@ -204,7 +204,7 @@ services: heimdall-worker: # Hangfire jobs (PostgreSQL) heimdall-agent: # SIPSorcery + FFmpeg (InMemory Hangfire) postgresql: # Base de données - alarik: # Stockage S3 (enregistrements) + rustfs: # Stockage S3 (enregistrements) # IA lourde (détection, visages, LPR) : agents GPU ONNX Runtime — pas de service central ollama: # LLM local (résumés) mediamtx: # SFU WebRTC (optionnel, multi-user) @@ -236,7 +236,7 @@ Auto-détection GPU par l'Agent au démarrage (NVENC > QSV > VAAPI > CPU). - Serilog (structure logging) - OpenTelemetry ready - Sentry SDK compatible GlitchTip -- Healthchecks (API, Agent, DB, Alarik, Broker IA, Ollama) +- Healthchecks (API, Agent, DB, RustFS, Broker IA, Ollama) - Tests : xUnit + Shouldly + NSubstitute + bUnit + Testcontainers --- diff --git a/readme.md b/readme.md index 38f38d5..fb2b03b 100644 --- a/readme.md +++ b/readme.md @@ -52,7 +52,7 @@ docker compose -f docker/docker-compose.prod.yml up -d | Web UI + API | http://localhost:5000 | | API | http://localhost:5000/api | | API Docs (dev) | http://localhost:5000/scalar | -| Alarik Console | http://localhost:9001 | +| RustFS Console | http://localhost:9001 | ### 2. Build local (développement) @@ -70,7 +70,7 @@ Prérequis : .NET 10 SDK, Docker ```bash # Démarrer les dépendances locales sans lancer le serveur conteneurisé -docker compose -f docker/docker-compose.yml up -d postgresql alarik alarik-console +docker compose -f docker/docker-compose.yml up -d postgresql rustfs # L'API, l'UI Blazor et les jobs tournent dans le même processus make dev-web @@ -111,8 +111,7 @@ Le dossier `docker/` contient tout nécessaire pour déployer Heimdall : | Service | Image | Port par défaut | Dépend de | |---|---|---|---| | `postgresql` | `postgres:17-alpine` | 5432 | — | -| `alarik` | `ghcr.io/achtungsoftware/alarik` | 9000 | — | -| `alarik-console` | `ghcr.io/achtungsoftware/alarik-console` | 9001 | alarik | +| `rustfs` | `rustfs/rustfs:latest` | 9000 (S3), 9001 (console) | — | | `heimdall` | `heimdall:latest` (dev) / `eltruncho/heimdall:latest` (prod) | 5000 | postgresql (healthy) | | `heimdall-agent` | `heimdall-agent:latest` (dev) / `eltruncho/heimdall-agent:latest` (prod) | — | heimdall | | `ntfy` | `binwiederhier/ntfy` | 8080 | — | @@ -126,7 +125,7 @@ Le dossier `docker/` contient tout nécessaire pour déployer Heimdall : | Volume | Monté sur | Persiste | |--------|-----------|----------| | `pgdata` | `/var/lib/postgresql/data` | Données PostgreSQL | -| `alarik_storage` | `/app/Storage` | Objets S3 (vidéos, snapshots) | +| `rustfs_data` | `/data` | Objets S3 (vidéos, snapshots) | | `agent_state` | `/var/lib/heimdall` | Identité et état des agents | | `heimdall_data` | `/var/lib/heimdall` | Données locales (Central) | | `ntfy_data` | `/var/lib/ntfy` | Notifications ntfy | @@ -160,17 +159,35 @@ se fait par noms de service (ex: `http://heimdall:8080`). L'agent utilise le ré | `HEIMDALL_AGENT_NAME` | `agent-01` | agent | Nom de l'agent | | `HEIMDALL_HEARTBEAT_INTERVAL` | `30` | agent | Intervalle heartbeat (s) | | `HEIMDALL_REGISTRATION_RETRIES` | `5` | agent | Tentatives d'enregistrement | -| `ALARIK_API_PORT` | `9000` | alarik | Port API Alarik | -| `ALARIK_CONSOLE_PORT` | `9001` | alarik-console | Port console Alarik | -| `ALARIK_ADMIN_USERNAME` | `heimdall` | alarik | Admin Alarik | -| `ALARIK_ADMIN_PASSWORD` | `heimdall123` | alarik | Password Alarik | -| `ALARIK_JWT` | (required) | alarik | JWT secret Alarik | +| `RUSTFS_API_PORT` | `9000` | rustfs | Port API RustFS | +| `RUSTFS_CONSOLE_PORT` | `9001` | rustfs | Port console RustFS | +| `RUSTFS_ACCESS_KEY` | `heimdall` | rustfs | Identifiant S3 et console | +| `RUSTFS_SECRET_KEY` | (required) | rustfs | Secret S3 et console | | `WEB_PORT` | `5000` | heimdall | Port exposé (API + UI unifiés) | | `RABBITMQ_USER` | `heimdall` | heimdall, agent | Utilisateur RabbitMQ | | `RABBITMQ_PASSWORD` | `heimdall123` | heimdall, agent | Password RabbitMQ | | `COTURN_SECRET` | (required) | coturn | Secret TURN | | `OLLAMA_PORT` | `11434` | ollama | Port Ollama | +### Migration depuis Alarik + +RustFS expose la même API S3 utilisée par Heimdall. Après démarrage, ouvrez +`http://localhost:9001`, puis configurez dans **Paramètres → Stockage** l'endpoint +`http://rustfs:9000`, le bucket et les identifiants RustFS. L'API Heimdall et les +appels S3 restent inchangés. + +Le volume `rustfs_data` est neuf; les objets déjà stockés dans Alarik n'y sont pas +copiés automatiquement. Avant de retirer l'ancien service, arrêtez les écritures et +copiez les objets avec `mc mirror`, en configurant les alias `old` et `new` avec les +endpoints et identifiants correspondants : + +```bash +mc mirror old/heimdall new/heimdall +``` + +Vérifiez les snapshots et enregistrements depuis Heimdall avant de supprimer +l'ancien volume ou service. + ### Dépannage Docker **Les conteneurs ne démarrent pas :** @@ -287,7 +304,7 @@ La solution inclut les tests du domaine, de l’application, de l’infrastructu | Blazor Server | 10.0 | | MudBlazor | 9.8.0 | | Hangfire | 1.8.17 | -| Alarik (S3) | latest | +| RustFS (S3) | latest | | SignalR | 10.0 | | MassTransit / RabbitMQ | 8.x / 3.x | | SIPSorcery (WebRTC) | 10.0 | diff --git a/scripts/ci/validate-compose.sh b/scripts/ci/validate-compose.sh index 472fbf3..ae8f148 100644 --- a/scripts/ci/validate-compose.sh +++ b/scripts/ci/validate-compose.sh @@ -4,7 +4,7 @@ set -euo pipefail docker compose --env-file .env.example -f docker/docker-compose.yml config --quiet docker compose --env-file .env.example -f docker/docker-compose.prod.yml config --quiet docker compose --env-file .env.example -f docker/docker-compose.yml -f docker/docker-compose.backup.yml config --quiet -for required in JWT__KEY JWT__REFRESHKEY HEIMDALL_SITE_TOKEN DATABASE_URL POSTGRES_PASSWORD RABBITMQ_PASSWORD ALARIK_ADMIN_PASSWORD ALARIK_JWT COTURN_SECRET; do +for required in JWT__KEY JWT__REFRESHKEY HEIMDALL_SITE_TOKEN DATABASE_URL POSTGRES_PASSWORD RABBITMQ_PASSWORD RUSTFS_ACCESS_KEY RUSTFS_SECRET_KEY COTURN_SECRET; do if env "$required=" docker compose --env-file .env.example -f docker/docker-compose.yml config --quiet >/dev/null 2>&1; then echo "Compose accepted missing required variable: $required" >&2 exit 1 -- 2.54.1