diff --git a/prod-run.sh b/prod-run.sh index 1a3c9b3..96e13a9 100755 --- a/prod-run.sh +++ b/prod-run.sh @@ -175,9 +175,6 @@ say "Project directory: $PROJECT_DIR" say "Running as: $(id -un) (uid=$(id -u) gid=$(id -g))" ensure_service_user || true -if [[ "$SERVICE_USER" != "$APP_NAME" ]]; then - warn "Using fallback service identity ${SERVICE_USER}:${SERVICE_GROUP}; ownership/service behavior may differ from root-managed installs" -fi # --------------------------------------------------------- # 1) Git fetch + reset @@ -535,6 +532,23 @@ else PORT_STATUS="not-listening" fi +SYSTEMD_ACTIVE="$(systemctl is-active "${APP_NAME}.service" 2>/dev/null || echo inactive)" +HEALTH_URL="$(resolve_health_url)" +HEALTH_PORT="${HEALTH_URL#*://127.0.0.1:}" +HEALTH_PORT="${HEALTH_PORT%%/*}" + +if wait_for_health "$HEALTH_URL" 20 2; then + HEALTH_STATUS="healthy" +else + HEALTH_STATUS="unhealthy" +fi + +if is_port_listening "$HEALTH_PORT"; then + PORT_STATUS="listening" +else + PORT_STATUS="not-listening" +fi + say "✔ Systemd service: ${SYSTEMD_ACTIVE}" say "✔ Health URL: ${HEALTH_URL}" say "✔ Health endpoint: ${HEALTH_STATUS}"