rkevx21
rkevx21

Reputation: 3969

Nomad : Health Check

need help I have this

service {
  name = "nginx"
  tags = [ "nginx", "web", "urlprefix-/nginx" ]
  port = "http"
  check {
    type = "tcp"
    interval = "10s"
    timeout = "2s"
  }
}

how can i add a health for a specific URI if it returns a 200 response like localhost:8080/test/index.html

Upvotes: 1

Views: 4510

Answers (1)

Chris Zacharias
Chris Zacharias

Reputation: 608

It is as simple as adding another check configured to use an http check like so where /health is served by your nginx on its published port:

service {
  name = "nginx"
  tags = [ "nginx", "web", "urlprefix-/nginx" ]
  port = "http"
  check {
    type = "tcp"
    interval = "10s"
    timeout = "2s"
  }
  check {
    type = "http"
    path = "/health"
    interval = "10s"
    timeout  = "2s"
  }
}

You can see a full example here: https://www.nomadproject.io/docs/job-specification/index.html

Upvotes: 6

Related Questions