tiredofit / docker-traefik-cloudflare-companion

Automatically Create CNAME records for containers served by Traefik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

update readme for inconsistent TRAEFIK_FILTER vs TRAEFIK_CONSTRAINT

BasicWalker opened this issue · comments

Description of the feature
The readme has inconsistent documentation and examples , specifically for TRAEFIK_FILTER_LABEL, and TRAEFIK_LABEL.

the example under
https://github.com/tiredofit/docker-traefik-cloudflare-companion/blob/main/README.md#by-label-docker-endpoint-only
shows the use of TRAEFIK_CONSTRAINT_LABEL=traefik.constraint and TRAEFIK_CONSTRAINT=proxy-public

where it should be TRAEFIK_CONSTRAINTFILTER_LABEL

Benftits of feature
I had to spend a bunch of time debugging and looking through the code to find what was happening when following the example in the readme which is incorrect. updating the readme would provide more clarity.

Additional context
here is a working example of the docker compose file that i have working if it would be beneficial for showcasing this feature

docker-compose.yml

services:
  # Cloudflare-Companion - Automatic CNAME DNS Creation
  cf-companion:
    image: tiredofit/traefik-cloudflare-companion:latest
    container_name: cf-companion
    restart: always
    profiles: ["core", "all", "network"]
    networks:
      - socket_proxy
    # volumes:
    #   - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - TIMEZONE=$TZ
      - DOCKER_HOST=tcp://socket-proxy:2375
      - TRAEFIK_VERSION=2
      - CF_EMAIL=$CLOUDFLARE_EMAIL
      - CF_TOKEN_FILE=/var/run/cf_token
      - TARGET_DOMAIN=ddns.$DOMAINNAME  # ddns A record for dynamic public IP
      - DOMAIN1=$DOMAINNAME
      - DOMAIN1_ZONE_ID=$CLOUDFLARE_ZONE_ID # Copy from Cloudflare Overview page
      - DOMAIN1_PROXIED=TRUE
      - TRAEFIK_FILTER_LABEL=traefik.constraint
      - TRAEFIK_FILTER=web  # only externally expose docker services with "traefik.constraint=web" label
      - LOG_TYPE=BOTH
      - LOG_LEVEL=DEBUG
      - DRY_RUN=TRUE  # test new configs
    secrets:
      - cf_token
  web-service:
    image: 
    container_name:
    restart: unless-stopped
    profiles: []
    networks:
      - reverse_proxy
    labels:
      - "traefik.enable=true"
      # HTTP Services
      - "traefik.http.services.web-service-svc.loadbalancer.server.port=####"
      - "traefik.http.routers.web-service-secure.service=web-service-svc"
      # HTTP Routers
      - "traefik.http.routers.web-service-secure.entrypoints=internalsecure"
      - "traefik.http.routers.web-service-secure.rule=Host(`web-service.$DOMAINNAME`)"
      # External routing
      - "traefik.constraint=web"  # auto create CNAME records available publicly with Cloudflare-Companion
      - "traefik.http.routers.web-service-web-secure.service=web-service-svc"
      - "traefik.http.routers.web-service-web-secure.entrypoints=websecure"
      - "traefik.http.routers.web-service-web-secure.rule=Host(`web-service.$DOMAINNAME`) || Host(`alias.$DOMAINNAME`)"  # multiple CNAME records