Skip to content

Commit 0e567ae

Browse files
committed
adjust health check
1 parent 0fa166f commit 0e567ae

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

generators/docker/templates/docker/app.yml.ejs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,16 @@ _%>
9595
<%_ if (cacheProviderInfinispan) { _%>
9696
- JAVA_OPTS=-Djgroups.tcp.address=NON_LOOPBACK -Djava.net.preferIPv4Stack=true
9797
<%_ } _%>
98+
- THC_PORT=<%= serverPort %>
99+
- THC_PATH=/management/health
98100
<%_ if (applicationTypeMonolith || applicationTypeGateway) { _%>
99101
# If you want to expose these ports outside your dev PC,
100102
# remove the "127.0.0.1:" prefix
101103
ports:
102104
- 127.0.0.1:<%= serverPort %>:<%= serverPort %>
103105
<%_ } _%>
104106
healthcheck:
105-
test: ['CMD', 'curl', '-f', 'http://localhost:<%= serverPort %>/management/health']
107+
test: ['CMD', '/workspace/health-check']
106108
interval: 5s
107109
timeout: 5s
108110
retries: 40

generators/spring-boot/templates/build.gradle.ejs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,14 @@ task cleanResources(type: Delete) {
266266

267267
bootBuildImage {
268268
builder = "paketobuildpacks/builder-jammy-buildpackless-tiny"
269-
buildpacks = ["paketobuildpacks/java"]
269+
buildpacks = [
270+
"paketobuildpacks/java",
271+
"paketobuildpacks/health-checker"
272+
]
270273
tags = ["<%- lowercaseBaseName %>"]
271274
environment = [
272275
"BPL_SPRING_AOT_ENABLED" : "true",
276+
"BP_HEALTH_CHECKER_ENABLED" : "true",
273277
"BP_JVM_CDS_ENABLED" : "false",
274278
"BP_JVM_VERSION": "<%= JAVA_VERSION %>"
275279
]

generators/spring-boot/templates/pom.xml.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,14 @@
541541
<builder>paketobuildpacks/builder-jammy-buildpackless-tiny</builder>
542542
<buildpacks>
543543
<buildpack>paketobuildpacks/java</buildpack>
544+
<buildpack>paketobuildpacks/health-checker</buildpack>
544545
</buildpacks>
545546
<tags>
546547
<tag><%- lowercaseBaseName %></tag>
547548
</tags>
548549
<env>
549550
<BPL_SPRING_AOT_ENABLED>true</BPL_SPRING_AOT_ENABLED>
551+
<BP_HEALTH_CHECKER_ENABLED>true</BP_HEALTH_CHECKER_ENABLED>
550552
<BP_JVM_CDS_ENABLED>false</BP_JVM_CDS_ENABLED>
551553
<BP_JVM_VERSION>${java.version}</BP_JVM_VERSION>
552554
</env>

0 commit comments

Comments
 (0)