2021-06-03 08:23:14 -04:00
# SerenityOS self-hosted runner setup instructions
## Requirements
2024-09-11 10:20:33 -04:00
Since these self hosted-runners are supposed to be a more performant alternative to the GitHub-provided runners, the bare minimum requirements are GitHub's own Linux runner [hardware specification ](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources ) as well as guaranteed uptime.
2021-06-03 08:23:14 -04:00
As for recommended requirements, listed below are the specifications of the current SerenityOS runners, roughly matching these would eventually make running performance-regression related tests on these easier. (But this is not a hard requirement, as GitHub offers the ability to selectively choose which self-hosted runners run which workflow)
#### IdanHo runner:
2024-09-11 10:20:33 -04:00
- Ryzen 5 3600 - 12 cores w/ KVM support
- 64GB of RAM
- 512GB of SSD space
###### This runner can be split into 2 runners with half the cores/RAM/space if needed.
2021-06-03 08:23:14 -04:00
## Setup
2022-10-25 15:28:09 -04:00
These instructions assume the OS installed is Ubuntu 22.04 (Jammy), so they might not be compatible with other Linux flavours.
2021-06-03 08:23:14 -04:00
### Install base dependencies
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
2022-02-06 14:05:35 -05:00
sudo add-apt-repository ppa:canonical-server/server-backports
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
2024-02-05 05:45:43 -05:00
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main'
2021-06-03 08:23:14 -04:00
apt update
2024-02-05 05:45:43 -05:00
apt install git build-essential make cmake clang-format-16 gcc-13 g++-13 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt
2021-06-03 08:23:14 -04:00
```
2024-09-11 10:20:33 -04:00
2024-02-05 05:45:43 -05:00
### Force usage of GCC 13
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
2024-02-05 05:45:43 -05:00
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13
2021-06-03 08:23:14 -04:00
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Create a new user account named 'runner'
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
adduser runner
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Give it password-less sudo capabilities by adding the following line to /etc/sudoers:
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
runner ALL=(ALL) NOPASSWD:ALL
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Add it to the kvm access group (if available):
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
adduser runner kvm
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Switch to the new user and then create a workspace folder in its home directory:
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
mkdir actions-runner & & cd actions-runner
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Download the latest version of actions-runner-linux-x64 from https://github.com/rust-lang/gha-runner/releases
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
curl -o actions-runner-linux-x64-X.X.X.tar.gz -L https://github.com/rust-lang/gha-runner/releases/download/vX.X.X-rust1/actions-runner-linux-x64-X.X.X-rust1.tar.gz
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Extract the tar archive
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
tar xzf ./actions-runner-linux-x64-X.X.X.tar.gz
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Link the runner to the repository
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
./config.sh --url https://github.com/SerenityOS/serenity --token INSERT_SECRET_TOKEN_HERE
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Configure the runner to protect against malicious PRs by adding the following line to .env:
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
RUST_WHITELISTED_EVENT_NAME=push
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Configure the maximum runner threads by adding the following line to .env:
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
MAX_RUNNER_THREADS=XXX
```
2024-09-11 10:20:33 -04:00
2022-01-07 07:04:05 -05:00
If you are setting up multiple runners on the same machine, this setting can be used to divvy up the cores, if you're only setting up one runner, this can just be set to the server's core count
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Install the runner as a service
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
sudo ./svc.sh install
```
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
### Start the runner
2024-09-11 10:20:33 -04:00
2021-06-03 08:23:14 -04:00
```shell
sudo ./svc.sh start
```