Initial commit: complete WebsiteBox project
Docker-based self-hosted WordPress deployment system with: - Four-container stack (nginx, wordpress/php-fpm, mariadb, certbot) - Automatic SSL via Let's Encrypt with self-signed fallback - First-boot WordPress setup via WP-CLI (GeneratePress + child theme, plugins) - Interactive setup wizard and one-line install script - Backup, update, healthcheck, and SSL renewal scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
52
scripts/healthcheck.sh
Executable file
52
scripts/healthcheck.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# WebsiteBox Health Check
|
||||
# Usage: ./scripts/healthcheck.sh
|
||||
|
||||
echo "═══════════════════════════════════════════════════════════"
|
||||
echo " WebsiteBox Health Check"
|
||||
echo "═══════════════════════════════════════════════════════════"
|
||||
|
||||
ALL_HEALTHY=true
|
||||
|
||||
for service in nginx wordpress db; do
|
||||
container="websitebox-${service}"
|
||||
status=$(docker inspect --format='{{.State.Health.Status}}' "$container" 2>/dev/null || echo "not found")
|
||||
|
||||
case "$status" in
|
||||
healthy)
|
||||
echo " [OK] ${service}: healthy"
|
||||
;;
|
||||
unhealthy)
|
||||
echo " [FAIL] ${service}: unhealthy"
|
||||
ALL_HEALTHY=false
|
||||
;;
|
||||
starting)
|
||||
echo " [WAIT] ${service}: starting..."
|
||||
;;
|
||||
*)
|
||||
echo " [????] ${service}: ${status}"
|
||||
ALL_HEALTHY=false
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Certbot doesn't have a healthcheck — just check if running
|
||||
certbot_state=$(docker inspect --format='{{.State.Status}}' websitebox-certbot 2>/dev/null || echo "not found")
|
||||
if [ "$certbot_state" = "running" ]; then
|
||||
echo " [OK] certbot: running"
|
||||
else
|
||||
echo " [WARN] certbot: ${certbot_state}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
if [ "$ALL_HEALTHY" = true ]; then
|
||||
echo "All services are healthy."
|
||||
exit 0
|
||||
else
|
||||
echo "Some services are not healthy. Check logs with:"
|
||||
echo " docker compose logs -f [service]"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user