Hi Greg
I'm not sure about the job count. What I use is the group count (how many replicas of this group should run)
For that group, each group allocation got an index, which you can access from the NOMAD_ALLOC_INDEX env variable.
Here's a simple http-echo job which would echo them (because I'm too lazy to use an exec then fetch the logs)
job "show-count" {
type = "service"
datacenters = ["us-east-1a", "us-east-1b"]
group "show-count" {
count = 2
task "server" {
driver = "docker"
config {
image = "hashicorp/http-echo:latest"
args = [
"-text", "'NOMAD_ALLOC_INDEX:${NOMAD_ALLOC_INDEX}",
"-listen", ":${NOMAD_PORT_http}",
]
port_map {
http = "${NOMAD_PORT_http}"
}
}
resources {
network {
mbits = 1
port "http" {
static = 80
}
}
}
service {
name = "show-count"
port = "http"
}
}
}
}