docs: align Hangfire dashboard guide with route (#369)
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Skipped
Heimdall Gitea / Publish versioned installer release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 2s

This commit is contained in:
arnaud.dartois committed 2026-11-13 10:36:53 +01:00
1 parent f20ec93f6f
commit ea0e32cbe7
2 files changed
+12 -17

No files matched your search

+10 -17
View File
@@ -15,7 +15,7 @@
│ │ │ │
│ Hangfire Server │ │ Hangfire Server │
│ ├── Storage: PostgreSQL (Hangfire.PostgreSql) │ │ ├── Storage: PostgreSQL (Hangfire.PostgreSql) │
│ ├── Dashboard: /admin/jobs (authentifié, Admin only) │ │ ├── Dashboard: /hangfire (AdminJobs ou rôle Admin) │
│ └── Jobs: │ │ └── Jobs: │
│ ├── RetentionCheck (Recurring, daily) │ │ ├── RetentionCheck (Recurring, daily) │
│ ├── S3Cleanup (Recurring, daily) │ │ ├── S3Cleanup (Recurring, daily) │
@@ -467,27 +467,20 @@ public class HangfireInitializer : IHostedService
Intégré à l'UI Admin, authentifié, pas exposé publiquement : Intégré à l'UI Admin, authentifié, pas exposé publiquement :
La route Central est mappée par `MapHangfireDashboard("/hangfire", ...)` dans
`src/Heimdall.Web/Program.cs`. `HangfireAdminAuthorizationFilter` autorise les
requêtes authentifiées portant `Admin.Jobs` ou le rôle `Admin`. Le dashboard
n'est pas mappé dans l'environnement `Testing`.
```csharp ```csharp
// Heimdall.Api / Program.cs // Heimdall.Web/Program.cs
app.UseHangfireDashboard("/admin/jobs", new DashboardOptions app.MapHangfireDashboard("/hangfire", new DashboardOptions
{ {
Authorization = Authorization =
[ [
new HangfireAuthorizationFilter() // vérifie AppPermissions.AdminJobs new HangfireAdminAuthorizationFilter()
], ],
StatsPollingInterval = 3000, // 3s
DisplayStorageConnectionString = false,
DashboardTitle = "Heimdall — Jobs",
}); });
public class HangfireAuthorizationFilter : IDashboardAuthorizationFilter
{
public bool Authorize(DashboardContext context)
{
var httpContext = context.GetHttpContext();
return httpContext.User?.IsInRole(AppRoles.Admin) == true;
}
}
``` ```
--- ---
@@ -529,4 +522,4 @@ Hangfire dashboard is accessible only to Admin
Hangfire dashboard returns 403 for non-Admin Hangfire dashboard returns 403 for non-Admin
Agent jobs are recreated after agent restart Agent jobs are recreated after agent restart
Agent InMemory storage does not persist across restarts Agent InMemory storage does not persist across restarts
``` ```
+2
View File
@@ -7,6 +7,8 @@ description: Diagnose and recover Heimdall startup from transient Hangfire Postg
Heimdall registers all recurring jobs synchronously after database migrations in `src/Heimdall.Web/Program.cs`. Hangfire's PostgreSQL storage acquires a distributed lock per recurring-job id during `AddOrUpdate`; `agent-failover` is currently the first registration after removing the legacy `heartbeat-monitor` id. Heimdall registers all recurring jobs synchronously after database migrations in `src/Heimdall.Web/Program.cs`. Hangfire's PostgreSQL storage acquires a distributed lock per recurring-job id during `AddOrUpdate`; `agent-failover` is currently the first registration after removing the legacy `heartbeat-monitor` id.
The Central dashboard route is mapped from the same Program.cs with `MapHangfireDashboard("/hangfire", ...)`, guarded by `HangfireAdminAuthorizationFilter` for `Admin.Jobs` or the Admin role, and omitted in `Testing`. When updating `docs/hangfire-usage.md`, verify the route and filter against these sources; do not copy a stale `UseHangfireDashboard` or `/admin/jobs` example.
## Implementation and diagnosis ## Implementation and diagnosis
- Inspect the GlitchTip event stack, app start time, event timestamps, and `Program.cs`/`JobSetup.cs` line references. A timeout names the contended job key; it proves lock contention, not the number or identity of competing processes. - Inspect the GlitchTip event stack, app start time, event timestamps, and `Program.cs`/`JobSetup.cs` line references. A timeout names the contended job key; it proves lock contention, not the number or identity of competing processes.