Adds S3-compatible snapshot storage (Alarik) with AWS Signature V4,
upload, thumbnail, and delete operations. Backfills Phase 2 & 3 with
27 new tests covering camera assignment strategies, event CRUD with
filtering, snapshot attachment, and API contract validation.
- SnapshotService with S3 REST API via HttpClient + SigV4 signing
- 10 unit tests for CameraAssignmentService (assign, release, failover, history)
- 9 unit tests for CameraEventService (create, query, filter, delete, snapshot)
- 8 integration tests for AssignmentsController + EventsController
- SnapshotService registration with 5-min timeout HTTP client
Multi-agent sites need automatic camera distribution, failover when
an agent goes offline, and rebalancing when new agents join.
Adds CameraAssignment entity with audit trail, 4 assignment strategies
(RoundRobin, GpuPriority, LeastCameras, Failover), a Hangfire failover
job that checks for stale heartbeats every 60s, a discovery coordinator
for leader election, 6 REST endpoints, EF migration, and DI registration.
Manual camera configuration does not scale beyond a few devices.
Automated discovery is needed to support deployments with 50+
cameras across heterogeneous protocols (ONVIF, mDNS, HTTP, ARP).
Phase 1 introduces 5 network probe services, a stream tester, an
orchestrating discovery service with IP+MAC deduplication, 11 REST
endpoints, a pre-verification endpoint, 57 tests, and DI registration.
Add complete camera discovery and stream testing specification,
Domain entities, enums, DTOs, Application interfaces, and EF Core
configurations for automated ONVIF/mDNS/HTTP/ARP camera detection.
- 4 new enums: CameraDiscoveryMethod, DetectedCameraType,
StreamProtocol, CameraCapability (flags)
- Camera entity extended with 15+ discovery/test fields
- New entities: CameraDiscoveryResult, DiscoveredStreamUrl
- DTOs: ProbeRequest/Response, StreamTestRequest/Session, etc.
- Interface: ICameraDiscoveryService (8 methods)
- EF Core configurations for all new tables + columns
- Full spec doc: docs/specifications/detection-camera.md (16 sections)
- 145 tests pass, 0 warnings
Inspiré de Strix (github.com/eduard256/Strix) — moteur de
découverte de flux IP supportant 3600+ marques, 100K+ patterns.
The service was registered only as AuthenticationStateProvider (base class),
but Login.razor, Register.razor, and MainLayout.razor inject the concrete
@inject HeimdallAuthStateProvider. Blazor's DI could not resolve it,
causing InvalidOperationException on page render.
Fix: register the concrete type first, then make the base class
registration resolve to the same instance via GetRequiredService.
The Dockerfile.central already compiled Heimdall.Web but it was never
deployed as a service. Add heimdall-web service using the same image
with entrypoint overridden to dotnet web/Heimdall.Web.dll.
- Expose port 5001 for the Blazor Server UI
- API_BASE_URL points to heimdall-central:8080 for server-side HTTP calls
- Healthcheck on root / returns 200 once the Blazor circuit is ready
- 🔴 Fix startup crash when DB is temporarily unavailable: add 5x retry
with exponential backoff to Database.MigrateAsync() in API and Workers
- 🔴 Fix EF Core 'required navigation with query filter' warnings:
add matching soft-delete query filters to AgentSetting, CameraCredentials,
CameraDetectionProfile, UserSite
- 🔴 Add Sentry error tracking to Workers (Hangfire background jobs)
- 🟡 Make Sentry/GlitchTip DSN configurable via SENTRY_DSN env var
(applies to API, Web, Agent, Workers)
- 🟡 Suppress EF Core RedundantIndexRemoved informational messages
Closes GlitchTip #538
Fix the filtered index column name casing in ALL .Designer.cs files
and AppDbContextModelSnapshot.cs:
- "status" → "Status" (Agent.LastHeartbeat index)
- "is_deleted" → "IsDeleted" (Site.IsDeleted index)
These must match the actual column names (PascalCase) since
PostgreSQL quoted identifiers are case-sensitive.
Also fix the InitialCreate migration .cs file directly.
All 10 references across 5 snapshot files corrected.
Pattern #4 from cross-project learning analysis: HeartbeatMonitorJob
injected AppDbContext directly (not thread-safe). Changed to
IDbContextFactory<AppDbContext> + registered factory in DI.
Other patterns verified already in place:
- CancellationToken on all async methods ✅ (100% controller adoption)
- N+1 per-entity loops ✅ (all services use bulk-loading)
- AsNoTracking ✅ (explicit on read-only queries)
- Global QueryTrackingBehavior.NoTracking deferred: safe for
new projects but requires write-path audit on existing codebase
The filtered index IX_sites_IsDeleted uses a WHERE clause
referencing "is_deleted" (lowercase underscore) but the column
is "IsDeleted" (PascalCase). PostgreSQL quoted identifiers are
case-sensitive, causing Npgsql.PostgresException on migration.
Fixes remaining HEIMDALL issues on GlitchTip.
The filtered index IX_agents_LastHeartbeat uses a WHERE clause
referencing "status" (lowercase) but the column is "Status"
(PascalCase). PostgreSQL quoted identifiers are case-sensitive,
causing Npgsql.PostgresException 42703 on migration.
Fixes HEIMDALL-2 on GlitchTip.
Add Sentry.AspNetCore v6.7.0 with hardcoded DSN constant
(not overridable by env) pointing to GlitchTip instance at
https://glitchtip.tordais.cc/6.
Same DSN configured across all three entry-point projects:
- Heimdall.Api
- Heimdall.Agent
- Heimdall.Web
Replace the background MigrationHostedService with inline
db.Database.MigrateAsync() before Identity role seeding. The
IHostedService started after app.Run(), but seeding ran synchronously
before app.Run() — causing 42P01 when RoleManager queried the roles
table that didn't exist yet.
- Add await db.Database.MigrateAsync() with 120s timeout before seeding
- Add structured logging (ILogger) and error handling around migration
- Remove MigrationHostedService.cs (dead code — inline migration makes
it permanently no-op)
- Remove unused using Heimdall.Infrastructure.Services
- Unify using style (using var instead of using block)
Worker.cs was a template artifact that only logged 'running' every
second. It was never registered in DI. AgentRegistrationService
handles all background work.
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().
Migrate from Microsoft.NET.Sdk.Worker to Microsoft.NET.Sdk.Web to
enable HTTP health checks. Add /healthz endpoint via
AgentHealthCheck (reports healthy when registered with Central).
Configure Docker HEALTHCHECK with 30s interval and 15s start period.
Heimdall.Agent does not use EF Core, Identity, or any Infrastructure
services. Removing the reference eliminates unnecessary transitive
dependencies (Npgsql, Hangfire, EF Core) and speeds up builds.
Add explicit Microsoft.Extensions.Http package (was transitively
provided by Infrastructure).
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.
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.
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.
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.
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.
bunit 2.8.4-preview transitively pulls AngleSharp 1.4.0 which has a
known moderate severity vulnerability (GHSA-pgww-w46g-26qg). Adding
a direct PackageReference to AngleSharp 1.5.2 overrides the transitive
version and resolves the CI build failure.
Alarik is a drop-in S3-compatible replacement requiring no application
code changes. All S3 APIs (upload, download, list, delete, multipart)
are fully supported.