Skip to content

Aimed-Labs/github-runner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Quick pointers:

  1. The packages in this repo expose the docker images.
  2. The docker-compose uses those images to deploy the runners
  3. Also docker-compose.yml will need a PAT
  4. The deployment is using docker swarm. Swarm mode needs following:
    1. docker swarm init
    2. docker stack deploy -c docker-compose.yml <stack-name. Ex: gh-self-hosted-runner>
    3. To stop the stack: docker stack rm <stack-name>
    4. To scale a service, use following after starting the stack docker service scale <service-name, ex: runner>=<number of instances, ex:10>
  5. Swarm is important so since for ephemeral mode, swarm will create a new instance and deploy it
  6. The final deployment is done as following :
$ DOCKER_HOST="ssh://root@github-runner-hetzner" docker stack deploy -c docker-compose.yml gh-self-hosted-runner
$ DOCKER_HOST="ssh://root@github-runner-hetzner" docker service scale gh-self-hosted-runner_runner=10

Text below is from original fork-ed repo

Simple Self-Hosted GitHub Actions Runner

No Operator, No CRD, No need to blindly apply a yml to K8s cluster, only a simple self-hosted GitHub Actions Runner that just works!

Images

This repo provides the following images, both are Multi-Arch(amd64/arm64 supported):

  • knatnetwork/github-runner:focal-<tag>
  • ghcr.io/knatnetwork/github-runner:focal-<tag>

<tag> is related to the https://github.com/actions/runner/tags, for example, you may expect a image called knatnetwork/github-runner:focal-2.290.1 when v2.290.1 is released.

Specs

  • Images are based on Ubuntu 20.04

Usage

  1. Prepare your GitHub Personal Access Token, which looks like ghp_xxxxxxxxxxxxx with admin:org permission(If you'd like to register runner to repo, your user must have Admin permission on the related repo), if you don't know how to do it, you can refer to Creating a personal access token
  2. If you'd like to register runner on a single machine, you can follow the quick start below.
  3. If you need to spread multiple runners on multiple nodes using K8s, please take a look at the documentation.

Docker compose Quick Start

This is a quick start example for people to register a runner on single machine using Docker Compose.

First you need to create a docker-compose.yml file and write the following content.

version: '3'

services:
  runner:
    image: knatnetwork/github-runner:focal-2.291.1
    restart: always
    environment:
      RUNNER_REGISTER_TO: 'knatnetwork'
      RUNNER_LABELS: 'docker,knat'
      KMS_SERVER_ADDR: 'http://kms:3000'
      GOPROXY: 'http://goproxy.knat.network,https://proxy.golang.org,direct'
      ADDITIONAL_FLAGS: '--ephemeral'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  kms:
    image: knatnetwork/github-runner-kms:latest
    restart: always
    environment:
      PAT_knatnetwork: 'ghp_Lxxxxxxxxxx2NUk5F'
      PAT_rust-lang: 'ghp_Lxxxxxxxxxx2NUk5F'

(If your org's name is org_name, then environment should be PAT_org_name: 'ghp_Lxxxxxxxxxx2NUk5F')

After that you can use docker-compose up -d to start the runner, and now the runner should be registered on knatnetwork Org now.

Notes:

Further Reading

For more instructions, please take a look at the documentation.

License

GPL

About

Simple Self-Hosted GitHub Actions Runner

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Dockerfile 80.3%
  • Shell 19.7%