docs(storage): replace Alarik with RustFS
Heimdall Gitea / Build and tests (pull_request) Failing after 23m28s
Heimdall Gitea / Publish versioned release (pull_request) Skipped

This commit is contained in:
Arnaud Dartois committed 2026-10-21 16:03:16 +02:00
1 parent 2cc39e9d09
commit 1c8cd508bd
17 files changed
+191 -203

No files matched your search

+36 -46
View File
@@ -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 |