Runs On - Self-Hosted Runners
This guide explains how to set up and manage self-hosted runners using the Runs On component. Self-hosted runners provide more control over the execution environment, allowing you to run workflows on your own infrastructure.
GitHub-OIDC is not required to deploy Runs On, but it is required for several components to be deployed on or to via SelfHosted Runners. For example, your runners cannot push to ECR without GitHub-OIDC.
Quick Start
- Vendor the required components
- Deploy the Runs On component
- Install the GitHub App
- Configure your workflows to use the runners
1 Vendor Runs On Componentβ
Vendor the required components using the included Atmos workflow:
- Commands
- Atmos Workflow
vendor
workflow in the examples/snippets/stacks/workflows/github.yaml
file:- No commands found
Too many commands? Consider using the Atmos workflow! π
Run the following from your Geodesic shell using the Atmos workflow:
atmos workflow vendor -f github
2 Deploy Runs On Componentβ
Deploy the Runs On component using the included Atmos workflow:
- Commands
- Atmos Workflow
deploy/runs-on
workflow in the examples/snippets/stacks/workflows/github.yaml
file:- No commands found
Too many commands? Consider using the Atmos workflow! π
Run the following from your Geodesic shell using the Atmos workflow:
atmos workflow deploy/runs-on -f github
3 Install GitHub Appβ
After deployment, follow these steps to install the GitHub App:
- Check the Terraform outputs for
RunsOnEntryPoint
- Use the provided URL to install the GitHub App
- Follow the prompts to complete the installation in your GitHub Organization
- Ensure you have the necessary permissions in GitHub to install the app
4 Configure Workflowsβ
Update your GitHub Actions workflow files to use the self-hosted runners:
jobs:
build:
runs-on:
- "runs-on=${{ github.run_id }}"
- "runner=terraform" # Note `terraform` is a runner group name defined by a RunsOn configuration
## If no configuration is present, use
# - "runner=2cpu-linux-x64"
## Optional Tags
# - "tag=${{ inputs.component }}-${{ inputs.stack }}"
steps:
- uses: actions/checkout@v3
# Add your build steps here
For more information on available runner types and configurations, check the RunsOn: Runner Types documentation.
5 (Optional) Setup a RunsOn Repo or Organization Configurationβ
In your Repository you can add a file to configure Runs On. This can also extend the configuration for the Organization.
Please note this snippet below is an extremely simplified example
If you want to see what Cloud Posse uses as a starting point checkout our configuration here
Here's a sample configuration. We recommend storing this in a centralized .github
repository so you can define a shared runs-on
configuration that you can use across all repositories, without duplicating it in each one. This is especially useful when managing many repositories.
MyOrg/.github/.github/runs-on.yml
To use your organization's shared configuration in an individual repository, you need to define a local configuration that uses the _extends
keyword to inherit from the centralized setup β it wonβt be applied automatically.
MyOrg/MyInfraRepo/.github/runs-on.yml
Troubleshootingβ
GitHub Action Runner Not Foundβ
First determine if the Workflow or the Runner is the issue, sometimes the workflow doesn't kick off because it is on a feature branch and not on the default.
If the workflow kicks off but is waiting on a runner, checkout Runs On Troubleshooting as they have great docs on figuring out why a runner is not available.