Simple Usage

Simple Usage #

If you’d like to use runner on a single machine, then this page is for you.

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'
    depends_on:
      - kms
  
  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:

  • If you want to run runner without docker support inside it, just delete the volumes
  • If you don’t want ephemeral runner(ref: GitHub Actions: Ephemeral self-hosted runners & new webhooks for auto-scaling, just remove ADDITIONAL_FLAGS: '--ephemeral' line.)
  • Even with --ephemeral, container restart after completing job will not clean your enviroment thoroughly, thus the next time your job running in the same worker may experience weird issues. You can refer to this issue: https://github.com/knatnetwork/github-runner/issues/2 for more info.
  • If you want to register runner to a repo only, you can just change value of RUNNER_REGISTER_TO to <org_name>/<repo_name>