I upgraded my application from Spring Boot 3.1 to Spring Boot 3.3. After upgrading the Paketo Buildpack for Health Checkers is not working anymore. It uses the wrong port. My health endpoint is on 8081
.
POM
This configuration worked with Spring Boot 3.1, but not with Spring Boot 3.3.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<image>
<env>
<BP_HEALTH_CHECKER_ENABLED>true</BP_HEALTH_CHECKER_ENABLED>
<THC_PORT>8081</THC_PORT>
<THC_PATH>/health</THC_PATH>
</env>
<buildpacks>
<buildpack>gcr.io/paketo-buildpacks/adoptium</buildpack>
<buildpack>urn:cnb:builder:paketo-buildpacks/java</buildpack>
<buildpack>gcr.io/paketo-buildpacks/health-checker:latest</buildpack>
</buildpacks>
</image>
</configuration>
<goals>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
Console
With Spring Boot 3.3 the container is shown as unhealthy.
[email protected]:~$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02700535df01 gitlab.mycompany.com:5005/mygroup/myservice:17 "/cnb/process/web" 19 minutes ago Up 19 minutes (unhealthy) 8081/tcp myservice
Research
-
I read Paketo Buildpack for Health Checkers 2.0.0:
- Removes the ability to set THC_* env variables at build time and have them included in the image. This is unfortunately a side effect of removing the process type in 1.). Because we’re not using a process, the thc binary is not being started by the launcher and so even if we bake the env variables into the image, they will not be set when the thc binary runs. All settings env variables for thc must now be set at runtime.
However, adding
--env THC_PORT=8081 --env THC_PATH=/health
to the run command didn’t solve the problem. The container is still unhealthy.
I checked the variables with
env
in the container and both are listed with the right values.cnb@02700535df01:/workspace$ env HOSTNAME=02700535df01 CNB_PLATFORM_API=0.12 CNB_LAYERS_DIR=/layers CNB_APP_DIR=/workspace PWD=/workspace HOME=/home/cnb TERM=xterm THC_PORT=8081 SHLVL=1 CNB_DEPRECATION_MODE=quiet THC_PATH=/health PATH=/cnb/process:/cnb/lifecycle:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin _=/usr/bin/env
Question
How to change the default port and path of the health checker?