Closed lukeb2e closed 5 years ago
duplicate of #5363
I dont think this is a duplicate.
I just followed the configuration example posted in the linked issue and changed my docker-compose config accordingly. The only change for now is that traefik seems to have stopped to continuously call itself. The dashboard is still not working unless I set the option insecure (- "--api.insecure=true"
)
Is there an option to dump the currently running config of traefik? That way it would be possible to compare the two configurations directly.
version: '2'
services:
traefik:
image: "traefik:latest"
restart: always
command:
- "--log.level=DEBUG"
- "--api=true"
- "--api.dashboard=true"
- "--ping=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.traefik.address=:8080"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.entryPoints=traefik"
#- "traefik.http.routers.dashboard.rule=PathPrefix(`/dashboard`) || PathPrefix(`/api`)"
- "traefik.http.routers.dashboard.rule=Host(`traefik.localhost`) && PathPrefix(`/dashboard`)"
- "treafik.http.routers.dashboard.service=api@internal"
#- "traefik.http.routers.dashboard.middlewares=dashboard-auth"
#- "traefik.http.middlewares.dashboard-auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/"
ports:
- "80:80"
- "8088:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
curl -H "Host: traefik.localhost" localhost:8088/dashboard/
404 page not found
traefik_1 | time="2019-09-23T08:47:36Z" level=info msg="Configuration loaded from flags."
traefik_1 | time="2019-09-23T08:47:36Z" level=info msg="Traefik version 2.0.0 built on 2019-09-16T17:35:17Z"
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Static configuration loaded {\"global\":{\"checkNewVersion\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"traefik\":{\"address\":\":8080\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}},\"web\":{\"address\":\":80\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":10000000000},\"respondingTimeouts\":{\"idleTimeout\":180000000000}},\"forwardedHeaders\":{}}},\"providers\":{\"providersThrottleDuration\":2000000000,\"docker\":{\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}},\"api\":{\"dashboard\":true},\"ping\":{\"entryPoint\":\"traefik\"},\"log\":{\"level\":\"DEBUG\",\"format\":\"common\"}}"
traefik_1 | time="2019-09-23T08:47:36Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v2.0/contributing/data-collection/\n"
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="No default certificate, generating one"
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Start TCP Server" entryPointName=traefik
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Start TCP Server" entryPointName=web
traefik_1 | time="2019-09-23T08:47:36Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"
traefik_1 | time="2019-09-23T08:47:36Z" level=info msg="Starting provider *docker.Provider {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmModeRefreshSeconds\":15000000000}"
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Provider connection established with docker 19.03.1 (API 1.40)" providerName=docker
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Filtering disabled container" providerName=docker container=/magical_mendeleev-9eada1a84cff7914368564b30445b133db6d588c2dec3031082611afff0c4dbe
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Configuration received from provider docker: {\"http\":{\"routers\":{\"dashboard\":{\"entryPoints\":[\"traefik\"],\"service\":\"traefik_traefik\",\"rule\":\"Host(`traefik.localhost`) \\u0026\\u0026 PathPrefix(`/dashboard`)\"}},\"services\":{\"traefik_traefik\":{\"loadBalancer\":{\"servers\":[{\"url\":\"http://172.20.0.2:80\"}],\"passHostHeader\":true}}}},\"tcp\":{}}" providerName=docker
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Creating middleware" serviceName=traefik_traefik middlewareType=Pipelining middlewareName=pipelining entryPointName=traefik routerName=dashboard@docker
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Creating load-balancer" entryPointName=traefik routerName=dashboard@docker serviceName=traefik_traefik
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Creating server 0 http://172.20.0.2:80" entryPointName=traefik routerName=dashboard@docker serviceName=traefik_traefik serverName=0
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Added outgoing tracing middleware traefik_traefik" entryPointName=traefik routerName=dashboard@docker middlewareName=tracing middlewareType=TracingForwarder
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="Creating middleware" middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=traefik
traefik_1 | time="2019-09-23T08:47:36Z" level=debug msg="No default certificate, generating one"
traefik_1 | time="2019-09-23T08:48:06Z" level=debug msg="vulcand/oxy/roundrobin/rr: begin ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/dashboard/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.60.0\"],\"X-Forwarded-Host\":[\"traefik.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"8545580b04da\"],\"X-Real-Ip\":[\"172.20.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"traefik.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"172.20.0.1:45366\",\"RequestURI\":\"/dashboard/\",\"TLS\":null}"
traefik_1 | time="2019-09-23T08:48:06Z" level=debug msg="vulcand/oxy/roundrobin/rr: Forwarding this request to URL" ForwardURL="http://172.20.0.2:80" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/dashboard/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.60.0\"],\"X-Forwarded-Host\":[\"traefik.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"8545580b04da\"],\"X-Real-Ip\":[\"172.20.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"traefik.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"172.20.0.1:45366\",\"RequestURI\":\"/dashboard/\",\"TLS\":null}"
traefik_1 | time="2019-09-23T08:48:06Z" level=debug msg="vulcand/oxy/roundrobin/rr: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/dashboard/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/1.1\",\"ProtoMajor\":1,\"ProtoMinor\":1,\"Header\":{\"Accept\":[\"*/*\"],\"User-Agent\":[\"curl/7.60.0\"],\"X-Forwarded-Host\":[\"traefik.localhost\"],\"X-Forwarded-Port\":[\"80\"],\"X-Forwarded-Proto\":[\"http\"],\"X-Forwarded-Server\":[\"8545580b04da\"],\"X-Real-Ip\":[\"172.20.0.1\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"traefik.localhost\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"172.20.0.1:45366\",\"RequestURI\":\"/dashboard/\",\"TLS\":null}"
Could you join our community forum https://community.containo.us/, thanks.
For anyone else wondering about the correct syntax and finding this issue:
version: '2'
services:
traefik:
image: "traefik:latest"
restart: always
command:
- "--log.level=DEBUG"
- "--api=true"
- "--api.dashboard=true"
- "--ping=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.http.address=:80"
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.entryPoints=traefik"
- "traefik.http.routers.api.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.middlewares=api-auth"
- "traefik.http.middlewares.api-auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/" # test:test
ports:
- "80:80"
- "8088:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
it doesn't work for me. could you help me?
docker stack deploy -c <(docker-compose -f docker-swarm.yml config) traefik
version: "3.7"
services:
traefik:
image: traefik:v2.0.0
ports:
- 80:80
- 443:443
# - 8080
networks:
- net # traefik_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ../../dev-ops-repo/traefik/acme:/etc/traefik/acme
# environment:
# - TZ=${TIME_ZONE:-Asia/Shanghai}
command:
# - "--log.level=DEBUG"
- "--api=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.swarmmode=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.letsencrypt.acme.email=${TRAEFIK_ACME_EMAIL:-traefik@traefik.com}"
# - "--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme/acme-v2.json"
- "--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme/acme-staging-v2.json"
deploy:
mode: global
placement:
constraints:
- node.role == manager
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_net"
# - "traefik.http.services.dashboard.loadbalancer.server.port=8080"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.rule=Host(`traefik.${SERVER_DOMAIN:-localhost}`)"
- "traefik.http.routers.traefik.entrypoints=web"
- "traefik.http.routers.traefik.middlewares=redirecttls"
- "traefik.http.middlewares.redirecttls.redirectscheme.scheme=https"
- "traefik.http.routers.traefiktls.service=api@internal"
- "traefik.http.routers.traefiktls.rule=Host(`traefik.${SERVER_DOMAIN:-localhost}`)"
- "traefik.http.routers.traefiktls.entrypoints=websecure"
- "traefik.http.routers.traefiktls.tls.certresolver=letsencrypt"
- "traefik.http.routers.traefiktls.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=${TRAEFIK_AUTH_BASIC}"
networks:
# docker stack deploy -c <(docker-compose -f docker-swarm.yml config) traefik
# Creating network traefik_net
net:
driver: overlay
attachable: true
Could you join our community forum https://community.containo.us/, thanks.
I can't access this website in chinese.
Hello @v7lin, when you say it doesn't work for me. could you help me?
,
can you explain what do you mean by "it does not work"? Do you have a curl command to share?
I can't access this website in chinese.
Hi @v7lin in order to improve our community forum, we would like to understand better the issue you face with the forum:
i use chrome visit https://community.containo.us/. all request was passed, but https://sjc3.discourse-cdn.com/standard11/stylesheets/desktop_15_cc19ae8ada0359ea735ebfb48a8fd4aff3afdcf9.css?__ws=community.containo.us is not accessed.
@v7lin thanks for the feedback, we'll try our best to make it available in your area to help you.
I cannot access localhost/dashboard, it says not found, already tried everything from above. Can someone help me?
version: "3.3"
services:
traefik:
image: "traefik:latest"
command:
# dashboard
- "--api=true"
- "--api.dashboard=true"
# log level
- "--log.level=DEBUG"
# static config
- "--entryPoints.web.address=:80"
# providers
- "--providers.docker=true"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--providers.docker.exposedByDefault=false"
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
# dashboard pass= test:test
- "traefik.http.routers.api.rule=Host(`localhost`) && Path(`/dashboard`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.middlewares=api-auth"
- "traefik.http.middlewares.auth.basicauth.users=test:$apr1$PBxxGZn5$AFdVgwdtkLvuowyzKZmTK0"
Hi @finzzz , do you mind switching to the community forum, where support from community (including maintainers) is done? We want to use the issues in Github for bug or feature requests.
=> btw, the solution you are looking for is because the dashboard requires both /dashboard
and /api
URIs to be accessed. The rule of your router is only catching /dashboard
as path prefix, but not /api
. Either add it with the logical rules you can check at on https://docs.traefik.io/operations/api/#configuration, or easier: only match on the host.
@v7lin , it looks like the issue is related to Discourse itself: https://meta.discourse.org/t/difficulty-loading-meta-from-china-due-to-cdn-being-blocked/95923/9.
However we are not sure about what is causing the issue as the only tools we have to try from Europe reports everything should work:
Can you share with us some screenshots of chrome developer console so we can see the kind of error and decide which direction to take please?
Do you want to request a feature or report a bug?
Bug
Did you try using a 1.7.x configuration for the version 2.0?
What did you do?
I am following the configuration examples of the treafik 2.0 docs to setup a basic example of traefik. Currently I am unable to get the dashboard to work with the included examples as it seems to get stuck in a loop (see logs at end). It is working when I use the insecure flag. The configuration for the included container "web" is working without any issues.
I exposed the port 8080 to 8088 on my machine. The same thing happens if I try to access the endpoint via curl from inside the container.
What did you expect to see?
Access to dashboard over http://localhost:8088/dashboard/
What did you see instead?
Timeout after waiting for ~1min.
Output of
traefik version
: (What version of Traefik are you using?)What is your environment & configuration (arguments, toml, provider, platform, ...)?
I am running traefik via docker-compose.
If applicable, please paste the log output in DEBUG level (
--log.level=DEBUG
switch)If I try to access the url http://localhost:8088/dashboard/ the following lines are spammed in the log.