CI / Build and test (push) Successful in 7m0s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 13m28s
CI / PostgreSQL 16 integration (push) Successful in 5m52s
CI / PostgreSQL 17 integration (push) Successful in 4m50s
CI / Docker image (push) Successful in 1m4s
Release / Server image (push) Successful in 1m35s
- Jobs > Scheduled on the desktop and the admin panel. Every timer that queued work is now a visible system schedule: archive scan, upload clean-up, index backup, job-history and audit clean-ups, desktop housekeeping. New actions: verify, thumbnails, proxies, analysis, maintenance, backup, clean-ups, reports. - The scheduler: migration 0007, in-house recurrence, compare-and-set claim, catch-up, scan at start. - Log settings: levels, retention, size parts, total limit, daily or hourly rotation, audit retention, diagnostics share; the server writes Debug/Trace to its files again; logging never fails a job. Upgrade: CHRONOS_LOG_LEVEL set in an existing container locks both levels; migration 0007 is one-way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
91 lines
5.0 KiB
C#
91 lines
5.0 KiB
C#
namespace Chronos.Server.Hosting;
|
|
|
|
/// <summary>What <c>Chronos.Server</c> was asked to do.</summary>
|
|
public enum ServerCommand
|
|
{
|
|
/// <summary>Run in the console (Docker, Linux, development).</summary>
|
|
Run,
|
|
|
|
/// <summary>Run under the Windows Service Control Manager (the command line the installed service uses).</summary>
|
|
Service,
|
|
|
|
InstallService,
|
|
UninstallService,
|
|
|
|
/// <summary>Probe <c>/health</c> of the local server and exit 0/1 (container health check).</summary>
|
|
HealthCheck,
|
|
|
|
Help,
|
|
}
|
|
|
|
/// <summary>Command-line switches of the server; anything else is passed on to the web host.</summary>
|
|
public sealed record ServerCommandLine(ServerCommand Command, IReadOnlyList<string> HostArguments, string? Error)
|
|
{
|
|
public const string Usage = """
|
|
Chronos Server — time-lapse archive, uploads, jobs and rendering.
|
|
|
|
Usage: Chronos.Server [--service | --install-service | --uninstall-service | --healthcheck | --help]
|
|
|
|
(no switch) run in the console until Ctrl+C
|
|
--service run under the Windows Service Control Manager
|
|
--install-service register the "ChronosServer" Windows service (automatic start, LocalSystem)
|
|
--uninstall-service stop and remove the Windows service
|
|
--healthcheck exit 0 when the local server answers /health, 1 otherwise
|
|
|
|
Configuration: /data/server.json (CHRONOS_DATA_PATH) overridden by environment variables:
|
|
CHRONOS_ARCHIVE_PATH CHRONOS_DATA_PATH CHRONOS_SERVER_NAME CHRONOS_ADMIN_USER CHRONOS_ADMIN_PASSWORD
|
|
CHRONOS_DB (postgres | sqlite | connection string) CHRONOS_DB_HOST CHRONOS_DB_PORT CHRONOS_DB_NAME CHRONOS_DB_USER
|
|
CHRONOS_DB_PASSWORD CHRONOS_DB_SSLMODE CHRONOS_HTTP_PORT CHRONOS_HTTPS_PORT CHRONOS_TLS_MODE (auto | pem | proxy)
|
|
CHRONOS_TLS_CERT CHRONOS_TLS_KEY CHRONOS_LANG
|
|
CHRONOS_SPACE_PATH folder whose volume's free space the admin panel shows (default: the archive's); on
|
|
Unraid the share's array view (/mnt/user0/<share>) mapped read-only to /space
|
|
CHRONOS_PARALLELISM photos the running job processes at once (jobs run one at a time; default: half the
|
|
cores); CHRONOS_WORKERS, its former name, still sets it
|
|
CHRONOS_PRIORITY_QUEUE a job of a higher level pauses the running one, which resumes afterwards (true | false)
|
|
CHRONOS_LOG_LEVEL least severe level of the log files and the console (Trace | Debug | Information |
|
|
Warning | Error | Critical | None; default Information)
|
|
CHRONOS_LOG_CONSOLE_LEVEL the console's own level (default: CHRONOS_LOG_LEVEL's)
|
|
CHRONOS_LOG_RETENTION_DAYS days log files are kept (default 14)
|
|
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 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
|
|
ports clients reach when the container's ports are published as other host ports
|
|
(admin redirect to HTTPS, LAN beacon)
|
|
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 (time zone of the schedules)
|
|
""";
|
|
|
|
public static ServerCommandLine Parse(IReadOnlyList<string> args)
|
|
{
|
|
var command = ServerCommand.Run;
|
|
var rest = new List<string>();
|
|
string? error = null;
|
|
foreach (var arg in args)
|
|
{
|
|
ServerCommand? parsed = arg switch
|
|
{
|
|
"--service" => ServerCommand.Service,
|
|
"--install-service" => ServerCommand.InstallService,
|
|
"--uninstall-service" => ServerCommand.UninstallService,
|
|
"--healthcheck" => ServerCommand.HealthCheck,
|
|
"--help" or "-h" or "-?" or "/?" => ServerCommand.Help,
|
|
_ => null,
|
|
};
|
|
if (parsed is not { } switchCommand)
|
|
{
|
|
rest.Add(arg);
|
|
continue;
|
|
}
|
|
if (command != ServerCommand.Run && command != switchCommand) error = $"{arg} cannot be combined with another command switch.";
|
|
command = switchCommand;
|
|
}
|
|
return new ServerCommandLine(command, rest, error);
|
|
}
|
|
}
|