Skip to content

Instantly share code, notes, and snippets.

@efossas
Created August 19, 2018 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efossas/6c26a86f0d02f0d2ae10b92686016c95 to your computer and use it in GitHub Desktop.
Save efossas/6c26a86f0d02f0d2ae10b92686016c95 to your computer and use it in GitHub Desktop.
traefik.toml
# enable logging on the debug level
logLevel = "DEBUG"
# log Traefik related stuff. It defaults to logging to stdout
# to view logs, run the command: docker logs traefik
[traefikLog]
# log requests. It defaults to logging to stdout
# the filters are for logging only requests that get certain http status codes, in this case we log everything
[accessLog]
[accessLog.filters]
statusCodes = ["0-600"]
# define entry points
[entryPoints]
# define entry point 'http' to accept connections on port 80
# the name of the entry point can be whatever you want, like entryPoints.WHATEVER
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
# define the certificates to use for TLS on this entry point
[entryPoints.https.tls]
# these self-signed certificates were generated using the gencert.sh script, which uses openssl
[[entryPoints.https.tls.certificates]]
certFile = "/ssl/crud.crt"
keyFile = "/ssl/crud.key"
# define the entry point that will be used for the traefik web console
[entryPoints.traefik]
address=":8080"
# use BASIC AUTH to password protect this page
[entryPoints.traefik.auth]
# you can generate a user + password with the Apache command (part of the apache2-utils package): htpasswd -nbB USER PASSWORD
# the user password here is 'admin' 'default'
[entryPoints.traefik.auth.basic]
users = ["admin:$2y$05$5lDlnFzA6TbdzLNd8fY8MOgR3TJwVOZIatEfxvXEj1o6cvvDgfU62"]
# enable the traefik web console and tell it to accept connections from the "treafik" entry point port 8080
[api]
entrypoint="traefik"
# in order to Traefik with Docker, we must include "[docker]". https://docs.traefik.io/configuration/backends/docker/
[docker]
# this config tells Traefik to auto update configuration when we update Docker Compose
# for example, if our stack is running, then when we change docker-compose.yml and run: docker-compose up
# docker will update our stack and Traefik will update as well if labels were changed
watch = true
# this config tell Traefik only to watch containers that have the label: traefik.enable=true
exposedbydefault = false
# this config tells Traefik what the default domain it will be accepting connections for
# you can work with multiple domains though by setting the 'traefik.domain' label on a container
domain = "docker.localhost"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment