nixos-module: add scheduler timer for artisan schedule:run
Invoice Ninja relies on Laravel's scheduler for recurring invoices, scheduled reports, and other internal cron-driven jobs. Without a systemd unit invoking `artisan schedule:run` periodically, the app's dashboard reports "cron jobs are not enabled" after login. Adds invoiceninja-scheduler.timer (every minute, matching upstream's documented cron cadence) and its oneshot service, and extends the automated test to assert the timer is active and schedule:run succeeds. Note: the app's own is_scheduler_running flag only flips on a 5-minute wall-clock boundary (app/Console/Kernel.php's everyFiveMinutes() job), so the dashboard warning can take a few minutes to clear after boot - confirmed working via the "Refresh Data" button in that same modal. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -623,6 +623,32 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.invoiceninja-scheduler = {
|
||||
description = "Invoice Ninja scheduled tasks (artisan schedule:run)";
|
||||
after = [ "invoiceninja-data-setup.service" ];
|
||||
requires = [ "phpfpm-invoiceninja.service" ];
|
||||
# Ensure chromium is available, for any scheduled tasks that generate PDFs.
|
||||
path = extraPrograms;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${invoiceninja-manage}/bin/invoiceninja-manage schedule:run";
|
||||
User = user;
|
||||
Group = group;
|
||||
StateDirectory = lib.mkIf (cfg.dataDir == "/var/lib/invoiceninja") "invoiceninja";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.invoiceninja-scheduler = {
|
||||
description = "Run Invoice Ninja's scheduled tasks every minute";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "minutely";
|
||||
Persistent = true;
|
||||
Unit = "invoiceninja-scheduler.service";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.invoiceninja-data-setup = {
|
||||
description = "Invoice Ninja setup: migrations, environment file update, cache reload, data changes";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
Reference in New Issue
Block a user