-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
How to use GitHub
- Please use the 👍 reaction to show that you are interested into the same feature.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Is your feature request related to a problem? Please describe.
Currently, some apps require the setup of a fast background job worker using occ background-job:worker. Some apps require more than one worker of the same job, even. Setting these up e.g. with systemd is cumbersome and repetitive. Additionally for nextcloud AIO, it would be beneficial to have a generic way to run these without hard coding jobs for all possible apps in the AIO code.
Describe the solution you'd like
We could have a new php script next to cron.php and occ or just another occ command that
- figures out which jobs to run
- runs the necessary background workers as sub processes
- keeps track of them and restarts them when they fail or exit
- Passes the stdout of the workers through to its own stdout
Background services could be set via a a php file, or a json file. A service could be either a background-job:worker "worker" or a "dedicated-cron" cron.php runner, with a set list of jobs. This would cater to both QueuedJobs and TimedJobs (the latter cannot be run by the bg-job worker).
{
"services": {
"TaskProcessing 1": {
"type": "worker",
"jobs": ["OC\\TaskProcessing\\SynchronousBackgroundJob"],
},
"TaskProcessing 2": {
"type": "worker",
"jobs": ["OC\\TaskProcessing\\SynchronousBackgroundJob"],
},
"WebhookListeners": {
"type": "worker",
"jobs": ["OCA\\WebhookListeners\\BackgroundJobs\\WebhookCall"],
},
"ContextChat": {
"type": "dedicated-cron"
"jobs": ["OCA\\ContextChat\\BackgroundJobs\\CrawlJob", "OCA\\ContextChat\\BackgroundJobs\\IndexerJob"],
}
}
}Services would be started only if the respective job classes are loadable in the main php process.
Describe alternatives you've considered
We could also leave out the dedicated cron feature, which would make the whole thing less powerful but still useful.
Additional context
Question for @szaimen:
We’d need it to start persistent workers and monitor scale-up/scale-down as config changes.
Is it feasible to leverage the existing SupervisorD in AIO instead of rolling our own PHP supervisor?
Yes, that should be possible 👍
Important for me is only that it is easy to configure for example by running one additional cron file for fast background jobs via supervivsord which automatically picks up all fast jobs from installed apps without me having to configure this for each app in AIO manually...
Metadata
Metadata
Assignees
Labels
Type
Projects
Status