#!/bin/bash
# Healthcheck for Nginx Proxy Manager

# Check if the container is running
if ! docker ps --filter "name=npm" --filter "status=running" | grep -q "npm"; then
    echo "[FAIL] NPM container is not running"
    exit 1
fi

# Check Web UI responsiveness (port 81)
if ! curl -sf http://localhost:81 > /dev/null; then
    echo "[FAIL] NPM Web UI is not responding"
    exit 1
fi

echo "[OK] NPM is healthy"
exit 0
