21 lines
540 B
Bash
Executable File
21 lines
540 B
Bash
Executable File
#!/bin/bash
|
|
# LeoCRM Healthcheck — works for both web server and worker containers.
|
|
# If port 8000 is listening → HTTP health check.
|
|
# Otherwise (worker) → Redis ping check.
|
|
|
|
if curl -fsS http://localhost:8000/api/v1/health > /dev/null 2>&1; then
|
|
exit 0
|
|
fi
|
|
|
|
# No web server — check Redis connectivity (worker mode)
|
|
python3 -c "
|
|
import os, sys
|
|
import redis
|
|
try:
|
|
r = redis.from_url(os.environ.get('REDIS_URL', 'redis://localhost:6379/0'))
|
|
r.ping()
|
|
sys.exit(0)
|
|
except Exception:
|
|
sys.exit(1)
|
|
" 2>/dev/null || exit 1
|