Re-arrange services and fix paths
This commit is contained in:
+3
-1
@@ -63,7 +63,9 @@ You can also configure the runner with a configuration file.
|
||||
The configuration file is a YAML file, you can generate a sample configuration file with `./act_runner generate-config`.
|
||||
|
||||
```bash
|
||||
./act_runner generate-config > config.yaml
|
||||
mkdir -p 0750 /etc/gitea-act-runner/
|
||||
./act_runner generate-config > /etc/gitea-act-runner/config.yaml
|
||||
chmod 0640 /etc/gitea-act-runner/config.yaml
|
||||
```
|
||||
|
||||
You can specify the configuration file path with `-c`/`--config` argument.
|
||||
|
||||
@@ -7,7 +7,11 @@ to enable gitea actions in a non-root docker environment.
|
||||
|
||||
You have to start and register the docker instance with Gitea:
|
||||
|
||||
`sudo -u act-runner-rootless rootless-act_runner-register.sh`
|
||||
```bash
|
||||
systemctl -M act-runner-rootless@ --user enable --now dockerd-rootless-user
|
||||
sudo -u act-runner-rootless /usr/share/gitea-act-runner/rootless-act_runner-register.sh
|
||||
systemctl -M act-runner-rootless@ --user enable --now gitea-act-runner-rootless
|
||||
```
|
||||
|
||||
You will be asked to input:
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
d /home/docker-rootless 0700 docker-rootless docker-rootless -
|
||||
d /home/docker-rootless/act_runner 0700 docker-rootless docker-rootless -
|
||||
@@ -1,24 +0,0 @@
|
||||
[Unit]
|
||||
Description=Docker Application Container Engine (Rootless)
|
||||
Documentation=https://docs.docker.com/go/rootless/
|
||||
Requires=dbus.socket
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/dockerd-rootless.sh
|
||||
ExecReload=/bin/kill -s HUP \$MAINPID
|
||||
TimeoutSec=0
|
||||
RestartSec=2
|
||||
Restart=always
|
||||
StartLimitBurst=3
|
||||
StartLimitInterval=60s
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
TasksMax=infinity
|
||||
Delegate=yes
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
KillMode=mixed
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -1,2 +0,0 @@
|
||||
#Type Name ID GECOS Home directory Shell
|
||||
u act-runner-rootless - "Rootless act_runner docker user" /home/act-runner-rootless /sbin/nologin
|
||||
@@ -1,2 +0,0 @@
|
||||
d /home/act-runner-rootless 0700 act-runner-rootless act-runner-rootless -
|
||||
d /home/act-runner-rootless/act_runner 0700 act-runner-rootless act-runner-rootless -
|
||||
@@ -4,8 +4,8 @@ Documentation=https://gitea.com/gitea/act_runner
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Environment=XDG_RUNTIME_DIR=%h/.docker/run
|
||||
Environment=DOCKER_HOST=unix:///var/run/docker.sock
|
||||
Environment=XDG_RUNTIME_DIR=/run/user/%U
|
||||
Environment=DOCKER_HOST=unix:///run/user/%U/docker.sock
|
||||
ExecStart=/usr/bin/act_runner daemon -c %h/act_runner/config.yaml
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
WorkingDirectory=%h/act_runner
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#Type Name ID GECOS Home directory Shell
|
||||
u act-runner - "act_runner user" /home/act-runner /sbin/nologin
|
||||
@@ -1,2 +0,0 @@
|
||||
d /home/act-runner 0700 act-runner act-runner -
|
||||
d /home/act-runner/act_runner 0700 act-runner act-runner -
|
||||
@@ -4,8 +4,8 @@ Documentation=https://gitea.com/gitea/act_runner
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Environment=XDG_RUNTIME_DIR=%h/.docker/run
|
||||
Environment=DOCKER_HOST=unix:///var/run/docker.sock
|
||||
Environment=XDG_RUNTIME_DIR=/run/user/%U
|
||||
Environment=DOCKER_HOST=unix:///run/docker.sock
|
||||
ExecStart=/usr/bin/act_runner daemon -c /etc/gitea-act-runner/config.yaml
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
WorkingDirectory=%h/act_runner
|
||||
|
||||
+46
-38
@@ -1,12 +1,13 @@
|
||||
%global common_description %{expand:
|
||||
A runner for Gitea based on act.}
|
||||
|
||||
%global dockerd_package dockerd
|
||||
%global rootless rootless
|
||||
%global dockerd_package_rootless %{dockerd_package}-%{rootless}
|
||||
%global act_runner_bin act_runner
|
||||
%global runner_user act-runner
|
||||
%global runner_user_rootless %{runner_user}-%{rootless}
|
||||
%global dockerd dockerd
|
||||
%global rootless rootless
|
||||
%global dockerd_rootless %{dockerd}-%{rootless}
|
||||
%global dockerd_rootless_service %{dockerd}-%{rootless}-user.service
|
||||
%global act_runner_bin act_runner
|
||||
%global runner_user act-runner
|
||||
%global runner_user_rootless %{runner_user}-%{rootless}
|
||||
%global debug_package %{nil}
|
||||
|
||||
%global golicenses LICENSE
|
||||
@@ -15,17 +16,21 @@ A runner for Gitea based on act.}
|
||||
|
||||
Name: gitea-act-runner
|
||||
Version: 0.2.10
|
||||
Release: %autorelease -b 4
|
||||
Release: %autorelease -b 6
|
||||
Summary: A runner for Gitea based on act.
|
||||
|
||||
%global act_runner_service %{name}.service
|
||||
%global act_runner_rootless_service %{name}-%{rootless}.service
|
||||
|
||||
License: MIT
|
||||
URL: https://gitea.com/gitea/act_runner
|
||||
Source0: https://gitea.com/gitea/act_runner/archive/v%{version}.tar.gz
|
||||
Source1: %{name}.service
|
||||
Source2: %{name}-%{rootless}.service
|
||||
Source3: %{name}-%{dockerd_package_rootless}.service
|
||||
Source4: README-%{dockerd_package}.md
|
||||
Source5: README-%{rootless}-%{dockerd_package}.md
|
||||
Source1: %{act_runner_service}
|
||||
Source2: %{act_runner_rootless_service}
|
||||
Source3: %{dockerd_rootless_service}
|
||||
Source4: README-%{dockerd}.md
|
||||
Source5: README-%{rootless}-%{dockerd}.md
|
||||
Source6: rootless-act_runner-register.sh
|
||||
|
||||
BuildRequires: go >= 1.22
|
||||
BuildRequires: go-rpm-macros
|
||||
@@ -37,62 +42,62 @@ BuildRequires: git-core
|
||||
|
||||
|
||||
# act_runner with dockerd package
|
||||
%package %{dockerd_package}
|
||||
%package %{dockerd}
|
||||
Summary: Enable running gitea actions in docker containers
|
||||
Requires: %{name} docker-ce
|
||||
Conflicts: %{name}-%{dockerd_package_rootless}
|
||||
Conflicts: %{name}-%{dockerd_rootless}
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%{?sysusers_requires_compat}
|
||||
|
||||
%description %{dockerd_package}
|
||||
%description %{dockerd}
|
||||
%{common_description}
|
||||
Run gitea actions in docker containers
|
||||
|
||||
%pre %{dockerd_package}
|
||||
%pre %{dockerd}
|
||||
getent group '%{runner_user}' >/dev/null || groupadd -r '%{runner_user}' || :
|
||||
getent passwd '%{runner_user}' >/dev/null || \
|
||||
useradd -r -m -F -g '%{runner_user}' -d '/home/%{runner_user}' -s '/sbin/nologin' -c 'act_runner user' '%{runner_user}' || :
|
||||
|
||||
%post %{dockerd_package}
|
||||
%systemd_post %{name}.service
|
||||
%post %{dockerd}
|
||||
%systemd_post %{act_runner_service}
|
||||
|
||||
%preun %{dockerd_package}
|
||||
%systemd_preun %{name}.service
|
||||
%preun %{dockerd}
|
||||
%systemd_preun %{act_runner_service}
|
||||
userdel -rZf %{runner_user}
|
||||
|
||||
%postun %{dockerd_package}
|
||||
%postun %{dockerd}
|
||||
userdel -rZf %{runner_user}
|
||||
|
||||
|
||||
# act_runner with rootless dockerd package
|
||||
%package %{dockerd_package_rootless}
|
||||
%package %{dockerd_rootless}
|
||||
Summary: Enable running gitea actions in non-root docker containers
|
||||
|
||||
Requires: %{name} docker-ce slirp4netns fuse-overlayfs iptables docker-ce-rootless-extras shadow-utils
|
||||
Conflicts: %{name}-%{dockerd_package}
|
||||
Conflicts: %{name}-%{dockerd}
|
||||
BuildRequires: systemd-rpm-macros
|
||||
|
||||
%description %{dockerd_package_rootless}
|
||||
%description %{dockerd_rootless}
|
||||
%{common_description}
|
||||
Run gitea actions in non-root docker containers
|
||||
|
||||
%pre %{dockerd_package_rootless}
|
||||
%pre %{dockerd_rootless}
|
||||
if [ $1 -eq 1 ]; then
|
||||
getent group '%{runner_user_rootless}' >/dev/null || groupadd -r '%{runner_user_rootless}' || :
|
||||
getent passwd '%{runner_user_rootless}' >/dev/null || \
|
||||
useradd -r -m -F -g '%{runner_user_rootless}' -d '/home/%{runner_user_rootless}' -s '/sbin/nologin' -c 'Rootless act_runner docker user' '%{runner_user_rootless}' || :
|
||||
fi
|
||||
|
||||
%post %{dockerd_package_rootless}
|
||||
%systemd_user_post %{name}.service %{name}-%{dockerd_package_rootless}.service
|
||||
%post %{dockerd_rootless}
|
||||
%systemd_user_post %{act_runner_rootless_service} %{dockerd_rootless_service}
|
||||
loginctl enable-linger %{runner_user_rootless}
|
||||
echo Please read README.rootless-docker.md to finish the installation
|
||||
echo Please read README.%{rootless}-%{dockerd}.md to finish the installation
|
||||
|
||||
%preun %{dockerd_package_rootless}
|
||||
%preun %{dockerd_rootless}
|
||||
loginctl disable-linger %{runner_user_rootless}
|
||||
%systemd_user_preun %{dockerd_package_rootless}.service %{name}.service
|
||||
%systemd_user_preun %{dockerd_rootless_service} %{act_runner_rootless_service}
|
||||
|
||||
%postun %{dockerd_package_rootless}
|
||||
%postun %{dockerd_rootless}
|
||||
if [ $1 -eq 0 ]; then
|
||||
userdel -rZf %{runner_user_rootless}
|
||||
fi
|
||||
@@ -109,31 +114,34 @@ install -m 0755 -vd %{buildroot}%{_bindir}
|
||||
install -m 0755 -vd %{buildroot}%{_unitdir}
|
||||
install -m 0755 -vd %{buildroot}%{_userunitdir}
|
||||
install -m 0755 -vd %{buildroot}%{_docdir}/%{name}
|
||||
install -m 0755 -vd %{buildroot}%{_datadir}/%{name}
|
||||
|
||||
# The binary
|
||||
install -m 0755 -vp bin/* %{buildroot}%{_bindir}
|
||||
|
||||
# dockerd
|
||||
install -D -m 0644 -vp %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
|
||||
install -D -m 0644 -vp %{SOURCE1} %{buildroot}%{_unitdir}/%{act_runner_service}
|
||||
|
||||
# Rootless dockerd
|
||||
install -D -m 0644 -vp %{SOURCE2} %{buildroot}%{_userunitdir}/%{name}.service
|
||||
install -D -m 0644 -vp %{SOURCE3} %{buildroot}%{_userunitdir}/%{name}-%{dockerd_package_rootless}.service
|
||||
install -D -m 0644 -vp %{SOURCE2} %{buildroot}%{_userunitdir}/%{act_runner_rootless_service}
|
||||
install -D -m 0644 -vp %{SOURCE3} %{buildroot}%{_userunitdir}/%{dockerd_rootless_service}
|
||||
install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/rootless-act_runner-register.sh
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
%{_bindir}/*
|
||||
|
||||
%files %{dockerd_package}
|
||||
%files %{dockerd}
|
||||
%license LICENSE
|
||||
%doc README-%{dockerd_package}.md
|
||||
%doc README-%{dockerd}.md
|
||||
%{_unitdir}/*
|
||||
|
||||
%files %{dockerd_package_rootless}
|
||||
%files %{dockerd_rootless}
|
||||
%license LICENSE
|
||||
%doc README-%{rootless}-%{dockerd_package}.md
|
||||
%doc README-%{rootless}-%{dockerd}.md
|
||||
%{_userunitdir}/*
|
||||
%{_datadir}/*
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p -m 0750 ~/act_runner
|
||||
cd ~/act_runner
|
||||
act_runner register
|
||||
act_runner generate-config > config.yaml
|
||||
act_runner generate-config > /home/act-runner-rootless/act_runner/config.yaml
|
||||
chmod 0640 /home/act-runner-rootless/act_runner/config.yaml
|
||||
|
||||
Reference in New Issue
Block a user