From 0a731af40a0571de6a05cfed529dbc90fcd004c7 Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Tue, 1 Oct 2024 00:56:23 +0200 Subject: [PATCH] testing app checks Signed-off-by: Peter Siegmund --- Dockerfile | 2 +- app.json | 15 +++++++++++++++ src/main/resources/application.yaml | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app.json diff --git a/Dockerfile b/Dockerfile index 736ed63..8e13285 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ USER app # Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies COPY --chown=app ${SERVICE_ROOT}/gradle/ ./gradle -COPY --chown=app ${SERVICE_ROOT}/gradlew ${SERVICE_ROOT}/build.gradle ${SERVICE_ROOT}/settings.gradle ./ +COPY --chown=app ${SERVICE_ROOT}/gradlew ${SERVICE_ROOT}/build.gradle ${SERVICE_ROOT}/settings.gradle ${SERVICE_ROOT}/app.json ./ # Copy all needed project files to a folder COPY --chown=app:app ${SERVICE_ROOT}/src ./src diff --git a/app.json b/app.json new file mode 100644 index 0000000..eaa7b70 --- /dev/null +++ b/app.json @@ -0,0 +1,15 @@ +{ + "healthchecks": { + "web": [ + { + "type": "readiness", + "name": "web check", + "description": "Checking if the app responds to the /actuator/health/readiness endpoint", + "path": "/actuator/health/readiness", + "initialDelay": 20, + "port": 8080, + "attempts": 3 + } + ] + } +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 3036d59..72d7f23 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -14,6 +14,12 @@ info: spring-cloud-version: '@spring-cloud.version@' spring-boot-version: '@project.parent.version@' +management: + endpoint: + health: + probes: + enabled: true + server: port: ${PORT:8080} shutdown: graceful