|
| 1 | +--- |
| 2 | +title: "Runs On - Self-Hosted Runners" |
| 3 | +sidebar_label: "Runs On" |
| 4 | +sidebar_position: 12 |
| 5 | +--- |
| 6 | +import Intro from '@site/src/components/Intro'; |
| 7 | +import KeyPoints from '@site/src/components/KeyPoints'; |
| 8 | +import Steps from '@site/src/components/Steps'; |
| 9 | +import Step from '@site/src/components/Step'; |
| 10 | +import StepNumber from '@site/src/components/StepNumber'; |
| 11 | +import Admonition from '@theme/Admonition'; |
| 12 | +import AtmosWorkflow from '@site/src/components/AtmosWorkflow'; |
| 13 | + |
| 14 | +<Intro> |
| 15 | + 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. |
| 16 | +</Intro> |
| 17 | + |
| 18 | +<Admonition type="note"> |
| 19 | + [GitHub-OIDC](/layers/github-actions/github-oidc-with-aws/) is not required to deploy Runs On, but it is required for several components to be deployed on or to via SelfHosted Runners. |
| 20 | + For example, your runners cannot push to ECR without GitHub-OIDC. |
| 21 | +</Admonition> |
| 22 | + |
| 23 | +<KeyPoints title="Quick Start"> |
| 24 | + |
| 25 | +1. Vendor the required components |
| 26 | +2. Deploy the Runs On component |
| 27 | +3. Install the GitHub App |
| 28 | +4. Configure your workflows to use the runners |
| 29 | + |
| 30 | +</KeyPoints> |
| 31 | + |
| 32 | +<Steps> |
| 33 | + <Step> |
| 34 | + ## <StepNumber/> Vendor Runs On Component |
| 35 | + |
| 36 | + Vendor the required components using the included Atmos workflow: |
| 37 | + |
| 38 | + <AtmosWorkflow workflow="vendor" fileName="github" /> |
| 39 | + |
| 40 | + </Step> |
| 41 | + |
| 42 | + <Step> |
| 43 | + ## <StepNumber/> Deploy Runs On Component |
| 44 | + |
| 45 | + Deploy the Runs On component using the included Atmos workflow: |
| 46 | + |
| 47 | + <AtmosWorkflow workflow="deploy/runs-on" fileName="github" /> |
| 48 | + |
| 49 | + </Step> |
| 50 | + |
| 51 | + <Step> |
| 52 | + ## <StepNumber/> Install GitHub App |
| 53 | + |
| 54 | + After deployment, follow these steps to install the GitHub App: |
| 55 | + |
| 56 | + 1. Check the Terraform outputs for `RunsOnEntryPoint` |
| 57 | + 2. Use the provided URL to install the GitHub App |
| 58 | + 3. Follow the prompts to complete the installation in your GitHub Organization |
| 59 | + 4. Ensure you have the necessary permissions in GitHub to install the app |
| 60 | + |
| 61 | + </Step> |
| 62 | + |
| 63 | + <Step> |
| 64 | + ### <StepNumber/> Configure Workflows |
| 65 | + |
| 66 | + Update your GitHub Actions workflow files to use the self-hosted runners: |
| 67 | + |
| 68 | + ```yaml |
| 69 | + jobs: |
| 70 | + build: |
| 71 | + runs-on: |
| 72 | + - "runs-on=${{ github.run_id }}" |
| 73 | + - "runner=terraform" # Note `terraform` is a runner group name defined by a RunsOn configuration |
| 74 | + ## If no configuraiton is present, use |
| 75 | + # - "runner=2cpu-linux-x64" |
| 76 | + ## Optional Tags |
| 77 | + # - "tag=${{ inputs.component }}-${{ inputs.stack }}" |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v3 |
| 80 | + # Add your build steps here |
| 81 | + ``` |
| 82 | + |
| 83 | + For more information on available runner types and configurations, check the [RunsOn: Runner Types documentation](https://runs-on.com/runners/linux/). |
| 84 | + </Step> |
| 85 | + |
| 86 | + <Step> |
| 87 | + ### <StepNumber/> (Optional) Setup a RunsOn Repo or Organization Configuration |
| 88 | + |
| 89 | + In your Repository you can add a file to configure Runs On. This can also extend the configuration for the Organization. |
| 90 | + |
| 91 | + <Admonition type="note"> |
| 92 | + <br/> |
| 93 | + Please note this snippet below is an extremely simplified example |
| 94 | + <br/> |
| 95 | + <br/> |
| 96 | + If you want to see what Cloud Posse uses as a starting point checkout |
| 97 | + [CloudPosse/.github/.github/runs-on.yml](https://github.com/cloudposse/.github/blob/main/.github/runs-on.yml) |
| 98 | + </Admonition> |
| 99 | + |
| 100 | + ```yaml |
| 101 | + # See https://runs-on.com/configuration/repo-config/ |
| 102 | + _extends: .github |
| 103 | + terraform: |
| 104 | + cpu: [4, 32] # example override |
| 105 | + ``` |
| 106 | +
|
| 107 | +
|
| 108 | + ```yaml |
| 109 | + # Organizational Defaults for RunsOn usable by every repository |
| 110 | + |
| 111 | + runners: |
| 112 | + terraform: |
| 113 | + image: ubuntu22-full-x64 |
| 114 | + disk: default |
| 115 | + spot: price-capacity-optimized |
| 116 | + retry: when-interrupted |
| 117 | + private: false |
| 118 | + ssh: false |
| 119 | + cpu: [2, 32] |
| 120 | + ram: [8, 64] |
| 121 | + tags: |
| 122 | + - "gha-runner:runs-on/terraform" |
| 123 | + ``` |
| 124 | + </Step> |
| 125 | +</Steps> |
| 126 | +
|
| 127 | +## Troubleshooting |
| 128 | +
|
| 129 | +### GitHub Action Runner Not Found |
| 130 | +
|
| 131 | +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. |
| 132 | +
|
| 133 | +If the workflow kicks off but is waiting on a runner, checkout [Runs On Troubleshooting](https://runs-on.com/guides/troubleshoot/) as they have great docs on figuring out why a runner is not available. |
0 commit comments