homelab-nomad/whoami.nomad

73 lines
1.2 KiB
Plaintext
Raw Normal View History

variable "count" {
type = number
default = 2
}
2022-02-16 09:56:18 -08:00
job "whoami" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "whoami" {
count = var.count
2022-02-16 09:56:18 -08:00
network {
mode = "bridge"
port "web" {
2022-02-17 14:03:42 -08:00
host_network = "loopback"
to = 80
2022-02-16 09:56:18 -08:00
}
}
service {
2022-03-13 10:13:19 -07:00
name = "whoami"
2022-02-16 09:56:18 -08:00
port = "web"
connect {
2022-02-17 14:03:42 -08:00
sidecar_service {
proxy {
local_service_port = 80
}
}
sidecar_task {
resources {
cpu = 50
2022-07-25 15:51:16 -07:00
memory = 20
2022-02-17 14:03:42 -08:00
}
}
2022-02-16 09:56:18 -08:00
}
check {
type = "http"
path = "/health"
port = "web"
interval = "10s"
timeout = "10s"
}
tags = [
"traefik.enable=true",
"traefik.http.routers.whoami.entryPoints=websecure",
2022-07-26 21:45:06 -07:00
"traefik.http.routers.whoami.middlewares=basic-auth@file",
2022-02-16 09:56:18 -08:00
]
}
task "whoami" {
driver = "docker"
config {
image = "containous/whoami:latest"
ports = ["web"]
args = ["--port", "${NOMAD_PORT_web}"]
}
resources {
cpu = 50
2022-07-25 15:51:16 -07:00
memory = 20
2022-02-16 09:56:18 -08:00
}
}
}
}