120 lines
2.0 KiB
HCL
120 lines
2.0 KiB
HCL
variable "count" {
|
|
type = number
|
|
default = 2
|
|
}
|
|
|
|
job "whoami" {
|
|
region = "global"
|
|
datacenters = ["dc1"]
|
|
|
|
type = "service"
|
|
|
|
group "whoami-nomad" {
|
|
count = var.count
|
|
|
|
network {
|
|
mode = "bridge"
|
|
port "web" {
|
|
host_network = "wesher"
|
|
to = 80
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "whoami-nomad"
|
|
provider = "nomad"
|
|
port = "web"
|
|
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.whoami-nomad.entryPoints=websecure",
|
|
"traefik.http.routers.whoami-nomad.middlewares=basic-auth@file",
|
|
]
|
|
}
|
|
|
|
task "whoami" {
|
|
driver = "docker"
|
|
|
|
meta = {
|
|
"diun.enable" = false
|
|
}
|
|
|
|
config {
|
|
image = "containous/whoami:latest"
|
|
ports = ["web"]
|
|
args = ["--port", "${NOMAD_PORT_web}"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 50
|
|
memory = 20
|
|
}
|
|
}
|
|
}
|
|
|
|
group "whoami" {
|
|
count = var.count
|
|
|
|
network {
|
|
mode = "bridge"
|
|
port "web" {
|
|
host_network = "loopback"
|
|
to = 80
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "whoami"
|
|
port = "web"
|
|
|
|
connect {
|
|
sidecar_service {
|
|
proxy {
|
|
local_service_port = 80
|
|
}
|
|
}
|
|
|
|
sidecar_task {
|
|
resources {
|
|
cpu = 50
|
|
memory = 20
|
|
}
|
|
}
|
|
}
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/health"
|
|
port = "web"
|
|
interval = "10s"
|
|
timeout = "10s"
|
|
}
|
|
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.whoami.entryPoints=websecure",
|
|
"traefik.http.routers.whoami.middlewares=basic-auth@file",
|
|
]
|
|
}
|
|
|
|
task "whoami" {
|
|
driver = "docker"
|
|
|
|
meta = {
|
|
"diun.enable" = false
|
|
}
|
|
|
|
config {
|
|
image = "containous/whoami:latest"
|
|
ports = ["web"]
|
|
args = ["--port", "${NOMAD_PORT_web}"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 50
|
|
memory = 20
|
|
}
|
|
}
|
|
}
|
|
}
|