From 4a44efb0a82cb5248d22968b3b562b46abf8cf43 Mon Sep 17 00:00:00 2001 From: Alex Frantz Date: Tue, 29 Jul 2025 21:26:57 -0400 Subject: [PATCH] fix service not starting properly --- roles/gitea-runner/tasks/main.yml | 14 +++++++++++--- .../gitea-runner/templates/act_runner.service.j2 | 4 ++-- roles/gitea-runner/templates/config.yml.j2 | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 roles/gitea-runner/templates/config.yml.j2 diff --git a/roles/gitea-runner/tasks/main.yml b/roles/gitea-runner/tasks/main.yml index 5944234..2c55d87 100644 --- a/roles/gitea-runner/tasks/main.yml +++ b/roles/gitea-runner/tasks/main.yml @@ -19,22 +19,30 @@ mode: 0755 when: not act_runner.stat.exists +- name: Copy Gitea Act Runner Config + template: + src: config.yml.j2 + dest: "{{ data_dir }}/gitea/config.yml" + - name: Check if Act Runner is a Systemd Service stat: path: "/etc/systemd/system/act_runner.service" register: act_runner_service +- name: Stop & remove systemd service + become: yes + shell: | + systemctl stop act_runner.service && + rm /etc/systemd/system/act_runner.service - name: Create Systemd Service become: yes template: src: act_runner.service.j2 dest: "/etc/systemd/system/act_runner.service" - when: not act_runner_service.stat.exists + - name: Enable Systemd Service become: yes command: systemctl enable act_runner.service - when: not act_runner_service.stat.exists - name: Start Systemd Service become: yes command: systemctl start act_runner.service - when: not act_runner_service.stat.exists diff --git a/roles/gitea-runner/templates/act_runner.service.j2 b/roles/gitea-runner/templates/act_runner.service.j2 index f12244c..279b7cd 100644 --- a/roles/gitea-runner/templates/act_runner.service.j2 +++ b/roles/gitea-runner/templates/act_runner.service.j2 @@ -4,13 +4,13 @@ Documentation=https://gitea.com/gitea/act_runner After=docker.service [Service] -ExecStart={{ data_dir }}/gitea/act_runner daemon --instance {{ GITEA_INSTANCE_URL }} --token {{ GITEA_RUNNER_REGISTRATION_TOKEN }} --name {{ GITEA_RUNNER_NAME }} --labels {{ GITEA_RUNNER_LABELS }} +ExecStart={{ data_dir }}/gitea/act_runner daemon --config={{ data_dir }}/gitea/config.yml ExecReload=/bin/kill -s HUP $MAINPID WorkingDirectory={{ data_dir }}/gitea TimeoutSec=0 RestartSec=10 Restart=always -User=act_runner +User=alex [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/roles/gitea-runner/templates/config.yml.j2 b/roles/gitea-runner/templates/config.yml.j2 new file mode 100644 index 0000000..d6fda68 --- /dev/null +++ b/roles/gitea-runner/templates/config.yml.j2 @@ -0,0 +1,16 @@ +log: + level: info + +runner: + file: .runner + capacity: 1 + timeout: 3h + shutdown_timeout: 0s + insecure: false + fetch_timeout: 5s + fetch_interval: 2s + labels: + - "runner:host" + +host: + workdir_parent: "{{ data_dir }}/gitea/job"