documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Suggestion: Add systemd example for AI worker using Docker (docker exec) to documentation

Open Marcus1Pierce opened this issue 8 months ago β€’ 0 comments

Thanks for helping improve our documentation!

  • There is always room for improvement!
  • All contributions (changes and change ideas) - from the largest to the tiniest - help make Nextcloud better and easier to use!

I recently set up the AI worker as described in the AI Overview Documentation and it worked great. However, I noticed the systemd service example provided assumes the worker is run via a local script or PHP command.

For those of us using Nextcloud AIO or running Nextcloud inside a Docker container, it would be really helpful to include a systemd example that uses docker exec to run the AI worker inside the container.

Here is a working setup that might be useful for the docs:

[email protected]

[Unit]
Description=Nextcloud AI worker %i
After=network.target docker.service # Waits for Docker service to be up and running
Requires=docker.service # Ensures Docker service must be active before this service starts

[Service]
ExecStart=/mnt/data/docker/nextcloud/taskprocessing.sh %i
Restart=always
StartLimitInterval=60
StartLimitBurst=10

[Install]
WantedBy=multi-user.target

taskprocessing.sh

#!/bin/bash
echo "Starting Nextcloud AI Worker $1"
docker exec -u www-data -i nextcloud-aio-nextcloud php occ background-job:worker -t 60 "OC\\TaskProcessing\\SynchronousBackgroundJob"

Note: It’s important to use -i without -t in docker exec to avoid the "input device is not a TTY" error when running under systemd. Or maybe there's something that can still be improved in the script or command above?


Notes

  • Please be patient: this is a large open source project that is overseen by a mixture of volunteers and non-volunteers which are all ultimately busy.
  • If your suggestion is a troubleshooting scenario or one you're not 100% certain about, please post for feedback on the Nextcloud Help Forum first.
    • Then return here to bring back your experience to help improve the documentation for clarity, etc. (and link back to the forum discussion in your report!)

Protip: If you want to help move things along (or just help out in other ways too) here are some suggestions:

  • Look for areas where you can assist - even seemingly unrelated areas - because doing so frees up resources for your favorite topics and ideas.
  • Submit a proposed change - that attempts to addresses your issue - as a pull request.
  • Participate in a discussion on some other unresolved submitted idea ("issues") to help move it along.
  • Post a comment or review on someone else's proposed change ("pull request") to help move it along.

Marcus1Pierce avatar Apr 25 '25 03:04 Marcus1Pierce