Add gitea runner.
This commit is contained in:
@@ -3,5 +3,5 @@ sudo apt-get install -y uidmap
|
|||||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||||
sudo sh get-docker.sh
|
sudo sh get-docker.sh
|
||||||
# Don't install rootless because compose has certain things like setting ulimits which only rooted docker can do.
|
# Don't install rootless because compose has certain things like setting ulimits which only rooted docker can do.
|
||||||
# dockerd-rootless-setuptool.sh install
|
|
||||||
# sudo loginctl enable-linger ubuntu
|
# sudo loginctl enable-linger ubuntu
|
||||||
|
# dockerd-rootless-setuptool.sh install
|
||||||
|
|||||||
74
gitea/runner.sh
Normal file
74
gitea/runner.sh
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
ACT_VERSION="0.3.1"
|
||||||
|
INSTANCE_URL="http://127.0.0.1:3000"
|
||||||
|
REGISTRATION_TOKEN="xxxxxxxx"
|
||||||
|
RUNNER_NAME=$(hostname)
|
||||||
|
RUNNER_LABELS=""
|
||||||
|
RUNNER_DIR="/var/lib/act_runner"
|
||||||
|
CONFIG_PATH="/etc/act_runner"
|
||||||
|
SERVICE_FILE="/etc/systemd/system/act_runner.service"
|
||||||
|
RUNNER_USER=act_runner
|
||||||
|
|
||||||
|
# Clean UP
|
||||||
|
# loginctl disable-linger $RUNNER_USER
|
||||||
|
# loginctl terminate-user $RUNNER_USER
|
||||||
|
# loginctl kill-user $RUNNER_USER
|
||||||
|
# userdel --remove $RUNNER_USER
|
||||||
|
|
||||||
|
|
||||||
|
apt remove -y $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)
|
||||||
|
apt-get install -y uidmap systemd-container
|
||||||
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||||
|
sh get-docker.sh
|
||||||
|
systemctl disable --now docker.service docker.socket
|
||||||
|
|
||||||
|
wget https://dl.gitea.com/act_runner/${ACT_VERSION}/act_runner-${ACT_VERSION}-linux-amd64
|
||||||
|
|
||||||
|
cp act_runner-${ACT_VERSION}-linux-amd64 /usr/local/bin/act_runner
|
||||||
|
rm act_runner-${ACT_VERSION}-linux-amd64
|
||||||
|
|
||||||
|
useradd --create-home -s /bin/bash act_runner
|
||||||
|
|
||||||
|
RUNNER_UID=$(id -u act_runner)
|
||||||
|
|
||||||
|
chmod +x /usr/local/bin/act_runner
|
||||||
|
cd ${RUNNER_DIR}
|
||||||
|
mkdir -p ${CONFIG_PATH}
|
||||||
|
mkdir -p ${RUNNER_DIR}
|
||||||
|
|
||||||
|
act_runner generate-config > ${CONFIG_PATH}/config.yaml
|
||||||
|
|
||||||
|
act_runner register --config ${CONFIG_PATH}/config.yaml --no-interactive --instance ${INSTANCE_URL} --token ${REGISTRATION_TOKEN} --name ${RUNNER_NAME}
|
||||||
|
|
||||||
|
|
||||||
|
cat > "${SERVICE_FILE}" <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=Gitea Actions runner
|
||||||
|
Documentation=https://gitea.com/gitea/act_runner
|
||||||
|
After=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=XDG_RUNTIME_DIR=/home/act_runner/.docker/run
|
||||||
|
Environment=DOCKER_HOST=unix:///run/user/${RUNNER_UID}/docker.sock
|
||||||
|
ExecStart=/usr/local/bin/act_runner daemon --config ${CONFIG_PATH}/config.yaml
|
||||||
|
ExecReload=/bin/kill -s HUP \$MAINPID
|
||||||
|
WorkingDirectory=${RUNNER_DIR}
|
||||||
|
TimeoutSec=0
|
||||||
|
RestartSec=10
|
||||||
|
Restart=always
|
||||||
|
User=${RUNNER_USER}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chown -R ${RUNNER_USER}:${RUNNER_USER} ${CONFIG_PATH}
|
||||||
|
chown -R ${RUNNER_USER}:${RUNNER_USER} ${RUNNER_DIR}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
loginctl enable-linger $RUNNER_USER
|
||||||
|
machinectl shell $RUNNER_USER@
|
||||||
|
dockerd-rootless-setuptool.sh install
|
||||||
|
exit
|
||||||
|
|
||||||
|
systemctl enable act_runner --now
|
||||||
Reference in New Issue
Block a user