51 lines
976 B
HCL
51 lines
976 B
HCL
# Simple test service to verify Traefik + Consul integration
|
|
# Deploy: nomad job run whoami.nomad.hcl
|
|
|
|
job "whoami" {
|
|
datacenters = ["hf-dc1"]
|
|
type = "service"
|
|
|
|
group "whoami" {
|
|
count = 2 # Run 2 instances for load balancing demo
|
|
|
|
network {
|
|
port "http" {
|
|
to = 80
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "whoami"
|
|
port = "http"
|
|
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.whoami.rule=Host(`whoami.hobbs.farm`)",
|
|
"traefik.http.routers.whoami.entrypoints=websecure",
|
|
"traefik.http.routers.whoami.tls.certresolver=letsencrypt",
|
|
]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/health"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
|
|
task "whoami" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "traefik/whoami:latest"
|
|
ports = ["http"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 50
|
|
memory = 32
|
|
}
|
|
}
|
|
}
|
|
}
|