Hello,
I try to migrate my home server from ansible + docker compose to Nomad & Consul.
I tried to understand and read doc and examples about volumes but something I missed.
My job:
job "traefik" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "traefik" {
count = 1
task "traefik" {
driver = "docker"
config {
image = "traefik:latest"
network_mode = "host"
volumes = [
"/srv/live/traefik/config/traefik.yaml:/etc/traefik/traefik.yaml",
"/srv/live/traefik/config/conf/:/etc/traefik/conf/",
"/srv/live/traefik/config/acme.json:/etc/traefik/acme.json",
"/var/run/docker.sock:/var/run/docker.sock",
]
}
resources {
cpu = 100
memory = 1024
network {
mbits = 100
port "http" {
static = 80
}
port "https" {
static = 443
}
port "metrics" {
static = 8082
}
port "api" {
static = 8081
}
}
}
service {
name = "traefik"
tags = [
"traefik.http.routers.dashboard.entrypoints=https",
"traefik.http.routers.dashboard.rule=Host(`traefik.xxxxxxx.com`)",
"traefik.http.routers.dashboard.service=api@internal",
"traefik.http.routers.dashboard.middlewares=auth,compress",
"traefik.http.routers.dashboard.tls=true",
"traefik.http.routers.dashboard.tls.certresolver=letsencrypt",
"traefik.http.middlewares.auth.basicauth.users=548b83ed3af40214b59105c4af669a6e",
"traefik.http.middlewares.compress.compress=true",
]
check {
name = "alive"
type = "tcp"
port = "http"
interval = "10s"
timeout = "2s"
}
}
}
}
}
When I used docker-compose, I have volume with all configs for all dockers containers in /srv/live/{{ APP_NAME }}/
and very important, I used directory watch for traefik, because I used lot of services (NAS, HomeAutomation etc.) in my LAN. And I create file for every externals services. And I would like to re-use these configs that work.
I have this error:
Oct 17, '20 16:58:43 +0200 Driver Failure Failed to create container configuration for image "traefik:latest" ("sha256:1a3f0281f41e2971ef15020097b1121131936f33ffe2fe51c45f0dd41307d1ab"): volumes are not enabled; cannot mount host paths: "/srv/live/traefik/config/traefik.yaml:/etc/traefik/traefik.yaml"
It’s the same user for docker and nomad
What is your advice? I’m little bit lost in this transition.
Does I needed to create volume? But I would like to be able to write directly from terminal in directory of traefik.
Thanks a lot for the newbie!