arnaud.dartois
1b512ab040
fix(agent): keep heartbeat timeouts transient ( #277 )
...
Heimdall Gitea / Detect CI scope (push) Successful in 12s
Heimdall Gitea / Build and tests (push) Successful in 25m48s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan agent image (push) Successful in 10m1s
Heimdall Gitea / Build and scan server image (push) Successful in 10m4s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 2m13s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 23m19s
Heimdall Gitea / CI policy (push) Successful in 7s
Co-authored-by: Arnaud Dartois <admin@tordais.cc >
2026-11-07 10:24:31 +01:00
arnaud.dartois
c200f27461
Remove hardcoded service endpoints ( #137 )
...
Heimdall Gitea / Detect CI scope (push) Successful in 6s
Heimdall Gitea / Build and tests (push) Successful in 24m37s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan agent image (push) Successful in 6m4s
Heimdall Gitea / Build and scan server image (push) Successful in 9m39s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 2m32s
Heimdall Gitea / CI policy (push) Successful in 2s
Co-authored-by: Arnaud Dartois <admin@tordais.cc >
2026-11-04 20:55:14 +01:00
Arnaud Dartois
3d871b72ac
fix(agent): use a lightweight heartbeat change signal
Heimdall Gitea / Build and tests (pull_request) Failing after 6m5s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped
2026-10-25 02:08:00 +01:00
Arnaud Dartois
d543eced8d
fix(agent): wake heartbeat loop when interval changes
Heimdall Gitea / Build and tests (pull_request) Failing after 4m55s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped
2026-10-25 02:58:06 +02:00
Arnaud Dartois
e82dbf9a0a
fix(agent): load enrollment secrets as systemd credentials
Heimdall Gitea / Build and tests (pull_request) Failing after 19m12s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
2026-10-22 06:57:50 +02:00
Arnaud Dartois
64a769c7de
fix(agent): bound inference work and drain ONNX before disposal
2026-10-20 02:25:27 +02:00
Arnaud Dartois
be05bdabcf
fix(mapping): corriger AgentExtensions.ToResponse — ajouter GPU fields manquants
...
fix(mapping): corriger AgentExtensions.ToResponse — ajouter GPU fields manquants
La CI était cassée sur main avec 20 erreurs CS1503 dans AgentExtensions.cs.
Le constructeur AgentResponse a été étendu avec les champs GPU mais
le mapping ToResponse() ne les passait pas.
Fixes le build cassé sur main et débloque les PRs en attente.
2026-08-27 15:02:17 +02:00
Arnaud Dartois
6eae4eea2f
feat(agent): détection GPU + heartbeat étendu + badges Admin UI ( #160 )
2026-08-26 23:52:16 +02:00
Arnaud Dartois
4792b69e46
feat(agent): télémétrie inventaire matériel — CPU/mémoire/disque/GPU/OS/réseau ( Fixes #82 #83 #84 #85 ) ( #137 )
...
## Contexte
Implémentation des tickets #82 , #83 , #84 , #85 — télémétrie inventaire matériel agent. L'objectif est de fournir au central un maximum d'informations sur les machines des agents (CPU, mémoire, disques, GPU, OS, réseau, conteneur) sans SSH.
## Changements
### Nouveaux collecteurs (src/Heimdall.Agent/Services/)
- **CpuInfoProvider** : parse `/proc/cpuinfo` (vendor, modèle, cœurs physiques/logiques, fréquence, flags AVX/AVX2/FMA/AVX512, cache), topologie, détection cgroup CPU (`/sys/fs/cgroup/cpu.max` v2)
- **DiskInventoryProvider** : énumère les montages (`/proc/mounts`), capacité/libre/type SSD/HDD via `/sys/block/*/queue/rotation`
- **GpuInventoryProvider** : nvidia-smi, sysfs DRM, vainfo, rocm-smi avec fallback silencieux, multi-GPU
- **HostInfoProvider** : os-release, uname, `/proc/uptime` (uptime machine ≠ process), températures sysfs
- **ContainerInfoProvider** : détection Docker (/.dockerenv, cgroup), ID conteneur, limites CPU/mémoire
### Refonte SystemMetricsProvider
- Séparation host vs process (RAM machine ≠ RAM conteneur ≠ WorkingSet64)
- Uptime machine (`/proc/uptime`) distinct de l'uptime process
- Mémoire swap
### Entité Agent + Migration
- Champs structurés CPU/mémoire/disque/GPU/OS/réseau (tous nullable, rétrocompatible)
- Migration EF `AddAgentTelemetryInventory`
### Transport heartbeat
- Inventaire au register + refresh périodique (5 min, pas à chaque tick)
- Champs JSON pour listes (disques, GPU, interfaces réseau, températures)
### UI Admin (AgentDetail.razor)
- Sections CPU, Mémoire/Disques, GPU, Machine/Conteneur avec barres de progression et badges
### Tests
- 40+ tests unitaires : providers, handlers, entité Agent
- Total : 999 tests verts (Domain 149, Application 397, Agent 210, Web 243)
## Tickets liés
- Fixes #82 — CPU inventory
- Fixes #83 — Mémoire & disque
- Fixes #84 — GPU inventory
- Fixes #85 — OS, conteneur, réseau
## Résultats des tests
- `dotnet build` : 0 erreur, 0 warning
- Domain.Tests : 149 passed
- Application.Tests : 397 passed
- Agent.Tests : 210 passed
- Web.Tests : 243 passed
- Total : 999 tests ✅
## Checklist
- [x] `dotnet build` vert (TreatWarningsAsErrors)
- [x] Tests unitaires verts
- [x] Migration EF créée
- [x] Champs nullable (rétrocompatible)
- [x] Pas de référence Infrastructure dans les contrôleurs
- [x] Collecteurs avec fallback silencieux (pas de crash sans GPU/Docker/sysfs)
Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/137
2026-08-20 14:13:06 +02:00
Arnaud Dartois
566aa84bc7
chore: auto-commit 2026-08-12 20:05 [Heimdall] src/Heimdall.Agent/Services/AgentRegistrationService.cs, src/Heimdall.Agent/Services/SnapshotPipelineService.cs, src/Heimdall.Application/DTOs/SettingDto.cs, src/Heimdall.Domain/Entities/UserNotificationConfig.cs, src/Heimdall.Infrastructure/BackgroundJobs/DependencyInjection.cs…
2026-08-12 20:05:12 +02:00
Arnaud Dartois
0136bf33ec
feat(logs): remontée des logs agents vers le central — buffer, API, UI ( Fixes #50 #51 #52 )
...
- Agent : LogBufferService (ring buffer borné, drop-oldest), AgentLoggingProvider
(capture ILogger non-bloquante), LogSanitizer (masque password/token/secret/bearer),
LogUploadService (batch POST /api/agents/{id}/logs, retry, drop si 400)
- Central : entité AgentLogEntry + migration AddAgentLogEntries (index AgentId+TimestampUtc),
SubmitAgentLogsCommand (batch <= 200, entrées invalides ignorées),
GetAgentLogsQuery (pagination, filtres niveau/période/recherche),
endpoints POST + GET /api/agents/{id}/logs
- UI : onglet Logs dans AgentDetail (filtres, pagination, auto-refresh toggle)
- Logs agent enrichis : heartbeat succès (Debug), résolution IP (Debug)
- Tests : LogBufferServiceTests (6), AgentDetailLogsTests (4), handlers AgentLogs (8)
2026-08-11 18:51:52 +02:00
Arnaud Dartois
3ff20ddf98
fix(agent): settings distants réellement appliqués (heartbeat live)
...
ConfigReceiverService.ApplySetting ne faisait que logger. Le setting
heartbeat.interval.seconds est désormais appliqué à chaud : écrit dans
AgentState.HeartbeatIntervalSeconds (snapshot thread-safe) et relu par
AgentRegistrationService à chaque cycle — plus besoin de redémarrer
l'agent pour changer l'intervalle. Validation 5-300s, valeurs invalides
ignorées sans muter l'état.
Tests : +2 (application live vérifiée, invalides ne mutent pas l'état).
2026-08-10 11:02:37 +02:00
Arnaud Dartois
4516761a3a
fix(agent): authentifie le heartbeat via X-API-Key au lieu de Bearer
...
Le central (ApiKeyAuthenticationHandler) ne lit que le header X-API-Key.
L'agent posait Authorization: Bearer <apiKey> sur le client 'Central'
→ tout heartbeat et le heartbeat final de StopAsync renvoyait 401.
Corrige les deux chemins (identité existante + post-registration) et
verrouille le comportement avec deux tests (nouvelle identité, identité
réutilisée).
2026-08-10 10:09:27 +02:00
Arnaud Dartois
1c08e0394d
refactor(agent): use Options pattern with validation instead of raw env vars
...
Introduce AgentOptions class with DataAnnotations validation bound
from configuration (env vars with Agent__ prefix). Replace all
Environment.GetEnvironmentVariable() calls with typed IOptions<T>
injection. Config errors are caught at startup via ValidateOnStart().
2026-07-18 14:11:47 +00:00
Arnaud Dartois
f03ed91695
feat(agent): add system metrics (CPU, memory, disk, uptime) to heartbeat
...
Introduce SystemMetricsProvider that reads /proc on Linux (with
safe fallbacks on other platforms) and includes CPU usage, memory
usage, disk usage, and uptime in every heartbeat payload. Allows
Central to monitor agent health proactively.
2026-07-18 14:06:09 +00:00
Arnaud Dartois
4b6e4ce27a
feat(agent): persist agent identity to disk so it survives restarts
...
Replace the mutable AgentState POCO with a file-persisted version.
On startup, load existing identity from /var/lib/heimdall/agent-state.json
and skip re-registration. On first registration, save identity to disk.
Prevents orphaned agents in Central after agent restarts.
2026-07-18 14:05:07 +00:00
Arnaud Dartois
df74a61744
feat(agent): add graceful shutdown with final offline heartbeat
...
Override StopAsync to send a final heartbeat with IsOffline=true
before the agent stops. This allows Central to distinguish between
intentional shutdown and unexpected disconnection.
2026-07-18 14:03:49 +00:00
Arnaud Dartois
7d30d93939
feat(agent): add retry with exponential backoff on registration failure
...
Wrap agent registration in 5-attempt retry loop with exponential
backoff (2^attempt seconds). Prevents crash-loop when Central is
temporarily unavailable on startup. OperationCanceledException
bubbles up immediately for clean shutdown.
2026-07-18 14:03:14 +00:00
Arnaud Dartois
da1a278b14
perf(agent): replace new HttpClient() with IHttpClientFactory for IP resolution
...
Use IHttpClientFactory instead of manual new HttpClient() in
ResolvePublicIpAsync to prevent socket exhaustion in long-running
agent service. Register a named 'IpResolver' client for this purpose.
2026-07-18 14:02:40 +00:00
Arnaud Dartois
0473f8ff5b
fix(agent): implement GetPublicIp via api.ipify.org with async resolution
...
Replaced the always-null GetPublicIp stub with a proper async
implementation. IP is resolved once at registration time (not per
heartbeat) and stored in AgentState for reuse. Uses 5s timeout
and graceful failure (null if unreachable).
2026-07-17 19:29:40 +00:00
Arnaud Dartois
dfc888db94
feat(mvp): agent auth, cameras UI, rate limiting attempt
...
- Agent: fix heartbeat auth — set API Key header after registration
- Cameras Blazor: full page with create/delete/list by site
- ApiClient: cameras CRUD endpoints + CameraItem DTO
- Rate limiting: attempted but deferred (System.Threading.RateLimiting package issue)
- Security: refresh token rotation now enforced server-side
2026-07-17 06:30:09 +00:00
Arnaud Dartois
b217c932e8
feat(mvp): implement MVP multi-site platform
...
Complete MVP implementation (Étape 1) covering:
- Domain: primitives (Entity<TId>, ValueObject), 10 entities, 6 enums
- EF Core: AppDbContext + Identity, 8 EntityTypeConfigurations, audit/soft-delete interceptors, initial migration
- Application: service interfaces, DTOs, FluentValidation, ServiceResult pattern
- Security: Identity + JWT + API Key multi-auth, role-based permissions, constant-time key validation
- API: Auth/Sites/Agents controllers with explicit auth scheme policies
- Workers: Hangfire PostgreSQL setup with schema isolation, HeartbeatMonitorJob
- Agent: registration service + 30s heartbeat loop
- Docker: multi-stage Dockerfiles for central + agent, docker-compose.yml
- CI/CD: GitHub Actions pipeline with build+test and Docker build
- Tests: 13 domain tests (Site, Agent, Camera entities)
Architecture decisions per deliberation council:
- API Key via AuthenticationHandler<T> (not middleware)
- Explicit [Authorize(AuthenticationSchemes)] on all endpoints
- Event/Recording/Person/Vehicle deferred from initial migration
- Hangfire compatible with .NET 10 (v1.8.17)
2026-07-16 20:53:56 +00:00