Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from microservices-demo/fix-healthcheck
Browse files Browse the repository at this point in the history
Fix healthcheck endpoint and docker-compose
  • Loading branch information
nustiueudinastea authored Mar 7, 2017
2 parents 63e2d12 + 09687c9 commit 747ec83
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
25 changes: 19 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,27 @@ services:
- /tmp:rw,noexec,nosuid
environment:
- reschedule=on-node-failure
- ZIPKIN=zipkin
ports:
- "8082:80"
orders-db:
- "8000:80"
links:
- dynamo
environment:
- AWS_ACCESS_KEY_ID=0
- AWS_SECRET_ACCESS_KEY=0
- AWS_DEFAULT_REGION=eu-central-1
dynamo:
image: dwmkerr/dynamodb
hostname: orders-db
command: "-sharedDb"
hostname: dynamo
restart: always
environment:
- reschedule=on-node-failure
ports:
- "8080:8000"
init-dynamo:
image: garland/aws-cli-docker
command: "aws dynamodb create-table --table-name orders --attribute-definitions AttributeName=id,AttributeType=S AttributeName=customerId,AttributeType=S --key-schema AttributeName=id,KeyType=HASH AttributeName=customerId,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --endpoint-url http://dynamo:8000"
links:
- dynamo
environment:
- AWS_ACCESS_KEY_ID=0
- AWS_SECRET_ACCESS_KEY=0
- AWS_DEFAULT_REGION=eu-central-1
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import works.weave.socks.spring.aws.DynamoConfiguration

@Component
@Path("health")
class HealthCheckResource() {
class HealthCheckResource(dynamoConnection : DynamoConfiguration) {

@GET
def getHealthCheck(dynamoConnection : DynamoConfiguration) : Response = {
def getHealthCheck() : Response = {
Log.info("health check requested")
val dateNow = Calendar.getInstance().getTime();

Expand All @@ -34,7 +34,7 @@ class HealthCheckResource() {
try {
val table = dynamoConnection.client.describeTable("orders")
} catch {
case _ : Throwable => dynamoDBHealth("status") = "err"
case unknown : Throwable => dynamoDBHealth("status") = "err"
}

val map = Map("health" -> Array(ordersHealth, dynamoDBHealth))
Expand Down

0 comments on commit 747ec83

Please sign in to comment.