Skip to content

traefik + ssl everywhere + swarm mode + docker-compose.yml #125

@jagbarcelo

Description

@jagbarcelo

I've been following your step-by-step instructions on how to install traefik + portainer through Put Wildcard Certificates and SSL on EVERYTHING and also your related video https://www.youtube.com/watch?v=liV3c9m_OX8

Everything went fine but now I'm struggling to make it work after having created a Swarm with 3 Raspberry Pi's: I want traefik to work as proxy for containers running on any node of the swarm/cluster.

According to Traefik documentation, for it to work in a Swarm, it must be deployed on a master node (no problem since my 3 nodes are managers). Thus, I included this in the docker-compose.yml:

    deploy:
      #mode: global     #Should it be installed on every manager node or will it suffice with just one?
      placement:
        constraints:
          - node.role == manager

I've also created a new overlay network (instead of the regular bridge mode network you used, called proxy) and modify the docker-compose accordingly.

Besides, it seems that the labels must be nested one level deeper, under the deploy tag, thus:

[...]
    deploy:
      placement:
        constraints:
          - node.role == manager
      labels:
        - traefik.enable=true
        - traefik.docker.network=proxy-overlay
        [more labels here]
networks:
  proxy-overlay:
    external: true

I've also modified the data/traefiik.yml file to include:

providers:
  docker:
    swarmMode: true
    endpoint: "unix:///var/run/docker.sock"
    watch: true
    exposedByDefault: false

I'm using your file as template, tried every possible combination but I still cannot make it work:

https://github.com/techno-tim/techno-tim.github.io/blob/ef6b8c9b7896f1b6bcaaa3e6af6100436b9c76f7/reference_files/traefik-portainer-ssl/traefik/docker-compose.yml#L1-L45

Everytime, every possible change that has come to my mind leads me to a 404 File not found error page when the docker-compose file is deployed.

Can you shed some light on what changes would be needed in your template to make it work on a swarm mode cluster?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions