Hi, i have little problem to set-up correctly my yml file for traefik mailcow.
Can somebody help me please ?

I used this path for traefik: /home/archmatt/traefik
inside traefik folder is:

  • docker-compose.yml
  • data (Folder)
  • (Inside data folder) | acme.json
  • (Inside data folder) | config.yml
  • (Inside data folder) | traefik.yml

I am using wildcards (CLOUDFLARE), and create network called: proxy

Portainer path is: /home/archmatt/portainer
inside portainer folder is:

  • docker-compose.yml

Already set-up traefik, portainer, also redirect to another server works fine.
in portainer docker-compose.yml i just add labels:

labels:
      - "traefik.enable=true"
      - "traefik.http.routers.portainer.entrypoints=http"
      - "traefik.http.routers.portainer.rule=Host(`portainer.yourdomain.com`)"
      - "traefik.http.middlewares.portainer-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.portainer.middlewares=portainer-https-redirect"
      - "traefik.http.routers.portainer-secure.entrypoints=https"
      - "traefik.http.routers.portainer-secure.rule=Host(`portainer.yourdomain.com`)"
      - "traefik.http.routers.portainer-secure.tls=true"
      - "traefik.http.routers.portainer-secure.service=portainer"
      - "traefik.http.services.portainer.loadbalancer.server.port=9000"
      - "traefik.docker.network=proxy"

BUT: as documentation say in mailcow are stored /opt/mailcow-dockerized/
so i create it already, and edit mailcow.conf:

HTTP_PORT=10080
HTTP_BIND=127.0.0.1

HTTPS_PORT=10443
HTTPS_BIND=127.0.0.1

SKIP_LETS_ENCRYPT=y

then i created docker-compose.override.yml as it said in documentation:

version: '2.1'

services:
    nginx-mailcow:
      networks:
        # Add Traefik's network
        - proxy
      labels:
        - traefik.enable=true
        # Creates a router called "moo" for the container, and sets up a rule to link the container to certain rule,
        #   in this case, a Host rule with our MAILCOW_HOSTNAME var.
        - traefik.http.routers.moo.rule=Host(`${MAILCOW_HOSTNAME}`)
        # Enables tls over the router we created before.
        - traefik.http.routers.moo.tls=true
        # Specifies which kind of cert resolver we'll use, in this case le (Lets Encrypt).
        - traefik.http.routers.moo.tls.certresolver=le
        # Creates a service called "moo" for the container, and specifies which internal port of the container
        #   should traefik route the incoming data to.
        - traefik.http.services.moo.loadbalancer.server.port=${HTTP_PORT}
        # Specifies which entrypoint (external port) should traefik listen to, for this container.
        #   websecure being port 443, check the traefik.toml file liked above.
        - traefik.http.routers.moo.entrypoints=websecure
        # Make sure traefik uses the web network, not the mailcowdockerized_mailcow-network
        - traefik.docker.network=proxy

    certdumper:
        image: humenius/traefik-certs-dumper
    command: --restart-containers ${COMPOSE_PROJECT_NAME}-postfix-mailcow-1,${COMPOSE_PROJECT_NAME}-nginx-mailcow-1,${COMPOSE_PROJECT_NAME}-dovecot-mailcow-1
        network_mode: none
        volumes:
          # Mount the volume which contains Traefik's `acme.json' file
          #   Configure the external name in the volume definition
          - /home/archmatt/traefik/data/acme.json:/traefik:ro
          # Mount mailcow's SSL folder
          - ./data/assets/ssl/:/output:rw
          # Mount docker socket to restart containers
          - /var/run/docker.sock:/var/run/docker.sock:ro
        restart: always
        environment:
          # only change this, if you're using another domain for mailcow's web frontend compared to the standard config
          - DOMAIN=${MAILCOW_HOSTNAME}

networks:
  web:
    external: true
    # Name of the external network
    name: proxy

volumes:
  acme:
    external: true
    # Name of the external docker volume which contains Traefik's `acme.json' file
    name: proxy

and then when i put command for docker:

sudo docker compose up -d --force-recreate
#output:
yaml: line 29: mapping values are not allowed in this context

so how to fix it or should i change somehow config for override ?

  • So, thanks to everybody to help me out ! 😃 , yea i find solution 😛

    This is how should your docker-compose.override.yml looks like:

    version: '2.1'
    services:
      nginx-mailcow:
        expose:
          - "10080"
        networks:
          - proxy
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.nginx-mailcow.entrypoints=http"
          - "traefik.http.routers.nginx-mailcow.rule=HostRegexp(`{host:(autodiscover|autoconfig|webmail|mail|email).+}`)"
          - "traefik.http.middlewares.nginx-mailcow-https-redirect.redirectscheme.scheme=https"
          - "traefik.http.routers.nginx-mailcow.middlewares=nginx-mailcow-https-redirect"
          - "traefik.http.routers.nginx-mailcow-secure.entrypoints=https"
          - "traefik.http.routers.nginx-mailcow-secure.rule=Host(`mail.yourdomain.com`)" 
          - "traefik.http.routers.nginx-mailcow-secure.tls=true"
          - "traefik.http.routers.nginx-mailcow-secure.tls.certresolver=http"
          - "traefik.http.routers.nginx-mailcow-secure.service=nginx-mailcow"
          - "traefik.http.services.nginx-mailcow.loadbalancer.server.port=10080"
          - "traefik.docker.network=proxy"
      certdumper:
        image: humenius/traefik-certs-dumper
        container_name: traefik_certdumper
        network_mode: none
        command: --restart-containers mailcowdockerized_postfix-mailcow_1,mailcowdockerized_dovecot-mailcow_1
        volumes:
          - /home/archmatt/traefik/data:/traefik:ro
          - /var/run/docker.sock:/var/run/docker.sock:ro
          - ./data/assets/ssl:/output:rw
        environment:
          - DOMAIN=yourdomain.com
    networks:
      proxy:
        external: true

    and also in

    mailcow.conf

    one little more edit is:
    SKIP_CLAMD=y

    Thank to STACK-OVERFLOW COMMUNITY

So, thanks to everybody to help me out ! 😃 , yea i find solution 😛

This is how should your docker-compose.override.yml looks like:

version: '2.1'
services:
  nginx-mailcow:
    expose:
      - "10080"
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nginx-mailcow.entrypoints=http"
      - "traefik.http.routers.nginx-mailcow.rule=HostRegexp(`{host:(autodiscover|autoconfig|webmail|mail|email).+}`)"
      - "traefik.http.middlewares.nginx-mailcow-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.nginx-mailcow.middlewares=nginx-mailcow-https-redirect"
      - "traefik.http.routers.nginx-mailcow-secure.entrypoints=https"
      - "traefik.http.routers.nginx-mailcow-secure.rule=Host(`mail.yourdomain.com`)" 
      - "traefik.http.routers.nginx-mailcow-secure.tls=true"
      - "traefik.http.routers.nginx-mailcow-secure.tls.certresolver=http"
      - "traefik.http.routers.nginx-mailcow-secure.service=nginx-mailcow"
      - "traefik.http.services.nginx-mailcow.loadbalancer.server.port=10080"
      - "traefik.docker.network=proxy"
  certdumper:
    image: humenius/traefik-certs-dumper
    container_name: traefik_certdumper
    network_mode: none
    command: --restart-containers mailcowdockerized_postfix-mailcow_1,mailcowdockerized_dovecot-mailcow_1
    volumes:
      - /home/archmatt/traefik/data:/traefik:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./data/assets/ssl:/output:rw
    environment:
      - DOMAIN=yourdomain.com
networks:
  proxy:
    external: true

and also in

mailcow.conf

one little more edit is:
SKIP_CLAMD=y

Thank to Stack Overflow Icon STACK-OVERFLOW COMMUNITY

Have something to say?

Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

No one is typing