From d101d6df0f933272ed2f7080a1cffc697680aa58 Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Thu, 13 Aug 2026 13:01:20 -0400 Subject: [PATCH] feat: add HTTP healthcheck endpoint via quarkus-smallrye-health - pom.xml: add quarkus-smallrye-health dependency. Exposes /q/health/live and /q/health/ready endpoints (liveness and readiness probes for Quarkus apps). - Dockerfile: install curl-minimal in the microdnf layer so the container has a real HTTP client. quarkus-micro-image is based on UBI 9 minimal and doesn't ship with curl by default. - compose.yaml: healthcheck now hits GET /q/health/live with curl -f instead of the previous kill -0 1 (which only proved the process was alive, not that the HTTP server was responding). The next CI run will rebuild the native binary with the health extension baked in; old images pulled from :latest will keep working since this is additive. --- Dockerfile | 3 ++- compose.yaml | 6 +++--- pom.xml | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index dbdd94a..dd9c06b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ FROM quay.io/quarkus/quarkus-micro-image:2.0 WORKDIR /work/ COPY build-output/shot-crafter-calculator-1.0.0-runner /work/application -RUN chmod 775 /work /work/application \ +RUN microdnf install -y curl-minimal && microdnf clean all \ + && chmod 775 /work /work/application \ && chown -R 1001 /work \ && echo "securerandom.source=file:/dev/urandom" >> /work/application diff --git a/compose.yaml b/compose.yaml index ce414d5..5355b11 100644 --- a/compose.yaml +++ b/compose.yaml @@ -44,9 +44,9 @@ services: volumes: - shot-crafter-data:/work/data healthcheck: - # La imagen native es PID 1. kill -0 chequea que sigue vivo - # sin mandar seƱal. Devuelve 0 si existe, 1 si no. - test: ["CMD-SHELL", "kill -0 1 || exit 1"] + # curl contra /q/health/live (extension quarkus-smallrye-health). + # Devuelve 200 si la app esta viva. -f falla si el status != 2xx. + test: ["CMD", "curl", "-fsS", "--max-time", "5", "http://localhost:8080/q/health/live"] interval: 30s timeout: 5s retries: 3 diff --git a/pom.xml b/pom.xml index 1ee109c..aab1aee 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,10 @@ io.quarkus quarkus-smallrye-jwt-build + + io.quarkus + quarkus-smallrye-health + io.quarkus quarkus-elytron-security-common