Created
May 23, 2020 19:32
-
-
Save grofit/34c68dfa836eb351815edede5fc71f2f to your computer and use it in GitHub Desktop.
Setting up Traefik 2 dashboard with basic auth, this is the same as my basic traefik 2 setup but with user auth from a file, you can see the original one here https://gist.github.com/grofit/e9a94ca02ba31ed1db9f88104f81c502
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
services: | |
traefik: | |
image: "traefik:v2.2" | |
container_name: "traefik" | |
ports: | |
- "80:80" | |
- "443:443" | |
- "8080:8080" | |
volumes: | |
- "/var/run/docker.sock:/var/run/docker.sock:ro" | |
- "/traefik.yml:/traefik.yml:ro" | |
- "/user-credentials:/user-credentials:ro" # Added some user credentials | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.api.service=api@internal" | |
- "traefik.http.routers.api.entrypoints=api" | |
- "traefik.http.routers.api.rule=Host(`localhost`)" | |
- "traefik.http.routers.api.middlewares=auth" # Tell our route to use a middleware named `auth` | |
- "traefik.http.middlewares.auth.basicauth.usersfile=/user-credentials" # Setup the `auth` middleware to be basicauth that takes a file for users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log: | |
level: INFO | |
api: | |
dashboard: true | |
entryPoints: | |
http: | |
address: ":80" | |
api: | |
address: ":8080" | |
providers: | |
docker: | |
endpoint: "unix:///var/run/docker.sock" | |
exposedByDefault: false | |
watch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
admin:$2y$10$uFGdAIp/0EEUegJjqF55AOc79.8Rv2TSnsO2BLN7uUm0g.BCx4JsW | |
someone:$Ay$10$uFGdAIp/0EEUegJjqF55AOc79.8Rv2TSnsO2BLN7uUm0g.BFx4JsW |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment