Skip to content

product-os/github-runners

Repository files navigation

github-runners

balena deployment of self-hosted GitHub runners

Runners are deployed in two variants, vm and container, where vm is isolated and safe to use on public repositories.

See github-runner-vm and self-hosted-runners for image sources.

Environment Variables

See docker-compose.yml for environment variables used by the runner services.

VM Runner Sizes

Firecracker allows overprovisioning or oversubscribing of both CPU and memory resources for virtual machines (VMs) running on a host. This means that the total vCPUs and memory allocated to the VMs can exceed the actual physical CPU cores and memory available on the host machine.

In order to make the most efficient use of host resources, we want to slightly underprovision the host hardware so if/when all allocated resources are consumed by jobs (e.g. yocto) there should be no overlap that could lead to performance degradation.

See the github-runner-vm README for more.

Provision New Hardware

Hetzner

Note

balenaOS can be deployed into Hetzner Robot

  1. Order a suitable machine in an ES rack (remote power controls)

  2. Download balenaOS production image from the target balenaCloud fleet:

  3. For x64 only: Unwrap the image

  4. Copy unwrapped image to S3 playground bucket and make public

    aws s3 cp balena.img s3://{{bucket}}/ --acl public-read
  5. Activate Hetzner Rescue system

  6. Reboot or reset server

Single drive

Note

This leaves the second block device unpaired and empty

  1. Download and uncompress unwrapped balenaOS image to /tmp using wget

  2. (Optional) Zero out target disk(s)

    for device in nvme{0,1}n1; do
        blkdiscard /dev/${device} -f
    done
  3. Download image from S3 via wget (URL is in S3 dashboard)

  4. Write image to disk (Check lsblk output for block device)

    dd if=balena.img of=/dev/nvme1n1 bs=$(blockdev --getbsz /dev/nvme1n1)
  5. Reboot

  6. Manually power cycle again via the Robot dashboard to work around this issue

Two drives via RAID1

Note

Use generic-amd64 or generic-aarch64 balenaOS device type

  1. Follow RAID1 setup steps here

  2. Download image from S3 via wget (URL is in S3 dashboard)

  3. Write image to RAID array

    dd if=balena.img of=/dev/md/balena bs=4096
  4. Monitor synchronization progress

    watch cat /proc/mdstat
  5. Reboot when 100% synchronized

  6. Manually power cycle again via the Robot dashboard to work around this issue