Add mise task for indri service health checks
- Create mise-tasks/indri-services-check script - Checks all indri services (prometheus, grafana, kiwix, transmission, forgejo) - Verifies both local service status and HTTP endpoints - Transmission RPC checked via SSH since it's localhost-only (secure) - Update CLAUDE.md with instructions to run after service changes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
eb2f5b44cd
commit
9c0ff8bb9b
2 changed files with 78 additions and 0 deletions
10
CLAUDE.md
10
CLAUDE.md
|
|
@ -91,3 +91,13 @@ ansible-playbook ansible/playbooks/indri.yml --check --diff
|
|||
# Apply changes
|
||||
ansible-playbook ansible/playbooks/indri.yml
|
||||
```
|
||||
|
||||
## Service Health Checks
|
||||
|
||||
After making changes to services, run the service health check to verify everything is working:
|
||||
|
||||
```bash
|
||||
mise run indri-services-check
|
||||
```
|
||||
|
||||
This checks that all indri services (prometheus, grafana, kiwix, transmission, forgejo) are running and responding to health checks.
|
||||
|
|
|
|||
68
mise-tasks/indri-services-check
Executable file
68
mise-tasks/indri-services-check
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
#!/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'
|
||||
YELLOW='\033[0;33m'
|
||||
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):"
|
||||
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'"
|
||||
check_service "kiwix-serve" "ssh indri 'launchctl list | grep kiwix | grep -v \"^-\"'"
|
||||
check_service "forgejo" "ssh indri 'brew services list | grep forgejo | grep started'"
|
||||
|
||||
echo ""
|
||||
echo "HTTP endpoints (via Tailscale):"
|
||||
check_http "Prometheus" "http://indri:9090/-/healthy"
|
||||
check_http "Grafana" "http://indri:3000/api/health"
|
||||
check_http "Kiwix" "http://indri:5501/"
|
||||
check_http "Forgejo" "http://indri:3001/"
|
||||
# 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'"
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue