gitea-runner: wait for Tailscale MagicDNS before starting act_runner
OpenRC's `tailscale [started]` dependency only guarantees the tailscaled process is up, not that MagicDNS is operational. At boot this creates a race condition where act_runner starts before gitea.taila5ad8.ts.net is resolvable, causing the runner to fail to connect to Gitea. Add an active DNS poll in start_pre() using getent, with a 30-second timeout and an explicit eerror on expiry. depend() is unchanged.
This commit is contained in:
@@ -195,6 +195,20 @@ start_pre() {
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
checkpath --directory --owner gitea-runner:docker --mode 0755 /var/lib/gitea-runner
|
||||
checkpath --file --owner gitea-runner:docker --mode 0644 /var/log/gitea-runner.log
|
||||
|
||||
local timeout=30
|
||||
local elapsed=0
|
||||
ebegin "Waiting for Tailscale MagicDNS to resolve gitea.taila5ad8.ts.net"
|
||||
while ! getent hosts gitea.taila5ad8.ts.net > /dev/null 2>&1; do
|
||||
if [ "$elapsed" -ge "$timeout" ]; then
|
||||
eend 1
|
||||
eerror "Timed out after ${timeout}s waiting for MagicDNS resolution of gitea.taila5ad8.ts.net"
|
||||
return 1
|
||||
fi
|
||||
sleep 1
|
||||
elapsed=$(( elapsed + 1 ))
|
||||
done
|
||||
eend 0
|
||||
}
|
||||
EOF
|
||||
chmod +x /etc/init.d/gitea-runner
|
||||
|
||||
Reference in New Issue
Block a user