From 1513890bdc80e58004c713852d299e79159547a3 Mon Sep 17 00:00:00 2001 From: 1-h Date: Tue, 3 Sep 2024 12:55:25 +0800 Subject: [PATCH] traefik.http.routers.dashboard.middlewares=test-auth --- compose.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/compose.yml b/compose.yml index 5bcb7e9..15d68d0 100644 --- a/compose.yml +++ b/compose.yml @@ -10,7 +10,11 @@ services: # The official v3 Traefik docker image image: traefik:v3.1 command: + # docker run traefik:v3.1 --help # Enables the web UI and tells Traefik to listen to docker + - --providers.docker.exposedbydefault=false + - --log.level=DEBUG + - --api.insecure=true - --providers.docker @@ -23,6 +27,26 @@ services: # used during the challenge - --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web + + # Declaring the user list + # + # Note: when used in docker-compose.yml all dollar signs in the hash need to be doubled for escaping. + # To create user:password pair, it's possible to use this command: + # + # + # Also note that dollar signs should NOT be doubled when they not evaluated (e.g. Ansible docker_container module). + labels: + # https://doc.traefik.io/traefik/middlewares/http/basicauth/ + # https://community.traefik.io/t/impossible-to-get-basic-auth-for-dashboard/5075/3 + # lumxmTdz4g9s2e37 + - "traefik.enable=true" + - "traefik.http.routers.dashboard.rule=Host(`dashboard.traefik-example.oo1.dev`)" + - "traefik.http.routers.dashboard.tls=true" + - "traefik.http.routers.dashboard.tls.certresolver=myresolver" + + - "traefik.http.routers.dashboard.service=api@internal" + - "traefik.http.routers.dashboard.middlewares=test-auth" # echo $(htpasswd -nB user) | sed -e s/\\$/\\$\\$/g + - "traefik.http.middlewares.test-auth.basicauth.users=user:$$2y$$05$$n8dGD49ATPyEYlfkpD6xpevszqPUrjhB3cdrmuGOVxziLsEN01IJa" ports: # The HTTP port - "80:80"