From 8b8500091add602d023e9267a1858fc7b74035bf Mon Sep 17 00:00:00 2001 From: Oscar Ward Date: Sun, 14 Jul 2024 06:19:53 +0000 Subject: [PATCH] Document launchd process for act runners (#28) (#30) Reviewed-on: https://gitea.com/gitea/docs/pulls/30 Reviewed-by: techknowlogick Co-authored-by: Oscar Ward Co-committed-by: Oscar Ward --- docs/usage/actions/act-runner.md | 51 +++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/docs/usage/actions/act-runner.md b/docs/usage/actions/act-runner.md index 89090e10..7ed042f8 100644 --- a/docs/usage/actions/act-runner.md +++ b/docs/usage/actions/act-runner.md @@ -261,7 +261,9 @@ The runner will fetch jobs from the Gitea instance and run them automatically. Since act runner is still in development, it is recommended to check the latest version and upgrade it regularly. -## Systemd service +## Daemon Services + +### Systemd It is also possible to run act-runner as a [systemd](https://en.wikipedia.org/wiki/Systemd) service. Create an unprivileged `act_runner` user on your system, and the following file in `/etc/systemd/system/act_runner.service`. The paths in `ExecStart` and `WorkingDirectory` may need to be adjusted depending on where you installed the `act_runner` binary, its configuration file, and the home directory of the `act_runner` user. @@ -294,3 +296,50 @@ sudo systemctl enable act_runner --now ``` If using Docker, the `act_runner` user should also be added to the `docker` group before starting the service. Keep in mind that this effectively gives `act_runner` root access to the system [[1]](https://docs.docker.com/engine/security/#docker-daemon-attack-surface). + +### LaunchDaemon + +Mac uses `launchd` in place of systemd for registering daemon processes. By default daemons run as the root user, so if desired an unprivileged `_act_runner` user can be created via the `dscl` tool. The following file should then be created at the directory `/Library/LaunchDaemon/com.gitea.act_runner.plist`. The paths for `WorkingDirectory`, `ProgramArguments`, `StandardOutPath`, `StandardErrPath`, and the `HOME` environment variable may need to be updated to reflect your installation. Also note that any executables outside of the example `PATH` shown will need to be explicitly included and will not be inherited from existing configurations. + +```xml + + + + + Label + com.gitea.act_runner + ProgramArguments + + /usr/local/bin/act_runner + daemon + --config + /etc/act_runner/config.yaml + + RunAtLoad + + KeepAlive + + WorkingDirectory + /var/lib/act_runner + StandardOutPath + /var/lib/act_runner/act_runner.log + StandardErrorPath + /var/lib/act_runner/act_runner.err + EnvironmentVariables + + PATH + /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin + HOME> + /var/lib/act_runner + + UserName + _act_runner + + +``` + +Then: + +```bash +sudo launchctl load /Library/LaunchDaemon/com.gitea.act_runner.plist +```