Hello, I am using traefik 2.4.2 based on Docker Compose.
Here my docker-compose.yml file from traefik-v2 (2.4.2). It's path is ~/daten/traefik with a subdir
data
### Traefik v2.3.7
### docker-compose.yml
##START
version: '3'
services:
traefik:
#image: traefik:v2.3
#image: traefik:v2.3.7
image: traefik:v2.4.2
container_name: traefik-v2
restart: always
networks:
- internet
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- $PWD/data/traefik.yml:/traefik.yml:ro
- $PWD/data/middleware.yml:/middleware.yml:ro
- $PWD/data/.htpasswd:/.htpasswd:ro
- $PWD/data/acme.json:/acme.json
- /var/log/traefik.log:/traefik.log
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik.fqdn.tld`)"
- "traefik.http.middlewares.traefik-auth.basicauth.usersfile=.htpasswd"
- "traefik.http.routers.traefik.middlewares=https-redirect@file"
- "traefik.http.routers.traefik-sec.entrypoints=https"
- "traefik.http.routers.traefik-sec.rule=Host(`traefik.fqdn.tld`)"
- "traefik.http.routers.traefik-sec.middlewares=traefik-auth"
- "traefik.http.routers.traefik-sec.tls=true"
- "traefik.http.routers.traefik-sec.tls.options=myTLSOptions@file"
- "traefik.http.routers.traefik-sec.tls.certresolver=le"
- "traefik.http.routers.traefik-sec.service=api@internal"
networks:
internet:
external: true
#intranet:
#external: true
##EOF
In the data subdir there is my
- .htpasswd
- middelware.yml
- traefik.yml
- acme.json
So far all is well, I can then log in to the traefik website with username and password (upstream).
And now comes my problem
Now I have among other things a 2nd website (netdata) where I also want to prefix a login, but with a different username and password.
Here the docker-compose.yml:
Version: "3"
services:
netdata:
image: netdata/netdata
container_name: netdata
hostname: netdata.fqdn.tld
ports:
- 19999:19999
restart: always
cap_add:
- SYS_PTRACE
labels:
- "traefik.enable=true"
- "traefik.http.routers.netdata.entrypoints=http"
- "traefik.http.routers.netdata.rule=Host(`netdata.fqdn.tld`)"
- "traefik.http.middlewares.netdata-auth.basicauth.usersfile=.htpasswd"
- "traefik.http.routers.netdata.middlewares=https-redirect@file"
- "traefik.http.routers.netdata-sec.entrypoints=https"
- "traefik.http.routers.netdata-sec.middlewares=default-headers@file"
- "traefik.http.routers.netdata-sec.rule=Host(`netdata.fqdn.tld`)"
- "traefik.http.routers.netdata-sec.middlewares=netdata-auth"
- "traefik.http.routers.netdata-sec.tls=true"
- "traefik.http.routers.netdata-sec.tls.options=myTLSOptions@file"
- "traefik.http.routers.netdata-sec.tls.certresolver=le"
security_opt:
- apparmor:unconfined
networks:
- intranet
- internet
volumes:
- ./netdataconfig/netdata:/etc/netdata:ro
- netdatalib:/var/lib/netdata
- netdatacache:/var/cache/netdata
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /etc/os-release:/host/etc/os-release:ro
- $PWD/data/.htpasswd:/.htpasswd:ro
volumes:
netdatalib:
netdatacache:
networks:
intranet:
external: true
internet:
external: true
In that data subdir, there is only one file, the
- .htpasswd
I now have the problem that after I restarted all docker containers, the login from netdata pulls the .htpasswd from traefik.
Somewhere I have misconfigured something and hope you find the error. Thanks