homelab-nomad/services/whoami.nomad
Ian Fijolek d5078b24da Refactor use of wesher to be behind a variable toggle
Occasionally I run into issues with Wesher. This makes it easier to
disable use of Wesher by setting TF_VAR_use_wesher to false.
2023-08-24 12:51:32 -07:00

60 lines
1.1 KiB
HCL

variable "count" {
type = number
default = 2
}
job "whoami" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "whoami" {
count = var.count
network {
mode = "bridge"
port "web" {
%{~ if use_wesher ~}
host_network = "wesher"
%{~ endif ~}
to = 80
}
}
service {
name = "whoami"
provider = "nomad"
port = "web"
tags = [
"traefik.enable=true",
"traefik.http.routers.whoami.entryPoints=websecure",
# "traefik.http.routers.whoami.middlewares=basic-auth@file",
"traefik.http.routers.whoami.middlewares=authelia@nomad",
# "traefik.http.routers.whoami.middlewares=authelia-basic@consulcatalog",
# "traefik.http.routers.whoami.middlewares=authelia@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
}
}
}
}