diff --git a/docker-install.sh b/docker-install.sh index 278ce0f..765e091 100644 --- a/docker-install.sh +++ b/docker-install.sh @@ -3,5 +3,5 @@ sudo apt-get install -y uidmap curl -fsSL https://get.docker.com -o 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. -# dockerd-rootless-setuptool.sh install # sudo loginctl enable-linger ubuntu +# dockerd-rootless-setuptool.sh install diff --git a/gitea/runner.sh b/gitea/runner.sh new file mode 100644 index 0000000..b427469 --- /dev/null +++ b/gitea/runner.sh @@ -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}" <