Add docker-compose healthcheck and /api/healthcheck (#12)

This commit is contained in:
AJ Collins
2024-11-30 14:57:15 -08:00
committed by GitHub
parent a13b48af5b
commit ab8c22b3e5
2 changed files with 13 additions and 3 deletions

View File

@@ -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

View File

@@ -78,6 +78,11 @@ object ShotgunServer {
complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to Pekko HTTP</h1><p><b>Code: " + code.getOrElse("None") + "</b></p>"))
}
}
},
path("healthcheck") {
get {
complete(HttpResponse(StatusCodes.OK, entity = "Service is healthy"))
}
}
)
}