GitHub Actions Self‐hosted Runners - FLARE-forecast/flare-forecast.github.io GitHub Wiki

Description

To avoid the limitations of running GitHub Actions on GitHub, instead of using the default GitHub-hosted runners (available as a free GitHub service), a Jetstream VM acts as a self-hosted runner and runs a number of intensive GitHub Actions.

About Self-Hosted Runners

About Self-hosted Runners


Setup and Configuration

Adding Self-Hosted Runners

Adding Self-hosted Runners

A bash script running after reboot via crontab is responsible for starting the GitHub runner:

@reboot /home/ubuntu/actions-runner/run.sh

To run the script via crontab, a slight alteration to the original code downloaded from GitHub is required.
Read the comment at the top of the code:
GitHub Runner Script

Docker Image Pruning

To prevent unused Docker images from piling up and filling storage, a crontab job ensures periodic cleanup:

0 0 * * * /usr/bin/docker image prune -af >> docker-prune.log 2>&1

Maintenance and Troubleshooting

Runner Not Working Properly

If the runner doesn’t work properly, ensure the VM is not running out of space.

Disk Full Issue on FLARE GitHub Runner

The GitHub Runner VM executes Docker containers, which may build up container residues over time, causing a disk full error.
To prevent this, a crontab entry is added to periodically clean unnecessary container residues:

0 0 * * * /usr/bin/docker image prune -af >> docker-prune.log 2>&1

It has already been set up, but in case it does not work properly, follow these steps:

1. Access the VM

ssh [email protected]

2. Get Disk Usage Summary

Retrieve a summary of disk usage and the resources that can be pruned (unused containers, images, networks, and volumes):

docker system df

3. Disk Cleanup

Clean up all unused images, including older versions that are no longer used by any containers:

docker image prune -a

Crontab Content

Use crontab entries to run and maintain runners.

Run the Action Runner on Reboot

@reboot /home/ubuntu/actions-runner/run.sh

Clean Up Container Residue

0 0 * * * /usr/bin/docker image prune -af >> docker-prune.log 2>&1

🚀 Reboot is required after disk space clean-up if the runner has failed.