2017-08-02 20:20:06 +00:00
|
|
|
job "client" {
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
|
|
|
|
group "client" {
|
|
|
|
count = 6
|
|
|
|
|
|
|
|
task "agent" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "djenriquez/nomad:v0.6.0"
|
|
|
|
|
|
|
|
# command = "nomad"
|
|
|
|
args = ["agent"]
|
|
|
|
network_mode = "host"
|
|
|
|
volumes = ["local/config:/etc/nomad", "/var/run/docker.sock:/var/run/docker.sock", "/tmp:/tmp"]
|
|
|
|
privileged = true
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
2017-08-07 18:19:46 +00:00
|
|
|
cpu = 300
|
|
|
|
memory = 100
|
2017-08-02 20:20:06 +00:00
|
|
|
|
|
|
|
network {
|
|
|
|
mbits = 10
|
|
|
|
port "http"{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2017-08-07 18:19:46 +00:00
|
|
|
log_level = "DEBUG"
|
|
|
|
data_dir = "/tmp/nomad-client{{ env "NOMAD_ALLOC_INDEX" }}"
|
|
|
|
name = "client-{{ env "NOMAD_ALLOC_INDEX" }}"
|
|
|
|
enable_debug = true
|
2017-08-02 20:20:06 +00:00
|
|
|
client {
|
2017-08-07 18:19:46 +00:00
|
|
|
enabled = true
|
|
|
|
servers = ["127.0.0.1:4647"]
|
|
|
|
options {
|
|
|
|
"driver.raw_exec.enable" = "1"
|
|
|
|
}
|
2017-08-02 20:20:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ports {
|
2017-08-07 18:19:46 +00:00
|
|
|
http = {{ env "NOMAD_PORT_http" }}
|
2017-08-02 20:20:06 +00:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
destination = "local/config/client.hcl"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|