diff --git a/docker-compose.yml b/docker-compose.yml index 30fc6ed..d8435b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,14 @@ -version: '3.8' - +--- services: deflock: image: public.ecr.aws/w2o0b9g0/deflock.me:latest ports: - 8080:8080 - #restart: always + restart: always + healthcheck: + test: curl --fail http://localhost:8080/api/healthcheck || exit 1 + interval: 30s # Time between health checks + timeout: 10s # Time to wait for a response + retries: 3 # Number of retries before marking as unhealthy + start_period: 10s # Time to wait before starting health checks stdin_open: true diff --git a/shotgun/src/main/scala/me/deflock/shotgun/ShotgunServer.scala b/shotgun/src/main/scala/me/deflock/shotgun/ShotgunServer.scala index 4af1026..a4cae11 100644 --- a/shotgun/src/main/scala/me/deflock/shotgun/ShotgunServer.scala +++ b/shotgun/src/main/scala/me/deflock/shotgun/ShotgunServer.scala @@ -78,6 +78,11 @@ object ShotgunServer { complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "

Say hello to Pekko HTTP

Code: " + code.getOrElse("None") + "

")) } } + }, + path("healthcheck") { + get { + complete(HttpResponse(StatusCodes.OK, entity = "Service is healthy")) + } } ) }