Add Nomad provider and sample using Wesher
This commit is contained in:
parent
73e7b7063f
commit
ee68310e58
@ -160,6 +160,12 @@ job "traefik" {
|
||||
[providers.consulCatalog.endpoint]
|
||||
address = "http://<< env "CONSUL_HTTP_ADDR" >>"
|
||||
|
||||
[providers.nomad]
|
||||
exposedByDefault = false
|
||||
defaultRule = "Host(`{{normalize .Name}}.<< keyOrDefault "global/base_hostname" "${var.base_hostname}" >>`)"
|
||||
[providers.nomad.endpoint]
|
||||
address = "http://127.0.0.1:4646/"
|
||||
|
||||
<< if keyExists "traefik/acme/email" ->>
|
||||
[certificatesResolvers.letsEncrypt.acme]
|
||||
email = "<< key "traefik/acme/email" >>"
|
||||
|
@ -9,6 +9,49 @@ job "whoami" {
|
||||
|
||||
type = "service"
|
||||
|
||||
group "whoami-nomad" {
|
||||
count = var.count
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
port "web" {
|
||||
host_network = "wesher"
|
||||
to = 80
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "whoami-nomad"
|
||||
provider = "nomad"
|
||||
port = "web"
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"traefik.http.routers.whoami-nomad.entryPoints=websecure",
|
||||
"traefik.http.routers.whoami-nomad.middlewares=basic-auth@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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group "whoami" {
|
||||
count = var.count
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user