From 48cd8d242f4a40fd83b45ca44e5e5bcbd1d45658 Mon Sep 17 00:00:00 2001 From: hitanshu310 Date: Sun, 2 Aug 2026 23:57:44 +0530 Subject: [PATCH] Hithomelabs/CFTunnels#150: Add Spring Boot Actuator health check endpoints for portainer-automation - Add spring-boot-starter-actuator dependency to portainer-automation/build.gradle - Configure management.server.port=8082 with health,info exposure in application.properties - Map 5005:8082 in portainer-automation/docker-compose.yaml - Add MGMT_PORT=5005 to portainer-automation/.env.example - EXPOSE 8081 8082 in portainer-automation Dockerfile - No ActuatorSecurityConfig needed: service has no Spring Security/OIDC - Management port stays LAN-only, NOT added to any tunnel ingress --- portainer-automation/.env.example | 3 +++ portainer-automation/Dockerfile | 1 + portainer-automation/build.gradle | 1 + portainer-automation/docker-compose.yaml | 3 ++- .../src/main/resources/application.properties | 6 ++++++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/portainer-automation/.env.example b/portainer-automation/.env.example index 1d6593c..a8134f0 100644 --- a/portainer-automation/.env.example +++ b/portainer-automation/.env.example @@ -36,3 +36,6 @@ ENV=dev # Host port to map to container port 8081 HOST_PORT=8081 + +# Host port to map to actuator management port 8082 (health checks, LAN only) +MGMT_PORT=5005 diff --git a/portainer-automation/Dockerfile b/portainer-automation/Dockerfile index 93fb0b1..2a0f311 100644 --- a/portainer-automation/Dockerfile +++ b/portainer-automation/Dockerfile @@ -9,4 +9,5 @@ RUN ./gradlew :portainer-automation:bootJar FROM openjdk:17-jdk-slim COPY --from=build /app/portainer-automation/build/libs/*.jar app.jar +EXPOSE 8081 8082 ENTRYPOINT ["java", "-jar", "/app.jar"] diff --git a/portainer-automation/build.gradle b/portainer-automation/build.gradle index 0cfaa3e..4fce6cc 100644 --- a/portainer-automation/build.gradle +++ b/portainer-automation/build.gradle @@ -5,6 +5,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.apache.httpcomponents.client5:httpclient5' compileOnly 'org.projectlombok:lombok' diff --git a/portainer-automation/docker-compose.yaml b/portainer-automation/docker-compose.yaml index c4709d5..1865695 100644 --- a/portainer-automation/docker-compose.yaml +++ b/portainer-automation/docker-compose.yaml @@ -3,7 +3,8 @@ services: image: gitea.hithomelabs.com/hithomelabs/portainer-automation:${ENV:-test} container_name: portainer-automation_${ENV:-test} ports: - - "${HOST_PORT:-8081}:8081" + - "${HOST_PORT:-8081}:8081" # Application port (internal service) + - "${MGMT_PORT:-5005}:8082" # Health management port (LAN only) environment: - SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-local} - PORTAINER_API_KEY=${PORTAINER_API_KEY} diff --git a/portainer-automation/src/main/resources/application.properties b/portainer-automation/src/main/resources/application.properties index 682aa5c..3d94138 100644 --- a/portainer-automation/src/main/resources/application.properties +++ b/portainer-automation/src/main/resources/application.properties @@ -3,3 +3,9 @@ portainer.base-url=https://192.168.0.100:9442 portainer.api-key=${PORTAINER_API_KEY:} portainer.endpoint-id=1 portainer.service.api-key=${PORTAINER_SERVICE_API_KEY:change-me} + +# Actuator configuration - management port and exposed endpoints +# App runs on server.port=8081, so management port must differ (8082) +management.server.port=8082 +management.endpoints.web.exposure.include=health,info +management.endpoint.health.show-details=when-authorized -- 2.45.2