Commit Graph

29 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
96d726c43c fix: retire cron containers past their active deadline
Cron containers were never reaped once they exceeded their active deadline, so a hung cron task ran indefinitely instead of being retired after 24 hours as documented. `cron:run` now also accepts a `--ttl-seconds` argument, matching the one `dokku run` already takes.
2026-08-12 13:11:34 -04:00
Jose Diaz-Gonzalez
c6b4ea75c1 refactor: move host-crontab generation into cron plugin
Host-crontab generation for `app.json` cron tasks now lives in the `cron` plugin, gated by a new `scheduler-uses-host-cron` trigger that the `docker-local` scheduler answers true while self-managed schedulers such as `k3s` answer false. This lets any host-cron scheduler participate in normal `app.json` cron without coupling to `scheduler-docker-local` or duplicating the crontab writer, while the `k3s` scheduler continues to manage its own in-cluster cron jobs.

Closes #8862.
2026-07-22 08:35:11 -04:00
Jose Diaz-Gonzalez
8282981361 feat: accept --global on :report subcommands
Every `:report` subcommand now recognizes `--global` as a scope selector that limits the report to globally-configured properties, including in JSON form via `--global --format json`. Previously this combination was rejected because `--global` was treated as an info flag, conflicting with `--format`. The shared `common.ParseReportArgs` helper now returns a `ReportArgs` struct exposing the parsed scope; each Go and bash report selects a global-only flag map when scope is global, and skips per-app verification.
2026-04-29 10:30:59 -04:00
Jose Diaz-Gonzalez
d49f9b89c2 chore: add commands to cron:help output 2025-11-10 01:57:12 -05:00
Jose Diaz-Gonzalez
f99e3a6c9c feat: add ability to suspend and resume a cron task by ID
This takes advantage of the properties system and allows users to suspend/resume the task at will.
2025-11-09 23:16:38 -05:00
Jose Diaz-Gonzalez
7adeee7086 feat: add ability to list global cron tasks
Closes #7732
2025-09-14 04:38:19 -04:00
Jose Diaz-Gonzalez
7e37f9dc79 fix: add missing trigger 2025-06-23 00:22:38 -04:00
Jose Diaz-Gonzalez
776013b0f4 fix: write the cron config after the app.json has been deleted
Without this, we try to write the config for the app even though it doesn't exist anymore, causing issues with deleting apps with invalid cron configs.
2025-06-19 01:09:15 -04:00
Jose Diaz-Gonzalez
36da77a2ff fix: write cron in pre-delete phase 2025-06-10 21:46:07 -04:00
Jose Diaz-Gonzalez
c0eb12f572 feat: add ability to set maintenance mode for all cron tasks running for an app
Closes #6953
2025-06-08 22:34:47 -04:00
Garret Heaton
244b898fd2 Remove errant tab character in cron:set help text
Noticed it was showing up first and with odd indentation in the output of `dokku help --all`. Now it will be indented like the others.
2024-04-13 20:23:45 -04:00
Jose Diaz-Gonzalez
41b0898db9 fix: correct issue where cron properties cannot be retrieved if global 2024-03-14 08:16:55 -04:00
Jose Diaz-Gonzalez
c36f23b072 fix: add missing cron:set command
The code existed but somehow it wasn't exposed as a command.

Closes #6655
2024-03-06 01:56:25 -05:00
Jose Diaz-Gonzalez
fe262a3a3c chore: remove extra trailing newline 2024-02-12 21:43:45 -05:00
Jose Diaz-Gonzalez
3c6cc68086 refactor: capture output by default
This is almost certainly the correct default for Dokku. While it's a BC break and might cause an increase in memory usage, the api is mostly internal and therefore this is safe to use.
2024-02-12 20:28:31 -05:00
Jose Diaz-Gonzalez
047a3c00f5 chore: remove default false values when calling CallExecCommand 2024-02-12 20:07:43 -05:00
Jose Diaz-Gonzalez
50239b056c fix: use new CallExecCommand when checking to see how help is being called
This is part of ongoing work to remove usage of the depreated NewShellCmd.
2024-02-12 00:55:16 -05:00
Jose Diaz-Gonzalez
c23e878e7d feat: add the ability to specify a custom mailto for all cron output 2023-10-15 20:25:09 -04:00
Jose Diaz-Gonzalez
515994c8d3 feat: add the ability to execute a cron task on the fly
Closes #4904
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
820883e60c feat: add json format output to cron:list command
This makes it easier to parse output in a machine-readable format - such as when interacting with cron tasks via jq for writing tests.
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
afc318526c refactor: move crontab writing code to scheduler-docker-local plugin
The implementation was very heavily docker-local specific and thus didn't make a ton of sense to keep in the cron plugin.

This also re-introduces changes from #5908 to parallelize the crontab generation (which is also specific to the docker-local scheduler) that were lost during a rebase.

The impetus for this change was implementing a `cron:run` command. The logic for actually running the command isn't scheduler specific - merely invoking `dokku run` with the appropriate arguments - but all the logic around how the commands were retrieved were, so the change was made pre-emptively.
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
257baa1d46 refactor: run crontab under sudo to support rhel systems
RHEL blocks users from executing crontab as themselves Because Of Reasons so we need to use sudo instead.

Also refactors file writing to properly support writing the permissions on sudoers files going forward.

Closes #5020
2022-02-27 19:17:04 -05:00
Jose Diaz-Gonzalez
d55e34a55f refactor: use LogFailWithError to allow a unified exit code for golang commands when the app is missing 2021-02-28 15:20:46 -05:00
Jose Diaz-Gonzalez
d09a7506df refactor: bubble up error handling so that standard exit codes can be set at the top-level
LogFail shouldn't be called internally if at all possible.
2021-02-28 15:20:46 -05:00
Jose Diaz-Gonzalez
be84325de1 feat: add support for injected cron entries
This allows alternative plugins - such as dokku-letsencrypt - to inject scheduled cron tasks into the cron system used by Dokku. Cron systems can choose to include or not include a cron task based on the specified scheduler, and can also optionally use a third parameter to store arbitrary information.
2021-02-07 16:45:34 -05:00
Jose Diaz-Gonzalez
033b0952dd feat: allow formatting :report command output as json 2021-02-01 22:23:30 -05:00
Jose Diaz-Gonzalez
cb43d0cc64 chore: update help output for cron:list 2021-01-21 01:30:47 -05:00
Jose Diaz-Gonzalez
20b2773ea2 fix: correct help output 2021-01-20 23:21:06 -05:00
Jose Diaz-Gonzalez
f7ef14d737 feat: add initial scheduled task implementation
This functionality enables users to manage a global crontab for the Dokku user that contains all scheduled tasks across all apps. Alternative schedulers can implement cron tasks as desired.
2021-01-20 14:49:48 -05:00