Simplify and fix dockerd parts
This commit is contained in:
+9
-7
@@ -14,7 +14,7 @@ ENABLED=true
|
||||
### Register
|
||||
|
||||
```bash
|
||||
./act_runner register
|
||||
/usr/share/gitea-act-runner/act_runner-register.sh
|
||||
```
|
||||
|
||||
And you will be asked to input:
|
||||
@@ -43,10 +43,11 @@ DEBU Successfully pinged the Gitea instance server
|
||||
INFO Runner registered successfully.
|
||||
```
|
||||
|
||||
You can also register with command line arguments.
|
||||
You can also register manually with command line arguments.
|
||||
|
||||
```bash
|
||||
./act_runner register --instance http://192.168.8.8:3000 --token <my_runner_token> --no-interactive
|
||||
cd ~act-runner
|
||||
sudo -u act-runner -H act_runner register --instance http://192.168.8.8:3000 --token <my_runner_token> --no-interactive
|
||||
```
|
||||
|
||||
If the registry succeed, it will run immediately. Next time, you could run the runner directly.
|
||||
@@ -54,24 +55,25 @@ If the registry succeed, it will run immediately. Next time, you could run the r
|
||||
### Run
|
||||
|
||||
```bash
|
||||
./act_runner daemon
|
||||
act_runner daemon
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
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`.
|
||||
The systemd service file expects the file to be in the /etc/gitea-act-runner
|
||||
|
||||
```bash
|
||||
./act_runner generate-config > /etc/gitea-act-runner/config.yaml
|
||||
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.
|
||||
|
||||
```bash
|
||||
./act_runner -c /etc/gitea-act-runner/config.yaml register # register with config file
|
||||
./act_runner -c /etc/gitea-act-runner/config.yaml daemon # run with config file
|
||||
act_runner -c /etc/gitea-act-runner/config.yaml register # register with config file
|
||||
act_runner -c /etc/gitea-act-runner/config.yaml daemon # run with config file
|
||||
```
|
||||
|
||||
You can read the latest version of the configuration file online at [config.example.yaml](internal/pkg/config/config.example.yaml).
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ~act-runner
|
||||
sudo -u act-runner -H act_runner register -c $(rpm --eval '%{_sysconfdir}')/gitea-act-runner/config.yaml
|
||||
@@ -15,7 +15,7 @@ TimeoutStopSec=120
|
||||
RestartSec=2
|
||||
Restart=always
|
||||
StartLimitBurst=3
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitInterval=60s
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
d /var/lib/act-runner 0700 act-runner act-runner -
|
||||
d /var/lib/act-runner/act_runner 0700 act-runner act-runner -
|
||||
|
||||
@@ -4,26 +4,17 @@ Documentation=https://gitea.com/gitea/act_runner
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
# Environment=XDG_RUNTIME_DIR=/run/user/%U
|
||||
# Environment=DOCKER_HOST=unix:///run/docker.sock
|
||||
User=act-runner
|
||||
ExecStart=/usr/bin/act_runner daemon -c /etc/gitea-act-runner/config.yaml
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
WorkingDirectory=%h/act_runner
|
||||
WorkingDirectory=~
|
||||
Type=exec
|
||||
TimeoutStartSec=5
|
||||
TimeoutStopSec=120
|
||||
RestartSec=2
|
||||
Restart=always
|
||||
StartLimitBurst=3
|
||||
StartLimitIntervalSec=60
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
TasksMax=infinity
|
||||
Delegate=yes
|
||||
NotifyAccess=all
|
||||
KillMode=mixed
|
||||
StartLimitInterval=60s
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
+12
-6
@@ -16,7 +16,7 @@ A runner for Gitea based on act.}
|
||||
|
||||
Name: gitea-act-runner
|
||||
Version: 0.2.11
|
||||
Release: %autorelease
|
||||
Release: %autorelease -b 3
|
||||
Summary: A runner for Gitea based on act.
|
||||
|
||||
%global act_runner_service %{name}.service
|
||||
@@ -33,6 +33,8 @@ Source5: README-%{rootless}-%{dockerd}.md
|
||||
Source6: rootless-act_runner-register.sh
|
||||
Source7: %{name}-sysusers.conf
|
||||
Source8: %{name}-tmpfiles.conf
|
||||
Source9: act_runner-register.sh
|
||||
|
||||
BuildRequires: go >= 1.23
|
||||
BuildRequires: go-rpm-macros
|
||||
BuildRequires: git-core
|
||||
@@ -60,15 +62,16 @@ Run gitea actions in docker containers
|
||||
|
||||
%post %{dockerd}
|
||||
%systemd_post %{act_runner_service}
|
||||
if [ $1 -eq 1 ] || [ ! -d %{_sharedstatedir}/%{runner_user}/act_runner ]; then
|
||||
echo ' INFO Please read README-%{dockerd}.md to finish the installation'
|
||||
fi
|
||||
|
||||
%preun %{dockerd}
|
||||
%systemd_preun %{act_runner_service}
|
||||
|
||||
%postun %{dockerd}
|
||||
%systemd_postun %{act_runner_service}
|
||||
if [ $1 -eq 0 ]; then
|
||||
userdel -rf %{runner_user}
|
||||
fi
|
||||
|
||||
# #############################################################
|
||||
|
||||
|
||||
@@ -96,7 +99,7 @@ fi
|
||||
%post %{dockerd_rootless}
|
||||
%systemd_user_post %{act_runner_rootless_service} %{dockerd_rootless_service}
|
||||
if [ $1 -eq 1 ] || [ ! -d /home/%{runner_user_rootless}/act_runner ]; then
|
||||
echo ' INFO Please read README.%{rootless}-%{dockerd}.md to finish the installation'
|
||||
echo ' INFO Please read README-%{rootless}-%{dockerd}.md to finish the installation'
|
||||
fi
|
||||
loginctl enable-linger %{runner_user_rootless}
|
||||
|
||||
@@ -134,6 +137,7 @@ install -D -m 0644 -vp %{SOURCE1} %{buildroot}%{_unitdir}/%{act_runner_service}
|
||||
install -D %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
install -D %{SOURCE8} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
||||
bin/act_runner generate-config > %{buildroot}%{_sysconfdir}/%{name}/config.yaml
|
||||
install -D -m 0755 -vp %{SOURCE9} %{buildroot}%{_datadir}/%{name}/act_runner-register.sh
|
||||
|
||||
# dockerd-rootless
|
||||
install -m 0755 -vd %{buildroot}%{_userunitdir}
|
||||
@@ -146,6 +150,7 @@ install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/rootless-act_r
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
%{_bindir}/*
|
||||
%dir %{_datadir}/%{name}
|
||||
|
||||
%files %{dockerd}
|
||||
%license LICENSE
|
||||
@@ -155,12 +160,13 @@ install -D -m 0755 -vp %{SOURCE6} %{buildroot}%{_datadir}/%{name}/rootless-act_r
|
||||
%{_unitdir}/*
|
||||
%{_sysusersdir}/%{name}.conf
|
||||
%{_tmpfilesdir}/%{name}.conf
|
||||
%{_datadir}/%{name}/act_runner-register.sh
|
||||
|
||||
%files %{dockerd_rootless}
|
||||
%license LICENSE
|
||||
%doc README-%{rootless}-%{dockerd}.md
|
||||
%{_userunitdir}/*
|
||||
%{_datadir}/*
|
||||
%{_datadir}/%{name}/rootless-act_runner-register.sh
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
mkdir -p -m 0750 ~/act_runner
|
||||
cd ~/act_runner
|
||||
act_runner register
|
||||
act_runner generate-config > /home/act-runner-rootless/act_runner/config.yaml
|
||||
chmod 0640 /home/act-runner-rootless/act_runner/config.yaml
|
||||
act_runner generate-config > config.yaml
|
||||
chmod 0640 config.yaml
|
||||
|
||||
Reference in New Issue
Block a user