Github Actions Runner
Deploy a scalable self-hosted GitHub Actions Runner.
myoung34/github-runner
myoung34/github-runner
Just deployed
GitHub Actions Self Hosted Runners
View a complete tutorial here -> https://docs.railway.com/tutorials/github-actions-runners
- Setup an
ACCESS_TOKEN
. This will enable the runner to self register with your GitHub organization or enterprise. - Add any extra labels you want for your runners.
- Deploy the template.
- Click on your new Service -> Settings -> Regions. Select the region(s) you want and the number of replicas you want.
- Deploy the changes and run some GitHub Actions!
Setup a fine-grained PAT
- Create a new fine-grained personal access token. Setup -> https://github.com/settings/personal-access-tokens
- Set the Resource owner as your organization. Alternatively, you can select your Enterprise or Repo. If you don't then you won't have access to organization scoped runners
- Set Expiration
- Set Repository Access
- Under Permissions, Select Organization Permissions -> Self Hosted Runners -> Read and Write (If Enterprise, select Enterprise instead).
- You don't need any other permissions!
Additional Configuration
You can set up additional configuration and settings from the GitHub repo.
Best Practices
Avoid Serverless
Using the Serverless Setting on this Service is not recommended and will result in idle runners disconnecting from GitHub and needing to reauthenticate. GitHub Runners have a 50 second HTTP longpoll which keeps them alive. While the runners in this template can automatically reauth with an ACCESS_TOKEN
it will result in offline / abandoned runners.
Avoid Docker-in-Docker
Railway's current container model does not allow for docker containers inside its containers, which means any GitHub Actions workflow that pulls a container and runs it will fail.
About GitHub Runners on Railway
Deploying GitHub Actions Self Hosted Runners on Railway is an excellent way to run your own CI infrastructure because you only pay for what you use. With self-hosted runners, you also unlock the ability to cache expensive and time-consuming dependencies (node_modules
, cargo
, etc.) or large git repositories. Best of all, Railway's built-in replicas means you can scale your runners horizontally, or even distribute them to different data centers with just a click and redeploy. You'll save build times and costs over using standard runners, AND you'll unlock more sophistocated workflows -- without needing a PhD in DevOps.
Template Content
myoung34/github-runner
myoung34/github-runnerACCESS_TOKEN
A fine-grained PAT giving the runner access to register itself. Setup -> https://github.com/settings/personal-access-tokens