feat(server): scheduled jobs on the server and a Scheduled tab in the admin panel
Owner review 2, R10: nothing may run out of sight, so every timer the server ran becomes a system schedule the admin panel shows and manages, and administrators create their own. - SchedulerHost runs the shared Scheduler on the job engine (started after JobEngineHost, stopped before it); ServerScheduleHost gives it the container's time zone (UTC with a warning when TZ is unknown), the archive refreshed from archive.json at every run (what ArchivePolling did), the clean-up steps and the system schedules: archive-scan every 10 minutes (no catch-up, also run once at start like the polling), upload-cleanup every 30 minutes, index-backup at 03:00 (SQLite only), housekeeping (job history) at 04:00 and audit-cleanup at 04:30. - ArchivePolling and DatabaseBackupService are gone; UploadMaintenance only recovers commits at start, its sweep is the "uploads" clean-up step. - /api/v1/schedules (ManageArchive, audited): list with actions and time zone, create, PUT/PATCH, delete (409 schedule_system), run now (409 schedule_pending), reset (409 schedule_no_defaults), runs paged by cursor; invalid fields are 400 invalid_schedule naming the field. - CHRONOS_AUDIT_RETENTION_DAYS (AuditRetentionDays, default 365) seeds the audit clean-up; set by the environment it is applied at every start and locked. Job history leaves Settings: it is the housekeeping schedule's age limit, and the setting is what a reset restores. - Admin panel: Jobs has Queue and Scheduled tabs; schedules with when (in the panel's language and the server's zone), next run, last result, a switch, Run now, Edit, Delete or Reset, their runs linking to the jobs, and a side panel for the action, recurrence and parameters; job rows a schedule queued carry a Scheduled pill. Strings in en and it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 808ce94ae29e3bf4522cb4d40dfd76d4f8529c64)
This commit is contained in:
1 parent
e5508e7e69
commit
75daab7275
66 files changed
+1985
-290
No files matched your search
@@ -49,7 +49,7 @@ public sealed record ServerCommandLine(ServerCommand Command, IReadOnlyList<stri
|
||||
CHRONOS_LOG_MAX_FILE_MB size at which a log file continues in a numbered one (default 50; 0: no limit)
|
||||
CHRONOS_LOG_MAX_TOTAL_MB size of all log files; beyond it the oldest are deleted (default 1024; 0: no limit)
|
||||
CHRONOS_LOG_ROTATION a new log file every day or every hour, UTC (daily | hourly; default daily)
|
||||
CHRONOS_AUDIT_RETENTION_DAYS days audit entries are kept (default 0: forever)
|
||||
CHRONOS_AUDIT_RETENTION_DAYS days of audit log the audit-cleanup schedule keeps (default 0: forever)
|
||||
CHRONOS_DIAGNOSTICS_LOG_MB MB from the end of each log file in the diagnostics zip (default 4)
|
||||
CHRONOS_DISCOVERY LAN beacon (true | false); in a container it needs host networking
|
||||
CHRONOS_PUBLIC_HTTP_PORT, CHRONOS_PUBLIC_HTTPS_PORT
|
||||
@@ -58,7 +58,7 @@ public sealed record ServerCommandLine(ServerCommand Command, IReadOnlyList<stri
|
||||
CHRONOS_TRUSTED_PROXIES proxy mode: addresses or networks (CIDR) whose X-Forwarded-* headers count
|
||||
(default: loopback only; list a proxy in another container or on another machine)
|
||||
|
||||
Container image only: PUID, PGID (user and group the server runs as, owners of /data), TZ (local time zone)
|
||||
Container image only: PUID, PGID (user and group the server runs as, owners of /data), TZ (time zone of the schedules)
|
||||
""";
|
||||
|
||||
public static ServerCommandLine Parse(IReadOnlyList<string> args)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Chronos.Core.Diagnostics;
|
||||
using Chronos.Data;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Data.Housekeeping;
|
||||
using Chronos.Protocol;
|
||||
using Chronos.Server.Api;
|
||||
using Chronos.Server.Configuration;
|
||||
@@ -144,10 +145,16 @@ public static class ServerHost
|
||||
services.AddSingleton<RenderNodeService>();
|
||||
services.AddSingleton<JobEngineHost>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<JobEngineHost>());
|
||||
// After the engine's host: the scheduler queues on its engine, starts after it and stops before it (owner review 2, R10).
|
||||
services.AddSingleton<ServerScheduleHost>();
|
||||
services.AddSingleton<SchedulerHost>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<SchedulerHost>());
|
||||
services.AddSingleton<RenderNodeMonitor>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<RenderNodeMonitor>());
|
||||
// Recovers interrupted commits at start; its sweep is the clean-up step of the upload-cleanup schedule.
|
||||
services.AddSingleton<UploadMaintenance>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<UploadMaintenance>());
|
||||
services.AddSingleton<ICleanupStep, UploadCleanupStep>();
|
||||
services.AddSingleton<DiscoveryBeaconService>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<DiscoveryBeaconService>());
|
||||
}
|
||||
@@ -169,6 +176,7 @@ public static class ServerHost
|
||||
FileEndpoints.Map(api);
|
||||
UploadEndpoints.Map(api);
|
||||
JobEndpoints.Map(api);
|
||||
ScheduleEndpoints.Map(api);
|
||||
NodeEndpoints.Map(api);
|
||||
ArchiveEndpoints.Map(api);
|
||||
AdminEndpoints.Map(api);
|
||||
|
||||
@@ -18,12 +18,12 @@ public sealed class ServerLogging
|
||||
public const int MaxRetentionDays = 3650;
|
||||
public const int MaxFileMb = 10 * 1024;
|
||||
public const int MaxTotalMb = 1024 * 1024;
|
||||
public const int MaxAuditRetentionDays = 36500;
|
||||
public const int MaxAuditRetentionDays = ServerOptions.MaxAuditRetentionDays;
|
||||
public const int MaxDiagnosticsLogMb = 1024;
|
||||
|
||||
/// <summary>The ranges <see cref="Problem"/> checks, for the start-up error.</summary>
|
||||
public const string Ranges = "log retention 1 to 3650 days, log file 0 to 10240 MB, logs total 0 to 1048576 MB and not below the log file, "
|
||||
+ "audit retention 0 to 36500 days, diagnostics logs 1 to 1024 MB";
|
||||
+ "audit retention 0 to 3650 days, diagnostics logs 1 to 1024 MB";
|
||||
|
||||
/// <summary>The levels the settings accept, least severe first; their wire names are lower case (<c>information</c>).</summary>
|
||||
public static IReadOnlyList<MsLogLevel> Levels { get; } =
|
||||
|
||||
Reference in new issue
Block a user