furt/scripts/health-check.sh
michael 38a1108a46 feat(deployment): replace monster scripts with modular helper scripts (#87)
- Add install.sh orchestrator with upgrade support
- Add 6 helper scripts (<100 lines each) replacing 700-800 line monsters
- Add deployment/linux/furt.service systemd template
- Support both fresh install and upgrade modes
- Platform-aware detection (OpenBSD/FreeBSD vs Linux)
- Skip user/service creation in upgrade mode
- Preserve existing configuration during updates
- Remove merkwerk dependency from production install script

Helper scripts:
- scripts/setup-user.sh - Create system user (_furt/furt)
- scripts/setup-directories.sh - Create directory structure
- scripts/sync-files.sh - Copy source files to installation
- scripts/create-service.sh - Create system service from templates
- scripts/validate-config.sh - Validate furt.conf syntax
- scripts/health-check.sh - Basic health check functionality

Closes DAW/furt#87
2025-09-03 22:12:58 +02:00

40 lines
1,014 B
Bash
Executable file

#!/bin/sh
# scripts/health-check.sh - Basic health check for furt service
set -e
# Default values
HOST="127.0.0.1"
PORT="7811"
# Parse command line arguments
while [ $# -gt 0 ]; do
case "$1" in
--host) HOST="$2"; shift 2 ;;
--port) PORT="$2"; shift 2 ;;
*) echo "Usage: $0 [--host HOST] [--port PORT]"; exit 1 ;;
esac
done
echo "Checking furt health at $HOST:$PORT..."
# Check if port is listening
if command -v curl >/dev/null 2>&1; then
if curl -s "http://$HOST:$PORT/health" > /tmp/health_response; then
echo "Health check successful:"
cat /tmp/health_response | sed 's/^/ /'
rm -f /tmp/health_response
else
echo "Health check failed - service not responding"
exit 1
fi
else
echo "Warning: curl not available, using basic port check"
if nc -z "$HOST" "$PORT" 2>/dev/null; then
echo "Port $PORT is listening on $HOST"
else
echo "Port $PORT is not accessible on $HOST"
exit 1
fi
fi