From acc
Generates bash health check scripts for Docker PHP services: PHP-FPM via cgi-fcgi ping, HTTP endpoints with curl, and combined checks for FPM+Nginx.
How this skill is triggered — by the user, by Claude, or both
Slash command
/acc:create-docker-healthcheckThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generates health check scripts and configurations for PHP Docker containers.
Generates health check scripts and configurations for PHP Docker containers.
docker/healthcheck/
php-fpm-healthcheck.sh # PHP-FPM process health check
http-healthcheck.sh # HTTP endpoint health check
combined-healthcheck.sh # Combined multi-service check
#!/bin/bash
# php-fpm-healthcheck.sh
# Checks PHP-FPM status via /ping endpoint using cgi-fcgi
set -eo pipefail
FCGI_CONNECT="${FCGI_CONNECT:-localhost:9000}"
FCGI_STATUS_PATH="${FCGI_STATUS_PATH:-/ping}"
EXPECTED_RESPONSE="${EXPECTED_RESPONSE:-pong}"
if ! command -v cgi-fcgi &> /dev/null; then
echo "ERROR: cgi-fcgi not found. Install libfcgi-bin."
exit 1
fi
RESPONSE=$(SCRIPT_NAME="${FCGI_STATUS_PATH}" \
SCRIPT_FILENAME="${FCGI_STATUS_PATH}" \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect "${FCGI_CONNECT}" 2>/dev/null)
if echo "${RESPONSE}" | grep -q "${EXPECTED_RESPONSE}"; then
echo "OK: PHP-FPM is healthy"
exit 0
else
echo "FAIL: PHP-FPM returned unexpected response"
exit 1
fi
; /usr/local/etc/php-fpm.d/www.conf
; Enable ping/status endpoints
pm.status_path = /status
ping.path = /ping
ping.response = pong
#!/bin/bash
# http-healthcheck.sh
# Checks application health via HTTP /health endpoint
set -eo pipefail
HEALTH_URL="${HEALTH_URL:-http://localhost:80/health}"
TIMEOUT="${HEALTH_TIMEOUT:-5}"
EXPECTED_STATUS="${EXPECTED_STATUS:-200}"
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
--max-time "${TIMEOUT}" \
--fail \
"${HEALTH_URL}" 2>/dev/null) || true
if [ "${RESPONSE_CODE}" = "${EXPECTED_STATUS}" ]; then
echo "OK: HTTP health check passed (${RESPONSE_CODE})"
exit 0
else
echo "FAIL: HTTP health check returned ${RESPONSE_CODE}, expected ${EXPECTED_STATUS}"
exit 1
fi
#!/bin/bash
# combined-healthcheck.sh
# Checks PHP-FPM process + custom application logic
set -eo pipefail
FCGI_CONNECT="${FCGI_CONNECT:-localhost:9000}"
HEALTH_URL="${HEALTH_URL:-http://localhost:80/health}"
# Check 1: PHP-FPM process is running
if ! pgrep -x "php-fpm" > /dev/null 2>&1; then
echo "FAIL: PHP-FPM process not running"
exit 1
fi
# Check 2: PHP-FPM responds to ping
PING_RESPONSE=$(SCRIPT_NAME=/ping \
SCRIPT_FILENAME=/ping \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect "${FCGI_CONNECT}" 2>/dev/null || true)
if ! echo "${PING_RESPONSE}" | grep -q "pong"; then
echo "FAIL: PHP-FPM not responding to ping"
exit 1
fi
# Check 3: Application health endpoint
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
--max-time 5 "${HEALTH_URL}" 2>/dev/null || true)
if [ "${HTTP_CODE}" != "200" ]; then
echo "FAIL: Application health endpoint returned ${HTTP_CODE}"
exit 1
fi
echo "OK: All health checks passed"
exit 0
# Simple PHP-FPM health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD ["php-fpm-healthcheck"] || exit 1
# HTTP endpoint health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -f http://localhost:80/health || exit 1
# Combined health check (copy script into image)
COPY docker/healthcheck/combined-healthcheck.sh /usr/local/bin/healthcheck
RUN chmod +x /usr/local/bin/healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD ["/usr/local/bin/healthcheck"]
# docker-compose.yml
services:
php-fpm:
build: .
healthcheck:
test: ["CMD", "/usr/local/bin/healthcheck"]
interval: 30s
timeout: 5s
start_period: 20s
retries: 3
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
MYSQL_DATABASE: "${DB_NAME}"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_PASSWORD}"]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: "${DB_NAME}"
POSTGRES_USER: "${DB_USER}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
start_period: 5s
retries: 3
rabbitmq:
image: rabbitmq:3-management-alpine
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "check_running"]
interval: 15s
timeout: 10s
start_period: 30s
retries: 5
# docker-compose.yml — services wait for healthy dependencies
services:
php-fpm:
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
Analyze project stack:
Generate health check scripts:
Configure Dockerfile:
Configure docker-compose:
depends_on with condition: service_healthyProvide:
The generator will:
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin accVerifies Docker health check configurations for PHP-FPM, Nginx, MySQL, PostgreSQL, Redis, and RabbitMQ. Detects improper intervals, missing start_periods, and recommends optimal parameters.
Validates Docker Compose files for Alfresco deployments, ensuring every service has a healthcheck block and depends_on uses condition: service_healthy. Applies known healthcheck endpoints for common services.
Guides deployment workflows including CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.