add healthcheck for kontor-javalin
This commit is contained in:
@@ -9,7 +9,9 @@ COPY ./gradle/libs.versions.toml ./gradle/
|
||||
RUN gradle build --no-daemon
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
FROM alpine/java:21-jdk AS run
|
||||
FROM alpine/java:21-jre AS run
|
||||
|
||||
RUN apk --no-cache add curl
|
||||
|
||||
RUN adduser --system appuser
|
||||
USER appuser
|
||||
|
||||
@@ -2,6 +2,9 @@ package de.thpeetz.kontor.api;
|
||||
|
||||
import de.thpeetz.kontor.services.inmemory.InMemoryPersonReader;
|
||||
import io.javalin.Javalin;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -19,6 +22,11 @@ public class Main {
|
||||
|
||||
var app = Javalin.create().start(port);
|
||||
app.get("/ping", ctx -> ctx.result("pong"));
|
||||
app.get("/health", ctx -> {
|
||||
HashMap<String, String> status = new HashMap<>();
|
||||
status.put("status", "ok");
|
||||
ctx.json(status);
|
||||
});
|
||||
app.get("/persons", ctx -> {
|
||||
logger.info("persons called");
|
||||
ctx.json(result);
|
||||
|
||||
Reference in New Issue
Block a user