docs(admin): add Docker/AIO systemd example for the AI worker#15166
docs(admin): add Docker/AIO systemd example for the AI worker#15166sanzakicesarr wants to merge 3 commits into
Conversation
The "Systemd service" section only documented running the AI worker on bare metal. When Nextcloud runs inside a Docker container (for example Nextcloud AIO) the service has to wait for Docker and invoke occ inside the container via docker exec. Document extending the [Unit] section with a dependency on docker.service and a taskprocessing.sh that uses "docker exec -i" without -t, since systemd provides no pseudo-TTY. The command mirrors the existing AIO docker exec example in the screen/tmux section and uses the current taskprocessing:worker command. Signed-off-by: Cesar <275373127+sanzakicesarr@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a12832ec7b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| After=network.target docker.service | ||
| Requires=docker.service |
There was a problem hiding this comment.
Wait for the Nextcloud container before starting workers
In this boot-enabled service path, After=/Requires=docker.service only orders on the Docker daemon; it does not wait for nextcloud-aio-nextcloud to be running, while Docker documents that docker exec runs a command in a running container. If AIO is still stopped or starting after Docker becomes active, for example after a host reboot or container update, line 436 exits immediately; with the unit above using Restart=always plus StartLimitBurst=10/StartLimitInterval=60 and systemd restarts being subject to start-rate limiting, the worker can hit the limit and remain down until manually reset. Please wait for the container or its health check, or add a restart delay, before enabling this variant.
Useful? React with 👍 / 👎.
The Docker/AIO worker variant only ordered the unit on docker.service, which gates on the Docker daemon, not on the nextcloud-aio-nextcloud container. After a host reboot or a container update, docker exec could fire before the container was back, exit non-zero, and with Restart=always trip systemd's start-rate limit, leaving the worker down until a manual reset. Make taskprocessing.sh wait until the container reports healthy (the AIO image ships a healthcheck for php-fpm and the database) before running occ, bounded to five minutes so a genuinely missing container still surfaces as a failure instead of hanging forever. Signed-off-by: Cesar <275373127+sanzakicesarr@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cdd0997706
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #!/bin/sh | ||
| echo "Starting Nextcloud AI Worker $1" | ||
| i=0 | ||
| until [ "$(docker inspect -f '{{.State.Health.Status}}' nextcloud-aio-nextcloud 2>/dev/null)" = healthy ]; do |
There was a problem hiding this comment.
Handle Docker containers without health checks
Because this section is introduced for any Nextcloud Docker container, not just AIO, this wait loop makes the documented systemd unit unusable for the official/community nextcloud images unless the admin adds their own HEALTHCHECK. Docker's HEALTHCHECK docs describe health status as coming from that instruction, and the current official nextcloud Dockerfile has no HEALTHCHECK, so docker inspect -f '{{.State.Health.Status}}' ... produces no healthy value with stderr suppressed; the loop times out after five minutes and occ is never started even though the container is running. Either scope this snippet to AIO only or fall back to .State.Running when .State.Health is absent.
Useful? React with 👍 / 👎.
|
Good catch. Requires/After=docker.service only gate on the Docker daemon, not on the I reworked the worker script to wait for the container to report healthy before running occ. The |
The Systemd service section of the AI overview only documented running the task-processing worker on bare
metal. When Nextcloud runs inside a Docker container (for example Nextcloud AIO) the service has to (a) wait for
Docker and (b) call
occinside the container viadocker exec. This adds that variant right after the existingsystemd example:
[Unit]section withAfter=network.target docker.serviceandRequires=docker.service, so theworker only starts once Docker is up;
taskprocessing.shthat runsdocker exec -i nextcloud-aio-nextcloud sudo -E -u www-data php occ taskprocessing:worker -v -t 60.Using
docker exec -iwithout-tis deliberate: systemd provides no pseudo-TTY, so-twould fail withthe input device is not a TTY.Notes for review:
docker execexample already in the Screen or tmux session section(same container name, user and command) and uses the current
taskprocessing:workercommand — the pagedocuments (
.. versionchanged:: 32.0.7) that this replacedbackground-job:worker... note::.ini/bashlanguage tags per the style guide ("always specify thelanguage"); the surrounding pre-existing blocks are left untouched to keep the change focused.
✅ Resolves
🖼️ Screenshots
Rendered Systemd service section, new Docker/AIO variant at the bottom:

✅ Checklist
codespellor similar and addressed any spelling issues