Closed feigi closed 1 year ago
Yes, that's correct. launcher
is part of the buildpack spec. It is what ensure the buildpack contract is honored at runtime. Most notably, it loads environment variables set by buildpacks and kicks off the actual process. After the process starts, it steps out of the way.
You can see more about process types here.
Thanks for the quick response and the link. I skipped through this already but haven’t fully grasped it I guess. Still learning 😄. So, how would I execute the health check then. It does not seem to be in PATH. Is the idea to run the health check using the absolute path then or am I missing something?
/cnb/process
will usually be on the path so if you want to run it, you just run health-check
. Launcher will run the process and make sure that everything just works.
If you are going to enter the container and run it manually, you need to run /cnb/process/health-check
or you need to enter the container where launcher kicks off your shell, then it'll set up PATH
correctly. There's an example of entering the container using launcher
and bash
in the link I sent previously.
I can run health-check, but what I get is what looks to me like some startup logs from my spring app. I thought it would call thc. I‘ll just dive into the docs again. Thanks for your help!
Your explanations in conjunction with properly reading did the trick 🫣. Thanks again.
just because I've been also struggling with this for a while, thought I could leave my solution to it:
(relevant for Spring Boot 2.7 with Gradle bootBuildImage
task):
in the build.gradle
, configure the buildpacks similar to:
tasks.named("bootBuildImage") {
buildpacks = [
'paketo-buildpacks/ca-certificates',
'paketo-buildpacks/bellsoft-liberica',
'paketo-buildpacks/syft',
'paketo-buildpacks/executable-jar',
'paketo-buildpacks/dist-zip',
'paketo-buildpacks/spring-boot',
'gcr.io/paketo-buildpacks/health-checker'
]
environment('BP_HEALTH_CHECKER_ENABLED', 'true')
}
then, in the docker-compose.yml
file, configure the Spring Boot entry with something like
spring-boot-app:
image: my-cool-app:latest
environment:
THC_PATH: /actuator/health
THC_PORT: 8080
healthcheck:
test: ["CMD", "health-check"]
start_interval: 30s
interval: 5s
retries: 10
and then, for the service you want to depend on the Spring Boot app being healthy, configure it like
depends_on:
spring-boot-app:
condition: service_healthy
Hope it will save someone a minute :)
Hi!
First of all thanks for creating this buildpack. I'm a bit new to CNBs and am trying this out for a Spring-Boot application right now but ran into an issue.
In my build.gradle, I set the following Buildpacks and environment:
The build yields:
So, looks like to me it's correctly added. I can navigate down the layers dir and run the the 'thc' command successfully, however when I navigate to /cnb/process I see the following:
Is it correct, that the health-check process runs 'launcher'? I'd expect 'thc' here if I interpret https://github.com/paketo-buildpacks/health-checker/blob/ad173c6b5f3c0906cbc055de68fe05f86d2c9f1b/hc/tiny_health_checker.go#L78 correctly.
Thanks in advance!