I am trying to run Caddy using Nomad. I basically write the config file to the local directory and then try to mount that inside the container but every time I get the error
run: reading config file: open /data/Caddyfile: no such file or directory
run: reading config file: open /data/Caddyfile: no such file or directory
run: reading config file: open /data/Caddyfile: no such file or directory
I am running Nomad itself on Docker as well but not sure if that has anything to do with this issue.
Here is my job file
job "ingress" {
datacenters = ["dc1"]
type = "service"
group "proxy" {
count = 1
network {
mode = "host"
port "ingressHttp"{
static = 80
to = 80
}
port "ingressHttps"{
static = 443
to = 443
}
}
service {
name = "http"
provider = "nomad"
port = "ingressHttp"
}
service {
name = "https"
provider = "nomad"
port = "ingressHttps"
}
task "server" {
driver = "docker"
config {
image = "caddy/caddy:2.2.1-alpine"
ports = [
"ingressHttp",
"ingressHttps"
]
volumes = ["local:/data"]
args = [
"caddy",
"run",
"--config",
"/data/Caddyfile",
"--adapter",
"caddyfile",
]
}
resources {
cpu = 1000
memory = 2048
}
template {
data = <<EOH
domain.com {
reverse_proxy 0.0.0.0:26134 {
header_down Strict-Transport-Security max-age=31536000
}
}
EOH
destination = "local/Caddyfile"
}
}
}
}
Turns out it is because I was running Nomad from docker and that is an unsupported configuration with all sorts of unforeseen side effects.