Migrated to v2 in Swarm, can't load dashboard

I've converted my stack to traefik v2 but I can't get a demo service to work and I can't get the traefik dashboard to load. The traefik logs are showing nothing really. Can somebody please tell me what I am doing wrong? My goal is to get the traefik dashboard to load over ssl.

image: traefik:v2.0
    command: 
      - "--log.level=DEBUG"
      - "--api=true"
      - "--api.dashboard=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.https.address=:443"
      - "--providers.docker.swarmMode=true"
      - "--metrics.prometheus=true"
      - "--accesslog=true"
      - "--ping=true"
    networks:
      - swarm
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

...

deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=swarm"
        - "traefik.http.routers.traefik.entrypoints=https"
        - "traefik.http.routers.traefik.rule=Host(`traefik.mydomain.local`)"
        - "traefik.http.services.traefik.loadbalancer.server.port=8080"
        - "traefik.http.routers.traefik.service=api@internal"

traefik.yml

providers:
  file:
    directory: /etc/traefik
    filename: dynamic_conf.yml
    watch: true

dynamic_conf.yml

tls:
  certificates:
    - certFile: /etc/traefik/certs/wildcard-cert.pem
      keyFile: /etc/traefik/certs/wildcard-key.pem

Hello

      - "--api.insecure=true"

means that you don't need to expose your dashborad trought traefik

https://docs.traefik.io/v2.0/operations/api/#insecure

Try removing all the labels and keep --api.insecure
or
Remove --api.insecure and keep the labels

1 Like

Thanks but that didn't work. I could REALLY use a basic working example of a Swarm config. Here's what I have, I could really use some assistance - i've been fighting this for days.

compose:

services:
  traefik:
    image: traefik:v2.0
    restart: unless-stopped
    command: --providers.docker \
      --providers.docker.swarmMode \
      --providers.docker.exposedByDefault=false \
      --providers.docker.domain=${URLSLUG:-dev}.domain.local \
      --providers.docker.watch \
      --entryPoints.web.address=:80
      --entryPoints.websecure.address=:443
      --log.level=DEBUG
    networks:
      - swarm
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    configs:
      - source: traefik_config
        target: /etc/traefik/traefik.yml
      - source: dynamic_config
        target: /etc/traefik/dynamic_conf.yml
      - source: cert_config
        target: /etc/traefik/certs/wildcard-cert.pem
      - source: key_config
        target: /etc/traefik/certs/wildcard-key.pem
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.traefik-redirect.rule=Host(`traefik.${URLSLUG:-dev}.domain.local`)"
        - "traefik.http.routers.traefik-redirect.entrypoints=web"
        - "traefik.http.routers.traefik-redirect.middlewares=https-redirect"
        - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
        - "traefik.http.routers.traefik.rule=Host(`traefik.${URLSLUG:-dev}.domain.local`)"
        - "traefik.http.routers.traefik.entrypoints=websecure"
        - "traefik.http.routers.traefik.service=api@internal"
        - "traefik.http.routers.traefik.tls=true"
        - "traefik.http.services.traefik.loadbalancer.server.port=8080"
        - "traefik.docker.network=swarm"
      placement:
        constraints: [node.role==manager]

traefik.yml

providers:
  file:
    directory: /etc/traefik
    filename: dynamic_conf.yml
    watch: true

dynamic_conf.yml

tls:
  certificates:
    - certFile: /etc/traefik/certs/wildcard-cert.pem
      keyFile: /etc/traefik/certs/wildcard-key.pem

and the logs show me nothing. just one entry:

time="2019-09-27T17:29:42Z" level=info msg="Configuration loaded from file: /etc/traefik/traefik.yml"

what i'm seeing is that I cannot connect with https at all, and http throws a 404 on the dashboard url.

    command: --providers.docker \
      --providers.docker.swarmMode \
      --providers.docker.exposedByDefault=false \
      --providers.docker.domain=${URLSLUG:-dev}.domain.local \
      --providers.docker.watch \
      --entryPoints.web.address=:80 \
      --entryPoints.websecure.address=:443 \
      --log.level=DEBUG \
      --providers.file.filename=dynamic_conf.yml

and remove target: /etc/traefik/traefik.yml

There are three different, mutually exclusive (e.g. you can use only one at the same time), ways to define static configuration options in Traefik:

Thanks, I have made this change and I understand the configs now - I thought they were mutually exclusive on a property level. Ok, so with that change in place the service logs this:

time="2019-09-27T18:27:38Z" level=info msg="Configuration loaded from flags."

the traefik config now looks like:

    command: --providers.docker \
      --providers.docker.swarmMode \
      --providers.docker.exposedByDefault=false \
      --providers.docker.domain=${URLSLUG:-dev}.domain.local \
      --providers.docker.watch \
      --entryPoints.web.address=:80 \
      --entryPoints.websecure.address=:443 \
      --log.level=DEBUG \
      --providers.file.filename=dynamic_conf.yml

and I removed the static yml from the compose. Still nothing though. How do I get it to log more?

-log.level=DEBUG spits out more on load. If all you seeing is that line above you quoted, you are running with the defaul log level and not DEBUG. It suggests that you applied your configuration in one place but looking for logs in another, or that you applied the configuration incorrectly.

I got it working. All I did was convert the flags to a yml file. Thanks for the assistance.