我在使用docker + rancher + traefik时遇到问题。
后端发现很好,它可以与2个牧场主机一起使用。但是当我在traefik后端托管我的网站的时候,我有很多io等待的docker和traefik日志会删除日志,如:
{{1}}
为什么我会这样?它每天都崩溃,无法弄清楚为什么x-forwarded-for是127.0.0.1。任何想法?
感谢
答案 0 :(得分:0)
这里有更多细节: 使用最新的docker-ce toml:
debug = true
logLevel = "ERROR"
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[web]
address = ":8080"
[docker]
[acme]
email = myemail@mydomain.com"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true
caServer = "https://acme-staging.api.letsencrypt.org/directory"
[acme.dnsChallenge]
provider = "ovh"
delayBeforeCheck = 0
dockcher-compose in rancher:
version: '2'
services:
proxy:
image: traefik:v1.5.1
ports:
- "443:443"
- "8080:8080"
- "80:80"
command: --web --accessLog --constraints=tag==internal --rancher --rancher.exposedbydefault=false --rancher.metadata=true --logLevel=DEBUG
volumes:
- /data/traefik/traefik.toml:/etc/traefik/traefik.toml
- /data/traefik/acme.json:/etc/traefik/acme/acme.json
- /var/run/docker.sock:/var/run/docker.sock
labels:
- "traefik.frontend.entryPoints=http,https"
- "io.rancher.container.agent.role: internal"
- "environment io.rancher.container.create_agent: true"
environment:
- OVH_ENDPOINT=ovh-eu
- OVH_APPLICATION_KEY=xxxx
- OVH_APPLICATION_SECRET=xxxx
- OVH_CONSUMER_KEY=xxx
mediawiki:
image: mediawiki:stable
volumes:
-
/data/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php
- /var/www/html/images/
labels:
- "traefik.frontend.entryPoints=http,https"
- "traefik.backend=mediawiki"
- "traefik.frontend.rule=Host:wiki.mydomain.com"
- "traefik.enable=true"
- "traefik.port=80"
- "traefik.tags=internal"
- "traefik.backend.loadbalancer.stickiness=true"
答案 1 :(得分:0)
我在我的toml中缺少重定向子句[entryPoints.http.redirect]
,这里是好的toml配置:
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entrypoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
非常感谢来自traefik支持的Idez;)