Skip to content

Commit

Permalink
add docker-compose for traefik:2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
abmruman committed Feb 5, 2020
1 parent e7c24a0 commit 167815e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: "3.5"

services:
traefik:
container_name: traefik
image: traefik:2.1
command:
- --entryPoints.web.address=:80
- --entryPoints.websecure.address=:443
- --log.level=${LOG_LEVEL}
- --providers.docker
- --providers.docker.exposedbydefault=false
- --api
ports:
- "80:80"
- "443:443"
networks:
- web
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
traefik.enable: true

# redirection HTTP to HTTPS
traefik.http.routers.http_catchall.rule: hostregexp(`{host:.+}`)
traefik.http.routers.http_catchall.entrypoints: web
traefik.http.routers.http_catchall.middlewares: redirect

# dashboard
traefik.http.routers.traefik.rule: host(`${DASHBOARD_PREFIX}${HOST}`)
traefik.http.routers.traefik.entrypoints: websecure
traefik.http.routers.traefik.service: api@internal
traefik.http.routers.traefik.tls: true

# middlewares
traefik.http.middlewares.redirect.redirectscheme.scheme: https

networks:
web:
external: true
6 changes: 6 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Environment variables for docker-compose.yml

LOG_LEVEL=DEBUG
HOST=localhost
# subdomain for dashboard. DONT forget the dot (.) at the end
DASHBOARD_PREFIX=monitor.

0 comments on commit 167815e

Please sign in to comment.