refactor(docker): separate core and optional compose services
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Successful in 13m35s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 6m28s
Heimdall Gitea / Build and scan server image (pull_request) Successful in 8m24s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 3s
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Successful in 13m35s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 6m28s
Heimdall Gitea / Build and scan server image (pull_request) Successful in 8m24s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 3s
This commit is contained in:
1 parent
25dc4869d2
commit
88033e8e26
25 files changed
+507
-714
No files matched your search
+17
-102
@@ -1238,18 +1238,15 @@ Phase 11 — Hangfire Foundation + Jobs Multi-Site
|
||||
│ → C'EST L'OBJECTIF DE L'ÉTAPE 1 │
|
||||
└──────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Phase 12 — Agent Foundation (Docker-only)
|
||||
├── Docker-only : heimdall/agent:latest
|
||||
Phase 12 — Agent Foundation (multi-format installation)
|
||||
├── Images Agent configurées par docker/agent-image.json
|
||||
├── Installation Linux native via install/install-agent.sh et systemd
|
||||
├── Compose Docker généré dans l'IHM depuis le manifeste signé Central
|
||||
├── AgentRegistrationService (register via API au premier démarrage)
|
||||
├── HeartbeatSenderJob (Hangfire InMemory Central, 30s)
|
||||
├── Agent → Central : API Key auth (X-Api-Key header)
|
||||
├── Central → Agent : heartbeat OK renouvelle le statut Online
|
||||
├── docker-compose.yml minimal pour l'Agent :
|
||||
│ docker run -e HEIMDALL_CENTRAL_URL=https://central.example.com \
|
||||
│ -e HEIMDALL_SITE_TOKEN=abc123def456 \
|
||||
│ -e HEIMDALL_API_KEY=heimdall_sk_abc123def456 \
|
||||
│ -e HEIMDALL_AGENT_NAME=agent-paris-01 \
|
||||
│ heimdall/agent:latest
|
||||
├── L'Agent Docker utilise le réseau hôte pour accéder au LAN des caméras
|
||||
├── Verify: Agent démarre → register → heartbeat 30s
|
||||
│
|
||||
✅ Fonctionnel à la fin de cette phase :
|
||||
@@ -2115,104 +2112,22 @@ Plan détaillé : docs/pwa.md
|
||||
|
||||
## PARTIE 11 : Déploiement Docker
|
||||
|
||||
### 11.1 docker-compose.yml (production)
|
||||
### 11.1 Compose de déploiement
|
||||
|
||||
> **L'Agent est distribué EXCLUSIVEMENT via Docker.** Pas de binaire standalone,
|
||||
> pas d'installation manuelle. La commande Docker est générée par l'UI Admin
|
||||
> avec le token et l'API Key pré-remplis : `docker run -e HEIMDALL_SITE_TOKEN=... -e HEIMDALL_API_KEY=... heimdall/agent:latest`.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
heimdall-central:
|
||||
image: heimdall/central:latest
|
||||
ports:
|
||||
- "5000:5000" # HTTPS
|
||||
environment:
|
||||
- ConnectionStrings__PostgreSQL=Server=postgresql;Database=heimdall;...
|
||||
- ConnectionStrings__Hangfire=Server=postgresql;Database=heimdall_hangfire;...
|
||||
- ConnectionStrings__Redis=redis:6379
|
||||
- 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
|
||||
- Coturn__Secret=${COTURN_SECRET}
|
||||
volumes:
|
||||
- dataprotection_keys:/root/.aspnet/DataProtection-Keys
|
||||
secrets:
|
||||
- jwt_signing_key
|
||||
- coturn_secret
|
||||
- smtp_password
|
||||
|
||||
heimdall-agent:
|
||||
image: heimdall/agent:latest
|
||||
environment:
|
||||
- HEIMDALL_CENTRAL_URL=https://heimdall-central:5000
|
||||
- HEIMDALL_SITE_TOKEN=${HEIMDALL_SITE_TOKEN}
|
||||
- HEIMDALL_API_KEY=${HEIMDALL_API_KEY}
|
||||
- HEIMDALL_AGENT_NAME=${HEIMDALL_AGENT_NAME}
|
||||
volumes:
|
||||
- /dev/dri:/dev/dri # GPU Intel/AMD (optionnel)
|
||||
- /tmp/heimdall:/tmp/heimdall # Cache snapshots local
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
rustfs:
|
||||
condition: service_started
|
||||
|
||||
postgresql:
|
||||
image: postgres:17
|
||||
environment:
|
||||
POSTGRES_USER: heimdall
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: heimdall
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U heimdall"]
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
rustfs:
|
||||
image: rustfs/rustfs:latest
|
||||
ports:
|
||||
- "9000:9000" # S3 API
|
||||
- "9001:9001" # Console
|
||||
environment:
|
||||
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:
|
||||
- rustfs_data:/data
|
||||
|
||||
coturn:
|
||||
image: coturn/coturn:4.6
|
||||
command: >
|
||||
-n --use-auth-secret
|
||||
--static-auth-secret=${COTURN_SECRET}
|
||||
--realm=heimdall.local
|
||||
--fingerprint
|
||||
--no-tlsv1
|
||||
--no-tlsv1_1
|
||||
network_mode: host # nécessaire pour TURN (ports UDP)
|
||||
```
|
||||
La configuration déployable est maintenue dans `docker/` et décrite dans
|
||||
[docker-compose.md](docker-compose.md). Le noyau obligatoire contient
|
||||
uniquement Central et PostgreSQL (`docker-compose.prod.yml`). Les Agents ont
|
||||
un Compose autonome (`docker-compose.agent.yml`); le parcours recommandé est
|
||||
le Compose généré par l'IHM, épinglé au digest du manifeste signé Central.
|
||||
RustFS, ntfy, Ollama, Coturn, Redis et les sauvegardes disposent chacun d'un
|
||||
Compose facultatif. Les overlays GPU ciblent uniquement les Agents et
|
||||
n'activent pas l'inférence ONNX GPU dans l'image publiée.
|
||||
|
||||
### 11.2 GPU Passthrough
|
||||
|
||||
| Conteneur | GPU | Docker Compose |
|
||||
|---|---|---|
|
||||
| agent GPU | NVIDIA/AMD/Intel | profiles compose GPU (nvidia/rocm/vaapi) — cf. docker |
|
||||
| `heimdall-agent` | NVIDIA/Intel/AMD | `--gpus all` ou `/dev/dri:/dev/dri` |
|
||||
| `ollama` | NVIDIA (optionnel) | `--gpus all` |
|
||||
Les fichiers `docker-compose.gpu-*.yml` exposent le matériel au Compose Agent
|
||||
pour l'inventaire seulement. L'image Agent publiée embarque le fournisseur ONNX
|
||||
CPU; l'inférence GPU nécessite encore une image et un runtime dédiés.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ vidéosurveillance IA locale, multi-site, auto-hébergée.
|
||||
| **Hangfire (jobs)** | `docs/hangfire-usage.md` | Configuration actuelle et jobs présents; vérifier l'état des parcours dans l'audit |
|
||||
| **SignalR (temps réel)** | `docs/signalr-usage.md` | Hubs et contrats documentés; état du streaming live dans l'audit |
|
||||
| **Déploiement Docker** | `docs/specs.md` (§30) | Containers, GPU passthrough, docker-compose |
|
||||
| **Docker Compose** | [Déploiement séparé](docker-compose.md) | Central + PostgreSQL requis; Agent et logiciels optionnels séparés |
|
||||
| **GPU Agent** | [Accès matériel et état de l'inférence](gpu-runtime.md) | Profils facultatifs; l'inférence ONNX publiée reste CPU |
|
||||
|
||||
## 📐 Structure du projet
|
||||
@@ -61,6 +62,7 @@ Heimdall/
|
||||
|---|---|
|
||||
| `specs.md` | Spécification complète : vision, architecture, features, déploiement |
|
||||
| `implementation.md` | Plan historique du MVP (juillet 2026); statuts non représentatifs de l'état actuel |
|
||||
| `docker-compose.md` | Déploiement Central, Agents autonomes et logiciels facultatifs |
|
||||
| `ui-pages.md` | Pages Blazor (MudBlazor) : maquettes ASCII, composants, états |
|
||||
| `pwa.md` | Audit PWA du serveur Blazor, architecture cible et plan de réalisation |
|
||||
| `auth-roles.md` | Auth : 2 user types, permissions, site-scope, UI visibility |
|
||||
|
||||
@@ -31,7 +31,7 @@ sudo bash install/install-agent.sh \
|
||||
|
||||
Le script lit le manifeste signé via Central, vérifie la signature et l’archive, puis installe la release sous `/opt/heimdall/agent/releases/`. Le service utilise le lien `current`; lors d’une mise à jour, le superviseur accorde jusqu’à 180 secondes au démarrage, exige ensuite 60 secondes de réponse continue de `/api/version` pour la version attendue et rétablit la release précédente si cette validation échoue. Garder ensemble `install-agent.sh` et `agent-supervisor.py` lors d’une installation depuis une copie des scripts.
|
||||
|
||||
Pour un Agent Docker déployé avec `docker/docker-compose.prod.yml`, copier la clé reçue par un canal de confiance indépendant de Central vers `docker/secrets/agent-release-public.pem` avant le démarrage. Le compose la monte en lecture seule sur `/run/secrets/agent-release-public.pem` et configure `Agent__UpdatePublicKeyPath`; le fichier doit être lisible par l’UID 1654 (par exemple `chmod 644`). Pour le compose généré dans l’interface, déposer le fichier `agent-release-public.pem` à côté de `docker-compose.yml`. Les deux montages échouent explicitement si le fichier est absent. L’Agent refuse la mise à jour si le chemin ou la signature manque, si le digest d’image diffère du manifeste signé, ou si le registre ne fournit pas l’image au digest annoncé.
|
||||
Pour un Agent Docker déployé avec `docker/docker-compose.agent.yml`, copier la clé reçue par un canal de confiance indépendant de Central vers `docker/secrets/agent-release-public.pem` avant le démarrage. Le compose la monte en lecture seule sur `/run/secrets/agent-release-public.pem` et configure `Agent__UpdatePublicKeyPath`; le fichier doit être lisible par l’UID 1654 (par exemple `chmod 644`). Pour le compose généré par l’interface, déposer le fichier `agent-release-public.pem` à côté de `docker-compose.yml`. Les deux montages échouent explicitement si le fichier est absent. L’Agent refuse la mise à jour si le chemin ou la signature manque, si le digest d’image diffère du manifeste signé, ou si le registre ne fournit pas l’image au digest annoncé.
|
||||
|
||||
## Rotation
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
# Docker Compose deployment
|
||||
|
||||
The required stack is PostgreSQL and Heimdall Central. The Agent is deployed
|
||||
separately on each camera-network host; the Central UI supplies a
|
||||
digest-pinned Agent Compose file for each site. RustFS, ntfy, Ollama, TURN,
|
||||
Redis and scheduled backups have separate Compose files and can be left out.
|
||||
|
||||
## Central and database
|
||||
|
||||
Copy `.env.example` to the ignored `docker/.env`, replace every example value,
|
||||
and create the PostgreSQL password file and JWT keys before production use.
|
||||
The database password in `DATABASE_URL` must match `docker/secrets/db_password`.
|
||||
|
||||
```sh
|
||||
mkdir -p -m 700 docker/secrets
|
||||
openssl rand -base64 32 > docker/secrets/db_password
|
||||
cp .env.example docker/.env
|
||||
# Set DATABASE_URL, JWT__KEY, JWT__REFRESHKEY, SERVER_IMAGE_REFERENCE,
|
||||
# and UPDATES_RELEASE_API_URL in docker/.env.
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.prod.yml up -d
|
||||
```
|
||||
|
||||
The development Compose builds Central from the local source and starts only
|
||||
Central plus PostgreSQL:
|
||||
|
||||
```sh
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.yml up -d
|
||||
```
|
||||
|
||||
## Agent
|
||||
|
||||
Prefer the Compose shown in the Central UI's site installation panel. It uses
|
||||
the image reference and digest from Central's verified release manifest and
|
||||
includes the site token, public Central URL and Agent name. Save it as
|
||||
`docker-compose.yml` beside the trusted `agent-release-public.pem`, then run
|
||||
`docker compose up -d`. Do not substitute a mutable image tag for the digest.
|
||||
|
||||
The repository also provides `docker/docker-compose.agent.yml` for operators
|
||||
who deploy Agents from this checkout. Set `AGENT_IMAGE_REFERENCE`,
|
||||
`HEIMDALL_CENTRAL_URL` and `HEIMDALL_SITE_TOKEN` in the Agent host's env file,
|
||||
copy the trusted public key to `docker/secrets/agent-release-public.pem`, and
|
||||
start it independently:
|
||||
|
||||
```sh
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.agent.yml up -d
|
||||
```
|
||||
|
||||
For local development use `docker/docker-compose.agent.dev.yml` with a
|
||||
development site token and the local Central URL. The published Agent image
|
||||
uses CPU inference. The optional NVIDIA, AMD and Intel Compose overlays only
|
||||
expose hardware for inventory; they do not enable GPU inference.
|
||||
|
||||
## Optional software
|
||||
|
||||
Start Central first to create the shared `heimdall-net` network. Optional
|
||||
services then join that network where applicable, so their Compose projects
|
||||
remain separate while Central can resolve their service names.
|
||||
|
||||
```sh
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.ollama.yml up -d
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.ntfy.yml up -d
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.rustfs.yml up -d
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.coturn.yml up -d
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.redis.yml up -d
|
||||
docker compose --env-file docker/.env -f docker/docker-compose.backup.yml up -d
|
||||
```
|
||||
|
||||
Configure Ollama with `OLLAMA_URL=http://ollama:11434` when enabled. Choose
|
||||
RustFS as the storage provider in Central and use `http://rustfs:9000` as its
|
||||
endpoint. ntfy defaults to `http://ntfy:80`; the UI can also be configured to
|
||||
use an external ntfy server. TURN is not required until WebRTC is enabled.
|
||||
Redis is provided as a standalone service but is not currently required by
|
||||
Central. Backups are independent of the core startup and require the core
|
||||
network and PostgreSQL service to be running.
|
||||
|
||||
See [GPU Agent notes](gpu-runtime.md) and
|
||||
[Agent update signing](agent-release-signing.md) for device access and
|
||||
trusted-key setup.
|
||||
+5
-5
@@ -10,25 +10,25 @@ device to the Agent for inventory and hardware experiments:
|
||||
```sh
|
||||
# NVIDIA
|
||||
docker compose --env-file docker/.env \
|
||||
-f docker/docker-compose.yml \
|
||||
-f docker/docker-compose.agent.yml \
|
||||
-f docker/docker-compose.gpu-nvidia.yml \
|
||||
--profile gpu-nvidia-inventory up -d heimdall-agent
|
||||
|
||||
# AMD ROCm devices
|
||||
docker compose --env-file docker/.env \
|
||||
-f docker/docker-compose.yml \
|
||||
-f docker/docker-compose.agent.yml \
|
||||
-f docker/docker-compose.gpu-amd.yml \
|
||||
--profile gpu-amd-inventory up -d heimdall-agent
|
||||
|
||||
# Intel render device
|
||||
docker compose --env-file docker/.env \
|
||||
-f docker/docker-compose.yml \
|
||||
-f docker/docker-compose.agent.yml \
|
||||
-f docker/docker-compose.gpu-intel.yml \
|
||||
--profile gpu-intel-inventory up -d heimdall-agent
|
||||
```
|
||||
|
||||
Use the same overlay with `docker/docker-compose.prod.yml` in place of the
|
||||
development file. For Intel and AMD hosts, set `VIDEO_GID` and `RENDER_GID` to
|
||||
Use the same overlay with `docker/docker-compose.agent.dev.yml` for a local
|
||||
Agent build. For Intel and AMD hosts, set `VIDEO_GID` and `RENDER_GID` to
|
||||
the host group IDs that can access `/dev/dri`. The NVIDIA option requires the
|
||||
NVIDIA Container Toolkit and Docker Compose GPU device reservations.
|
||||
|
||||
|
||||
@@ -70,8 +70,10 @@ Heimdall/
|
||||
├── docker/
|
||||
│ ├── Dockerfile.central # Multi-stage ✅
|
||||
│ ├── Dockerfile.agent # Multi-stage ✅
|
||||
│ ├── docker-compose.yml # PostgreSQL + RustFS + Central + Agent + Workers ✅
|
||||
│ └── docker-compose.local.yml # Local compose overrides
|
||||
│ ├── docker-compose.yml # Central de développement + PostgreSQL
|
||||
│ ├── docker-compose.prod.yml # Central de production + PostgreSQL
|
||||
│ ├── docker-compose.agent.yml # Agent de production indépendant
|
||||
│ └── docker-compose.<service>.yml # Logiciels optionnels isolés
|
||||
├── docs/
|
||||
│ ├── MASTER_SPECIFICATION.md # Spec complète
|
||||
│ ├── implementation.md # ← ce fichier
|
||||
|
||||
Reference in new issue
Block a user