Docker compose: Unable to reach seq running behind traefik #1446
-
Hi! I apologize in advance if this question is out of scope for this discussion forum, but I'm hoping that someone here has expertise with both traefik + seq and is able to point me in the right direction :) I'm currently trying to set up a small ASP.NET Core web application using docker compose. I want to use Seq to capture the log output from the various services, unfortunately I'm unable to reach the Seq UI. I'm suspecting that maybe certain env variables ( EDIT: I tried to set: docker-compose.yml for localhostservices:
traefik:
image: traefik:2.6
container_name: traefik
restart: unless-stopped
command:
- "--providers.docker=true"
- "--api.dashboard=true"
- "--log.level=DEBUG"
- "--api.debug=true"
- "--entrypoints.web.address=:80"
ports:
- 80:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=web"
- "traefik.http.routers.traefik.service=api@internal"
- 'traefik.http.routers.traefik.middlewares=strip'
- 'traefik.http.middlewares.strip.stripprefix.prefixes=/traefik'
# Dashboard
- "traefik.http.routers.dashboard.rule=Host(`localhost`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
whoami:
image: traefik/whoami
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`localhost`) && PathPrefix(`/whoami`)"
- "traefik.http.routers.whoami.entrypoints=web"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
seq:
image: datalust/seq:latest
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
SEQ_DIAGNOSTICS_INTERNALLOGGINGLEVEL: "Debug"
labels:
- "traefik.enable=true"
- "traefik.http.routers.seq.rule=Host(`localhost`) && PathPrefix(`/seq`)"
- "traefik.http.routers.seq.entrypoints=web"
- "traefik.http.services.seq.loadbalancer.server.port=80"
volumes:
- ./seq_data:/data
ports:
- "5341:5341"
- "8084:80" docker-compose.ymlservices:
traefik:
image: traefik:2.6
container_name: traefik
restart: unless-stopped
command:
# Tell Traefik to discover containers using the Docker API
- --providers.docker=true
# Enable the Trafik dashboard
- --api.dashboard=true
# Log to stdout
- "--log.level=DEBUG"
- "--api.debug=true"
# Set up LetsEncrypt
- --certificatesresolvers.letsencrypt.acme.dnschallenge=true
- --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.letsencrypt.acme.email=<snip>
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
# Set up an insecure listener that redirects all traffic to TLS
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.websecure.address=:443
# Set up the TLS configuration for our websecure listener
- --entrypoints.websecure.http.tls=true
- --entrypoints.websecure.http.tls.certResolver=letsencrypt
- --entrypoints.websecure.http.tls.domains[0].main=staging.example.com
- --entrypoints.websecure.http.tls.domains[0].sans=*.staging.example.com
environment:
- CLOUDFLARE_EMAIL=<snip>
- CLOUDFLARE_DNS_API_TOKEN=<snip>
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./letsencrypt:/letsencrypt
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
- "traefik.http.routers.traefik.service=api@internal"
- 'traefik.http.routers.traefik.middlewares=strip'
- 'traefik.http.middlewares.strip.stripprefix.prefixes=/traefik'
# Dashboard
- "traefik.http.routers.dashboard.rule=Host(`staging.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=<snip>"
whoami:
image: traefik/whoami
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`staging.example.com`) && PathPrefix(`/whoami`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=letsencrypt"
- "traefik.http.routers.whoami.tls=true"
# This line shows how to explictly set the port that traefik forwards requests to
- "traefik.http.services.whoami.loadbalancer.server.port=80"
seq:
image: datalust/seq:latest
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
SEQ_DIAGNOSTICS_INTERNALLOGGINGLEVEL: "Debug"
labels:
- "traefik.enable=true"
- "traefik.http.routers.seq.rule=Host(`staging.example.com`) && PathPrefix(`/seq`)"
- "traefik.http.routers.seq.entrypoints=websecure"
- "traefik.http.routers.seq.tls.certresolver=letsencrypt"
- "traefik.http.routers.seq.tls=true"
- "traefik.http.services.seq.loadbalancer.server.port=80"
volumes:
- ./seq_data:/data
ports:
- "5341:5341"
- "8084:80" As you can see, I also included an instance of the When I navigate to Opening a shell on the host and running:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi! I've managed to get as far as having traefik serve Seq in your compose file by adding the strip-prefix middleware, and seq:
image: datalust/seq:latest
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
SEQ_DIAGNOSTICS_INTERNALLOGGINGLEVEL: "Debug"
SEQ_API_CANONICALURI: "http://localhost/seq"
labels:
- "traefik.enable=true"
- "traefik.http.routers.seq.rule=Host(`localhost`) && PathPrefix(`/seq`)"
- "traefik.http.middlewares.autodetect.contenttype.autodetect=false"
- "traefik.http.middlewares.strip-seq.stripprefix.prefixes=/seq"
- "traefik.http.routers.seq.entrypoints=web"
- "traefik.http.routers.seq.middlewares=strip-seq,autodetect"
- "traefik.http.services.seq.loadbalancer.server.port=80"
volumes:
- ./seq_data:/data
ports:
- "5341:5341"
- "8084:80" However, I'm unable to figure out how to turn off traefik's broken content-type autodetection; you can see my attempts above, based on https://doc.traefik.io/traefik/middlewares/http/contenttype/ - probably just my lack of traefik knowledge hitting me, here. The result is that the UI is served, but subsequent requests fail due to mismatched content types. Would be great if you can spot what's going wrong - crossing my fingers :-) |
Beta Was this translation helpful? Give feedback.
Hi!
I've managed to get as far as having traefik serve Seq in your compose file by adding the strip-prefix middleware, and
SEQ_API_CANONICALURI
.