fix(gitea-runner): split GITEA_INSTANCE_URL from GITEA_HOSTNAME

GITEA_HOSTNAME was doing double duty: a bare hostname for the
start_pre() MagicDNS getent check, and (implicitly, via manual
instructions) a base for the registration URL. Since Gitea moved to
`tailscale serve --https=443` (#19), the instance is reachable on 443
with no port — the old implicit `http://<hostname>:3000` no longer
applies.

GITEA_HOSTNAME stays a bare hostname; GITEA_INSTANCE_URL is a new,
independently overridable variable defaulting to
https://${GITEA_HOSTNAME}, forwarded through exec_in_lxc and used in
the printed registration command.

The instance URL is frozen into .runner at registration time, so
changing the variable doesn't retroactively fix an already-registered
runner. check_runner_url_drift() detects a mismatch and warns with
the re-registration procedure, without touching .runner — deleting a
working runner's registration is a deliberate, manual, documented
step, not something a rerunnable install script should do on its own.

Closes #22
This commit is contained in:
Damien
2026-07-31 20:23:12 +02:00
parent 9927e4dec1
commit 6c38d3038e
2 changed files with 65 additions and 3 deletions
+30 -1
View File
@@ -40,6 +40,8 @@ CTID=120 HOSTNAME=runner-02 CORES=4 RAM=4096 bash -c "$(curl -fsSL https://gitea
| `DISK` | `8` | Disk in GB |
| `STORAGE` | `local-lvm` | Proxmox storage for the LXC |
| `BRIDGE` | `vmbr0` | Network bridge |
| `GITEA_HOSTNAME` | `gitea.taila5ad8.ts.net` | Bare tailnet hostname of the Gitea instance, resolved via MagicDNS at service start |
| `GITEA_INSTANCE_URL` | `https://<GITEA_HOSTNAME>` | Full URL used to register the runner. Derived from `GITEA_HOSTNAME` by default but overridable independently — e.g. if Gitea is ever exposed on a different scheme/port than the tailnet default |
#### Runner registration
@@ -48,10 +50,37 @@ After installation, enter the LXC and register the runner:
```bash
pct enter <CTID>
cd /var/lib/gitea-runner
su -s /bin/bash gitea-runner -c "act_runner register"
su -s /bin/bash gitea-runner -c "act_runner register --instance https://gitea.taila5ad8.ts.net"
rc-service gitea-runner start
```
Use the value of `GITEA_INSTANCE_URL` (printed at the end of installation) as
`--instance`. As of Gitea's move to `tailscale serve --https=443` (#19), the
instance is reachable on 443 with **no port** in the URL — do not register
against the old `:3000` address.
#### Re-registration
The instance URL is frozen into `/var/lib/gitea-runner/.runner` at
registration time. Changing `GITEA_INSTANCE_URL` and re-running this script
does **not** retroactively fix an already-registered runner — the script
detects the mismatch and prints a warning, but never deletes or rewrites
`.runner` on its own (that would silently break a working runner on a
routine rerun).
To point an existing runner at a new instance URL:
```bash
rc-service gitea-runner stop
rm /var/lib/gitea-runner/.runner
cd /var/lib/gitea-runner
su -s /bin/bash gitea-runner -c "act_runner register --instance <new-url>"
rc-service gitea-runner start
```
A fresh registration token from the Gitea UI (Site Administration → Actions →
Runners) is required each time — tokens are single-use.
#### Update
From inside the LXC: