2026-01-14 13:23:05 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
#MISE description="Check that all indri services are online and responding"
|
|
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
# Colors for output
|
|
|
|
|
RED='\033[0;31m'
|
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
|
NC='\033[0m' # No Color
|
|
|
|
|
|
|
|
|
|
FAILED=0
|
|
|
|
|
|
|
|
|
|
check_service() {
|
|
|
|
|
local name="$1"
|
|
|
|
|
local check_cmd="$2"
|
|
|
|
|
|
|
|
|
|
printf "%-20s " "$name..."
|
|
|
|
|
if eval "$check_cmd" > /dev/null 2>&1; then
|
|
|
|
|
echo -e "${GREEN}OK${NC}"
|
|
|
|
|
else
|
|
|
|
|
echo -e "${RED}FAILED${NC}"
|
|
|
|
|
FAILED=1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_http() {
|
|
|
|
|
local name="$1"
|
|
|
|
|
local url="$2"
|
|
|
|
|
|
|
|
|
|
printf "%-20s " "$name..."
|
|
|
|
|
if curl -sf --max-time 5 "$url" > /dev/null 2>&1; then
|
|
|
|
|
echo -e "${GREEN}OK${NC}"
|
|
|
|
|
else
|
|
|
|
|
echo -e "${RED}FAILED${NC}"
|
|
|
|
|
FAILED=1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "Checking indri services..."
|
|
|
|
|
echo "=========================="
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
# Check via SSH that services are running on indri
|
|
|
|
|
echo "Local services (via launchctl/brew services):"
|
2026-01-15 12:24:13 -08:00
|
|
|
check_service "loki" "ssh indri 'brew services list | grep loki | grep started'"
|
|
|
|
|
check_service "alloy" "ssh indri 'brew services list | grep grafana-alloy | grep started'"
|
2026-01-14 13:23:05 -08:00
|
|
|
check_service "prometheus" "ssh indri 'brew services list | grep prometheus | grep started'"
|
|
|
|
|
check_service "grafana" "ssh indri 'brew services list | grep grafana | grep started'"
|
|
|
|
|
check_service "transmission" "ssh indri 'brew services list | grep transmission | grep started'"
|
2026-01-14 13:57:08 -08:00
|
|
|
check_service "transmission-metrics" "ssh indri 'launchctl list | grep transmission-metrics | grep -v \"^-\"'"
|
2026-01-14 13:23:05 -08:00
|
|
|
check_service "kiwix-serve" "ssh indri 'launchctl list | grep kiwix | grep -v \"^-\"'"
|
|
|
|
|
check_service "forgejo" "ssh indri 'brew services list | grep forgejo | grep started'"
|
2026-01-15 08:31:09 -08:00
|
|
|
check_service "devpi" "ssh indri 'launchctl list | grep devpi | grep -v \"^-\"'"
|
2026-01-20 09:04:47 -08:00
|
|
|
# NOTE: postgresql and miniflux moved to k8s - checked below
|
2026-01-18 12:06:28 -08:00
|
|
|
check_service "zot" "ssh indri 'launchctl list | grep mcquack.eblume.zot | grep -v \"^-\"'"
|
|
|
|
|
check_service "zot-metrics" "ssh indri 'launchctl list | grep zot-metrics | grep -v \"^-\"'"
|
|
|
|
|
check_service "minikube-metrics" "ssh indri 'launchctl list | grep minikube-metrics | grep -v \"^-\"'"
|
2026-01-14 13:23:05 -08:00
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "HTTP endpoints (via Tailscale):"
|
2026-01-15 12:24:13 -08:00
|
|
|
check_http "Loki" "http://indri:3100/ready"
|
2026-01-14 13:23:05 -08:00
|
|
|
check_http "Prometheus" "http://indri:9090/-/healthy"
|
2026-01-18 12:06:28 -08:00
|
|
|
check_http "Grafana" "https://grafana.tail8d86e.ts.net/api/health"
|
|
|
|
|
check_http "Kiwix" "https://kiwix.tail8d86e.ts.net/"
|
|
|
|
|
check_http "Forgejo" "https://forge.tail8d86e.ts.net/"
|
|
|
|
|
check_http "Devpi" "https://pypi.tail8d86e.ts.net/+api"
|
2026-01-16 14:41:36 -08:00
|
|
|
check_http "Miniflux" "https://feed.tail8d86e.ts.net/healthcheck"
|
2026-01-14 13:23:05 -08:00
|
|
|
# Transmission RPC is localhost-only by design, check via SSH
|
|
|
|
|
check_service "Transmission RPC" "ssh indri 'curl -sf http://127.0.0.1:9091/transmission/rpc'"
|
2026-01-14 13:57:08 -08:00
|
|
|
# Check that transmission metrics are being collected
|
|
|
|
|
check_service "Transmission metrics" "ssh indri 'test -f /opt/homebrew/var/node_exporter/textfile/transmission.prom'"
|
2026-01-18 12:06:28 -08:00
|
|
|
# Zot registry (via Tailscale service)
|
|
|
|
|
check_http "Zot Registry" "https://registry.tail8d86e.ts.net/v2/_catalog"
|
|
|
|
|
check_service "Zot metrics file" "ssh indri 'test -f /opt/homebrew/var/node_exporter/textfile/zot.prom'"
|
|
|
|
|
check_service "Minikube metrics file" "ssh indri 'test -f /opt/homebrew/var/node_exporter/textfile/minikube.prom'"
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Kubernetes cluster:"
|
|
|
|
|
check_service "minikube" "ssh indri 'minikube status --format={{.Host}} | grep -q Running'"
|
|
|
|
|
check_service "k8s-apiserver (indri)" "ssh indri 'kubectl get --raw /healthz'"
|
|
|
|
|
check_service "k8s-apiserver (remote)" "kubectl --kubeconfig=$HOME/.kube/minikube-indri/config.yml --context=minikube-indri get --raw /healthz"
|
2026-01-14 13:23:05 -08:00
|
|
|
|
2026-01-19 09:49:52 -08:00
|
|
|
echo ""
|
|
|
|
|
echo "Kubernetes workloads (via Tailscale):"
|
|
|
|
|
check_http "ArgoCD" "https://argocd.tail8d86e.ts.net/healthz"
|
|
|
|
|
# k8s PostgreSQL - check TCP connection (no auth needed for pg_isready)
|
2026-01-20 09:04:47 -08:00
|
|
|
check_service "PostgreSQL (k8s)" "pg_isready -h pg.tail8d86e.ts.net -p 5432"
|
|
|
|
|
# k8s miniflux pod
|
|
|
|
|
check_service "Miniflux pod" "kubectl --context=minikube-indri -n miniflux get pods -l app=miniflux -o jsonpath='{.items[0].status.phase}' | grep -q Running"
|
2026-01-19 09:49:52 -08:00
|
|
|
# ArgoCD apps sync status
|
|
|
|
|
check_service "ArgoCD apps synced" "kubectl --context=minikube-indri get applications -n argocd -o jsonpath='{.items[*].status.sync.status}' | grep -v OutOfSync"
|
|
|
|
|
|
2026-01-14 13:23:05 -08:00
|
|
|
echo ""
|
|
|
|
|
if [ $FAILED -eq 0 ]; then
|
|
|
|
|
echo -e "${GREEN}All services healthy!${NC}"
|
|
|
|
|
exit 0
|
|
|
|
|
else
|
|
|
|
|
echo -e "${RED}Some services failed health check${NC}"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|