generated from coulomb/repo-seed
Add Forgejo Actions runner substrate and status probe
Documents interim coulombcore org runner for forgejo.coulomb.social and adds make forgejo-runner-status for operator health checks.
This commit is contained in:
46
tools/forgejo-runner-status.sh
Executable file
46
tools/forgejo-runner-status.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
FORGEJO_URL="${FORGEJO_URL:-https://forgejo.coulomb.social}"
|
||||
RUNNER_HOST="${RUNNER_HOST:-coulombcore}"
|
||||
RUNNER_SSH_USER="${RUNNER_SSH_USER:-}"
|
||||
RUNNER_SSH_KEY="${RUNNER_SSH_KEY:-}"
|
||||
SSH_CONNECT_TIMEOUT="${SSH_CONNECT_TIMEOUT:-5}"
|
||||
|
||||
section() { printf '\n## %s\n' "$1"; }
|
||||
have() { command -v "$1" >/dev/null 2>&1; }
|
||||
http_code() { curl -sS -m 8 -o /dev/null -w '%{http_code}' "$1" 2>/dev/null || printf 'error'; }
|
||||
|
||||
section "Tool availability"
|
||||
for tool in curl ssh; do
|
||||
if have "$tool"; then printf 'ok: %s\n' "$tool"; else printf 'missing: %s\n' "$tool"; fi
|
||||
done
|
||||
|
||||
section "Forgejo endpoint checks"
|
||||
if have curl; then
|
||||
printf 'forgejo root: %s\n' "$(http_code "${FORGEJO_URL}/")"
|
||||
printf 'forgejo api version: %s\n' "$(http_code "${FORGEJO_URL}/api/v1/version")"
|
||||
printf 'forgejo registry /v2 (GET): %s\n' "$(curl -sS -m 8 -o /dev/null -w '%{http_code}' -X GET "${FORGEJO_URL}/v2/")"
|
||||
else
|
||||
echo "curl missing; skipping endpoint checks"
|
||||
fi
|
||||
|
||||
section "Runner host probe"
|
||||
if have ssh; then
|
||||
ssh_target="${RUNNER_HOST}"
|
||||
if [ -n "${RUNNER_SSH_USER}" ]; then ssh_target="${RUNNER_SSH_USER}@${RUNNER_HOST}"; fi
|
||||
ssh_args=(-o BatchMode=yes -o ConnectTimeout="${SSH_CONNECT_TIMEOUT}")
|
||||
if [ -n "${RUNNER_SSH_KEY}" ]; then ssh_args+=(-i "${RUNNER_SSH_KEY}"); fi
|
||||
ssh "${ssh_args[@]}" "${ssh_target}" '
|
||||
set -u
|
||||
echo "host=$(hostname)"
|
||||
if command -v forgejo-runner >/dev/null 2>&1; then forgejo-runner -v || true; else echo "missing: forgejo-runner"; fi
|
||||
if command -v docker >/dev/null 2>&1; then docker --version || true; else echo "missing: docker"; fi
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
systemctl is-active forgejo-runner 2>/dev/null || true
|
||||
fi
|
||||
if [ -f /var/lib/forgejo-runner/.runner ]; then echo "ok: /var/lib/forgejo-runner/.runner present"; fi
|
||||
'
|
||||
else
|
||||
echo "ssh missing; skipping runner host probe"
|
||||
fi
|
||||
Reference in New Issue
Block a user