Faire des économies avec ses propres runners
I was invited in the French Podcast Nom d’un Pipeline ↗ to talk about RunsOn and how to make large savings with your own runners. Here is the episode link ↗ and a direct embed if you want to listen to it:
I was invited in the French Podcast Nom d’un Pipeline ↗ to talk about RunsOn and how to make large savings with your own runners. Here is the episode link ↗ and a direct embed if you want to listen to it:
This took a bit of a search for me, so here it is in case it’s useful:
cd /tmp/wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.debsudo dpkg -i cuda-keyring_1.1-1_all.debsudo apt-get updatesudo apt-get install -y cuda-drivers-545 nvidia-container-toolkitsudo nvidia-ctk runtime configure --runtime=dockersudo systemctl restart dockerThen you should be able to run the following docker container with gpu enabled:
docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smiAnd get the following output:
Fri Dec 8 14:49:32 2023+---------------------------------------------------------------------------------------+| NVIDIA-SMI 545.23.08 Driver Version: 545.23.08 CUDA Version: 12.3 ||-----------------------------------------+----------------------+----------------------+| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC || Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. || | | MIG M. ||=========================================+======================+======================|| 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 || N/A 29C P0 25W / 70W | 5MiB / 15360MiB | 0% Default || | | N/A |+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+| Processes: || GPU GI CI PID Type Process name GPU Memory || ID ID Usage ||=======================================================================================|| No running processes found |+---------------------------------------------------------------------------------------+Edit: RunsOn is now available as a modern way to setup self-hosted GitHub Actions runners!
While waiting for the RunsOn ephemeral self-hosted runners service, here is a short bash script, that can also be used as cloud-init script for launching GitHub hosted runners non-interactively:
#!/bin/bash -ex
set -o pipefail
RUNNER_ORG=YOUR_ORGRUNNER_TOKEN=YOUR_TOKENRUNNER_LABELS=self-hosted,x64,docker# update this to the latest versionRUNNER_VERSION=2.311.0
# Install docker, then additional packages and stuff:apt update -qqapt install -y ruby awsclicurl https://nodejs.org/dist/v20.9.0/node-v20.9.0-linux-x64.tar.xz | tar -xJf - --strip=1 -C /usr/local/
curl https://get.docker.com | sh
cat > /etc/cron.daily/docker-prune <<EOFdocker image prune -a --filter="until=96h" --forcedocker volume prune --forceEOFchmod a+x /etc/cron.daily/docker-prune
# Create dedicated useruseradd -m -d /home/runner -s /bin/bash runnerusermod -G docker runner
# Download and install runner scriptcd /home/runnermkdir -p actions-runnercd actions-runnercurl -o actions-runner-linux-x64-$RUNNER_VERSION.tar.gz -L https://github.com/actions/runner/releases/download/v$RUNNER_VERSION/actions-runner-linux-x64-$RUNNER_VERSION.tar.gztar xzf ./actions-runner-linux-x64-$RUNNER_VERSION.tar.gz
# Configure runnersu - runner -c "/home/runner/actions-runner/config.sh --url https://github.com/$RUNNER_ORG --token $RUNNER_TOKEN --labels $RUNNER_LABELS --unattended"
# Setup systemd scriptscd /home/runner/actions-runner/./svc.sh install runner./svc.sh start./svc.sh statusYou should be good to go!
Note that those runners won’t be ephemeral, so usual caveats apply regarding security of those runners.