From 2bf9ef29acbcb932e2fef07197b8855815cf1d7a Mon Sep 17 00:00:00 2001 From: Matthew Pomes Date: Wed, 24 Sep 2025 23:03:40 -0500 Subject: [PATCH] Add systemd units to run actions and homelab --- act_runner.service | 16 ++++++++++++++++ homelab.service | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 act_runner.service create mode 100644 homelab.service diff --git a/act_runner.service b/act_runner.service new file mode 100644 index 0000000..b963493 --- /dev/null +++ b/act_runner.service @@ -0,0 +1,16 @@ +[Unit] +Description=Gitea Actions runner +Documentation=https://gitea.com/gitea/act_runner +After=docker.service + +[Service] +ExecStart=/usr/bin/act_runner daemon --config /home/matthew/homelab/host-runner.yaml +ExecReload=/bin/kill -s HUP $MAINPID +WorkingDirectory=/home/matthew/act_runner +TimeoutSec=0 +RestartSec=10 +Restart=always +User=matthew + +[Install] +WantedBy=multi-user.target diff --git a/homelab.service b/homelab.service new file mode 100644 index 0000000..8152945 --- /dev/null +++ b/homelab.service @@ -0,0 +1,20 @@ +[Unit] +Description=Homelab services +Requires=docker.service +After=docker.service + +[Service] +Restart=always +User=root +Group=docker +TimeoutStopSec=15 +WorkingDirectory=/home/matthew/homelab +# Shutdown container (if running) when unit is started +ExecStartPre=/usr/bin/docker compose -f docker-compose.yaml down +# Start container when unit is started +ExecStart=/usr/bin/docker compose -f docker-compose.yaml up +# Stop container when unit is stopped +ExecStop=/usr/bin/docker compose -f docker-compose.yaml down + +[Install] +WantedBy=multi-user.target