Hi, I had initially set up a quick poc in docker-compose using traefik 2.10. The little bit that i had configured was working. I'm not trying to break it out into dynamic file based config. There are two things that seem really off. Any help appreciated
-
Log format. This was set to json in docker-compose, but i change dit to common. To confirm there is no reference to json in any of the configs or in compose, but the logging output seems to be mixed. Sometimes common, and then randomly it can switch back to json. Any thoughts?
-
I'm having trouble with breaking the config into multiple pieces. I've tried several variations of how/where to define the middlewares, and i've tried calling them with and without "@file" suffix. No matter what,I keep getting errors that that middlewhere is not found.
# compose
version: '2'
networks:
traefik:
external: true
services:
traefik:
image: traefik:v2.11
container_name: lb
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/home/me/.edgerc:/.edgerc:ro"
- "./letsencrypt:/letsencrypt"
- "./dynamic:/etc/traefik/dynamic:ro"
command:
- --api.insecure
- --providers.file.directory=/etc/traefik/dynamic
- --providers.docker
- --providers.docker.network=traefik
labels:
- "traefik.http.routers.api.rule=Host(`localhost.my.com`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.tls.certresolver=letsencrypt-akamai"
networks:
- traefik
## 00-config-other.yaml
log:
level: "INFO"
format: "common"
## 10-config-environment.yaml
environment:
- "AKAMAI_EDGERC=/.edgerc"
## 10-middleware-test-header.yaml
middlewares:
headers:
customRequestHeaders:
Test-Header: "yeah"
## 10-middleware.yaml
middlewares:
redirect-to-https:
redirectScheme:
scheme: "https"
permanent: true
## 20-certificateresolver.yaml
certificatesresolvers:
letsencrypt-akamai:
acme:
storage: "/letsencrypt/acme.json"
email: "me@my.com"
caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
dnsChallenge:
## 50-entrypoints.yaml
entryPoints:
web:
address: "80"
webssl:
address: "443"
## 70-site_pw.insideamp.com.yaml
http:
routers:
pw-router:
tls:
certresolver: "letsencrypt-akamai"
rule: "Host(`pw.my.com`)"
service: "pw-service"
entryPoints:
- "web"
- "websecure"
middlewares:
- "redirect-to-https"
- "10-middleware-test-header"
services:
pw-service:
loadBalancer:
servers:
- url: "http://test.my.net"