Run your CI on your own GitHub runner when ubuntu-latest isn’t an option
A billing lock took away GitHub-hosted runners. Here’s how I moved deploys to a self-hosted runner, and why I had to route my registry pushes over Tailscale to get past Cloudflare’s 100-second limit.
The situation
One morning every deploy failed in six seconds with The job was not started because your account is locked due to a billing issue. The site was fine; the pipeline that ships it was not. GitHub-hosted runners were off the table until support replied, so the pipeline had to run somewhere I controlled.
1. Pick the host by bandwidth, not by convenience
My first instinct was the homelab: it was idle and already ran a Forgejo runner. It failed for a boring reason. CI downloads every action as a tarball and pushes container layers, and my home uplink to GitHub’s CDN was about 40 KB/s. Action downloads hit the runner’s 100-second HTTP timeout and the job never got past Set up job.
Measure before you commit. From the candidate host:
curl -o /dev/null -s -w "speed=%{speed_download}B/s\n" \
https://codeload.github.com/actions/checkout/tar.gz/v5My VPS did 1.4 MB/s, about 35 times faster. It was also the deploy target, which turned out to be a bonus.
2. Register the runner as a service
Get a registration token from the API (it expires in an hour), then configure the runner unattended with labels you’ll target from the workflow:
gh api -X POST /repos/OWNER/REPO/actions/runners/registration-token --jq .token
./config.sh --unattended --url https://github.com/OWNER/REPO \
--token <token> --name my-vps --labels self-hosted,vps,linux,x64
sudo ./svc.sh install "$USER" && sudo ./svc.sh start3. Point the workflow at it
jobs:
build-and-push:
runs-on: [self-hosted, vps]Because the runner now lived on the deploy target, I deleted the SSH deploy step entirely and ran the docker run commands directly. One less secret, one less hop.
4. The part nobody warns you about: Cloudflare 524s
My private registry sits behind a Cloudflare-proxied hostname. Pushing large layers through it failed with HTTP 524: Cloudflare’s Free and Pro plans cut any request that takes more than about 100 seconds, and a big blob over a slow link takes longer than that. No setting raises it below Enterprise.
The fix was to stop sending pushes through Cloudflare at all. Both machines were already on my Tailscale network, so on the runner I pinned the registry hostname to the registry host’s Tailscale IP and pushed to the registry’s own port:
# /etc/hosts on the runner
<registry-tailscale-ip> registry.example.com
# /etc/docker/daemon.json
{ "insecure-registries": ["registry.example.com:5000"] }That alone wasn’t enough, and this cost me two failed runs. Buildx runs BuildKit in its own container with its own DNS and its own registry config, so it ignored both changes. You have to tell it explicitly:
- uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host # inherit the host's /etc/hosts
buildkitd-config-inline: |
[registry."registry.example.com:5000"]
http = true
insecure = true5. Make the slow part cheaper
Pushes still crossed a slow home uplink (a full build and push takes around 18 minutes), so I added BuildKit’s registry cache to let unchanged layers be skipped:
cache-from: type=registry,ref=registry.example.com:5000/app:latest
cache-to: type=inlineWhat I’d tell myself on day one
- Test the host’s bandwidth to GitHub before registering anything.
- If a proxy sits between CI and your registry, find out its request timeout first.
- Remember that Buildx is a separate container: host-level Docker config doesn’t reach it.
- Keep the self-hosted runner registered even after billing is sorted. It’s a free fallback for the next outage.