Install self hosted runner

  1. Select Repo and go to Settings:

2. Go to Actions --> Runners --> New self-hoster runner:

3. Follow the instructions for the os in question (most likely Linux)

NOTE: A self-hosted runner is automatically removed from GitHub if it has not connected to GitHub Actions for more than 30 days.

4. Use the following:

# Use this YAML in your workflow file for each job
runs-on: self-hosted

To run the runner you have 2 options:

  1. Execute from folder ./run.sh

  • This will stop once you exit

  1. Set up background service for this:

  • Check available commands

user@linux-01:~/actions-runner$ sudo ./svc.sh 

Usage:
./svc.sh [install, start, stop, status, uninstall]
Commands:
   install [user]: Install runner service as Root or specified user.
   start: Manually start the runner service.
   stop: Manually stop the runner service.
   status: Display status of runner service.
   uninstall: Uninstall runner service.
  • Install the service as root:

user@linux-01:~/actions-runner$ sudo ./svc.sh install
Creating launch runner in /etc/systemd/system/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service
Run as user: tech
Run as uid: 1000
gid: 100
Created symlink /etc/systemd/system/multi-user.target.wants/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service → /etc/systemd/system/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service.
  • Start the service:

user@linux-01:~/actions-runner$ sudo ./svc.sh start

/etc/systemd/system/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service
● actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service - GitHub Actions Runner (Atredies-sturdy-octo-fiesta.vor-01)
     Loaded: loaded (/etc/systemd/system/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-01-30 19:22:33 EET; 12ms ago
   Main PID: 913 (runsvc.sh)
      Tasks: 3 (limit: 1133)
     Memory: 948.0K
        CPU: 4ms
     CGroup: /system.slice/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service
             ├─913 /bin/bash /home/tech/actions-runner/runsvc.sh
             └─915 ./externals/node12/bin/node ./bin/RunnerService.js

Jan 30 19:22:33 linux-01 systemd[1]: Started GitHub Actions Runner (Atredies-sturdy-octo…r-01).
Jan 30 19:22:33 linux-01 runsvc.sh[913]: .path=/usr/local/bin:/usr/bin:/bin:/usr/local/ga…games
Hint: Some lines were ellipsized, use -l to show in full.
  • Check if service is running:

user@linux-01:~/actions-runner$ sudo ./svc.sh status

/etc/systemd/system/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service
● actions.runner.Atredies-sturdy-octo-fiesta.linux-01.service - GitHub Actions Runner (Atredies-sturdy-octo-fiesta.vor-01)
     Loaded: loaded (/etc/systemd/system/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-01-30 19:22:33 EET; 4s ago
   Main PID: 913 (runsvc.sh)
      Tasks: 21 (limit: 1133)
     Memory: 36.4M
        CPU: 790ms
     CGroup: /system.slice/actions.runner.Atredies-sturdy-octo-fiesta.vor-01.service
             ├─913 /bin/bash /home/tech/actions-runner/runsvc.sh
             ├─915 ./externals/node12/bin/node ./bin/RunnerService.js
             └─924 /home/tech/actions-runner/bin/Runner.Listener run --startuptype service

Jan 30 19:22:33 linux-01 systemd[1]: Started GitHub Actions Runner (Atredies-sturdy-octo…r-01).
Jan 30 19:22:33 linux-01 runsvc.sh[913]: .path=/usr/local/bin:/usr/bin:/bin:/usr/local/ga…games
Jan 30 19:22:33 linux-01 runsvc.sh[915]: Starting Runner listener with startup type: service
Jan 30 19:22:33 linux-01 runsvc.sh[915]: Started listener process, pid: 924
Jan 30 19:22:33 linux-01 runsvc.sh[915]: Started running service
Jan 30 19:22:34 linux-01 runsvc.sh[915]:  Connected to GitHub
Jan 30 19:22:35 linux-01 runsvc.sh[915]: Current runner version: '2.286.1'
Jan 30 19:22:35 linux-01 runsvc.sh[915]: 2022-01-30 17:22:35Z: Listening for Jobs
Hint: Some lines were ellipsized, use -l to show in full.
  1. Check if runner is active:

  • Reload the Settings tab

  • Go to Actions

  • Go to Runners

  • New runner should be there:

Resources:

Last updated