feat: run the cicd act runner as a systemd service

This commit is contained in:
Benjamin Labrecque
2026-07-17 15:52:28 +02:00
parent 2a9e546ac7
commit 117d6f2405
2 changed files with 86 additions and 4 deletions
-3
View File
@@ -1,8 +1,5 @@
# Ansible
\# TODO: Create venv and install ansible? That way not dependent on ansible
being installed on machine.
## Running a playbook manually
Set vars on command line:
+86 -1
View File
@@ -8,6 +8,13 @@ sls-vserv-bd-01-dev
## Setup
Resources:
- https://docs.gitea.com/usage/actions/act-runner
- https://linux.psi.ch/documentation/services/gitea/gitea-runner/
TODO: add commands we ran with Basil in the meeting
```shell
<install command>
sudo su svcusr-sls2hla
@@ -22,13 +29,91 @@ tar -xf node-v20.11.1-linux-x64.tar.xz --strip-components=2 -C ~/.local/bin/ nod
rm node-v20.11.1-linux-x64.tar.xz
```
## Launch the runner
## Manually run the runner
```shell
sudo su svcusr-sls2hla
/usr/local/bin/act_runner daemon
```
## Run the runner as a systemd service
Edit the service file `/etc/systemd/system/act_runner.service`:
```toml
[Unit]
ConditionPathExists=/etc/act_runner/config.yaml
Description=Gitea Actions runner
Documentation=https://gitea.com/gitea/act_runner
After=podman.socket
Requires=podman.socket
[Service]
User=svcusr-sls2hla
WorkingDirectory=/home/svcusr-sls2hla/gitea-runner
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yaml
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
```
As your own user (not `svcusr-sls2hla`; need access to sudo):
```
# 1. Install Podman
sudo dnf install -y podman
# 2. Enable and start the system-wide Podman socket
sudo systemctl enable --now podman.socket
# 3. Create the symlink so the Gitea runner finds Podman at the expected Docker path
sudo ln -s /run/podman/podman.sock /var/run/docker.sock
# 4. Create podman group
sudo groupadd podman
# 5. Add service user to this new group
sudo usermod -aG podman svcusr-sls2hla
```
Configure podman socket:
```
sudo systemctl edit podman.socket
```
add this to the file:
```
[Socket]
SocketMode=0660
SocketGroup=podman
```
Enable and restart:
```
# Enable act_runner
sudo systemctl enable --now act_runner
# Reload configurations
sudo systemctl daemon-reload
# Restart the socket so it applies the new group owner
sudo systemctl restart podman.socket
# Fire up the runner
sudo systemctl restart act_runner.service
```
### Check logs of systemd service
```
sudo su svcusr-sls2hla
journalctl -u act_runner.service -n 20
```
## User
The gitea actions run as user `svcusr-sls2hla`