nomad to the max

This commit is contained in:
2023-09-19 19:49:36 +02:00
commit e6d03c8589
15 changed files with 572 additions and 0 deletions

55
test/nginx-lb.hcl Normal file
View File

@@ -0,0 +1,55 @@
job "nginx" {
datacenters = ["dc1"]
group "nginx" {
count = 1
network {
port "http" {
static = 80
}
}
service {
name = "nginx"
port = "http"
}
task "nginx" {
driver = "podman"
config {
image = "docker.io/nginx"
ports = ["http"]
volumes = [
"local:/etc/nginx/conf.d",
]
}
template {
data = <<EOF
upstream backend {
{{ range service "demo-webapp" }}
server {{ .Address }}:{{ .Port }};
{{ else }}server 127.0.0.1:65535; # force a 502
{{ end }}
}
server {
listen 80;
location / {
proxy_pass http://backend;
}
}
EOF
destination = "local/load-balancer.conf"
change_mode = "signal"
change_signal = "SIGHUP"
}
}
}
}