Files
act_runner/examples/systemd/README.md
silverwind 1d6c6ffef9 enhance: improve config, comment out values in example file (#1145)
`config.example.yaml` now has every value commented out, as gitea's `app.example.ini` does, so it documents each option with its default instead of imposing it. Copying it no longer pins values the runner would otherwise pick, and a changed default reaches configs that never named the option.

`config init` writes the file to configure: a header comment and no option, so every option keeps its default. It refuses to overwrite an existing config without `--force`, and writes `config.yaml` in the working directory when `-c` is absent.

`config set`, `add` and `remove` keep such a file readable. Comments go back to the indentation they were written at, which the encoder drops for a comment block that has no key below it, and a file of only comments keeps its text instead of being emptied by the first edit.

Also rewrote the config docs sections for clarity.

Reviewed-on: https://gitea.com/gitea/runner/pulls/1145
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-08-06 05:15:32 +00:00

1.2 KiB

Running the runner as a systemd service

gitea-runner.service is an example unit for running the runner as a background service on a systemd host.

Setup

  1. Install the gitea-runner binary (e.g. to /usr/local/bin/gitea-runner).

  2. Create a dedicated user and working directory:

    sudo useradd --system --home-dir /var/lib/gitea-runner --create-home gitea-runner
    
  3. Write a config, hand it to the service user, and register as that user so the .runner file ends up in the working directory:

    sudo mkdir -p /etc/gitea-runner
    sudo gitea-runner config init --config /etc/gitea-runner/config.yaml
    sudo chown gitea-runner /etc/gitea-runner/config.yaml
    cd /var/lib/gitea-runner
    sudo -u gitea-runner gitea-runner register --config /etc/gitea-runner/config.yaml
    
  4. Install and enable the unit:

    sudo cp gitea-runner.service /etc/systemd/system/gitea-runner.service
    sudo systemctl daemon-reload
    sudo systemctl enable --now gitea-runner
    

Adjust the binary path, config path, working directory and user to match your installation. If jobs use the host's Docker daemon, uncomment the docker.service dependencies in the unit.