63 lines
1.1 KiB
HCL
63 lines
1.1 KiB
HCL
variable "base_hostname" {
|
|
type = string
|
|
description = "Base hostname to serve content from"
|
|
default = "dev.homelab"
|
|
}
|
|
|
|
job "whoami" {
|
|
region = "global"
|
|
datacenters = ["dc1"]
|
|
|
|
type = "service"
|
|
|
|
group "whoami" {
|
|
count = 2
|
|
|
|
network {
|
|
mode = "bridge"
|
|
port "web" {
|
|
# to = 80
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "whoami"
|
|
port = "web"
|
|
|
|
connect {
|
|
sidecar_service {}
|
|
}
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/health"
|
|
port = "web"
|
|
interval = "10s"
|
|
timeout = "10s"
|
|
}
|
|
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.whoami.entrypoints=web,websecure",
|
|
"traefik.http.routers.whoami.rule=Host(`whoami.${var.base_hostname}`)",
|
|
"traefik.http.routers.whoami.tls=true",
|
|
]
|
|
}
|
|
|
|
task "whoami" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "containous/whoami:latest"
|
|
ports = ["web"]
|
|
args = ["--port", "${NOMAD_PORT_web}"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 50
|
|
memory = 50
|
|
}
|
|
}
|
|
}
|
|
}
|