Skip to content

Restore Github Runner VM

benoit74 edited this page Oct 28, 2024 · 4 revisions

Order VM / Machine at provider

Nothing special

Setup node

Follow standard procedure at https://github.com/kiwix/operations/wiki/Machine-and-k8s-node-Setup

Create a non-root user (member of sudoers):

useradd -m -s /bin/bash user
usermod -aG sudo user

Modify (with visudo) the sudoers configuration to ensure sudoers can sudo with passwords:

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD: ALL

Copy /root/.ssh/authorized_keys to /home/user/.ssh/authorized_keys and chown it to user:user:

mkdir -p /home/user/.ssh
cp /root/.ssh/authorized_keys /home/user/.ssh/authorized_keys
chown -R user:user /home/user/.ssh

Add perl package to have shasum utility

apt install perl

Install dependencies needed by your jobs

Docker

Follow normal procedure.

Add user to docker group:

sudo usermod -aG docker user

Install Github runner

Main documentation is at https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-an-organization and https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service

Login as user (not root)

Install the runner in /etc/actions-runner (where <your_token> is a token given by github on organization settings -> actions -> runners):

mkdir /etc/actions-runner && cd /etc/actions-runner
curl -o actions-runner-linux-arm64-2.320.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.320.0/actions-runner-linux-arm64-2.320.0.tar.gz
echo "bec1832fe6d2ed75acf4b7d8f2ce1169239a913b84ab1ded028076c9fa5091b8  actions-runner-linux-arm64-2.320.0.tar.gz" | shasum -a 256 -c
tar xzf ./actions-runner-linux-arm64-2.320.0.tar.gz
./config.sh --url https://github.com/openzim --token <your_token>

Start the runner to check it works as expected:

./run.sh

Install as a service and start:

sudo ./svc.sh install
sudo ./svc.sh start

You can then check status with:

sudo ./svc.sh status