website-htmx-rustelo-code/provisioning/status.nu
2026-07-10 03:44:13 +01:00

32 lines
1.4 KiB
Text

#!/usr/bin/env nu
# Show build runners, K8s pods, and health for this deployment.
# Usage: nu provisioning/status.nu
def main []: nothing -> nothing {
print "── Build runners ────────────────────────────"
let runners = (do { ^hcloud server list --output json } | complete)
if $runners.exit_code == 0 {
$runners.stdout | from json
| where { |s| ($s.name | str starts-with "runner-") or ($s.name | str starts-with "buildkit-runner-") }
| each { |s| { name: $s.name, status: $s.status, type: $s.server_type.name } }
| table
} else {
print "(hcloud unavailable)"
}
print "\n── K8s pods (example-pro) ────────────────"
let pods = (do { ^kubectl get pods -n example-pro --no-headers } | complete)
if $pods.exit_code == 0 {
$pods.stdout | lines | where { |l| $l | is-not-empty } | each { |l| { pod: $l } } | table
} else {
print "(kubectl unavailable or namespace not found)"
}
print "\n── Health ───────────────────────────────────"
let health = (do { ^curl -sf "https://ontoref.dev/health" } | complete)
if $health.exit_code == 0 {
print "HEALTHY: /health responded"
} else {
print "UNHEALTHY or unreachable"
}
}