diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 99469fc..617bf21 100755 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -112,7 +112,16 @@ HEALTH_PORT="${HEALTH_BIND##*:}" if [ "$HEALTH_HOST" = "0.0.0.0" ]; then HEALTH_HOST="127.0.0.1" fi -if curl -sf "http://$HEALTH_HOST:$HEALTH_PORT/health/" >/dev/null; then +# Use the venv's own Python rather than curl — curl isn't guaranteed to be +# installed on a minimal host, but the venv obviously already is. +if "$VENV_DIR/bin/python" -c " +import sys, urllib.request +try: + urllib.request.urlopen('http://$HEALTH_HOST:$HEALTH_PORT/health/', timeout=5) +except Exception as e: + print(e, file=sys.stderr) + sys.exit(1) +"; then echo "Health check OK" else echo "Health check FAILED — check: journalctl -u evection-gunicorn -n 50" >&2