less static configuration, more variables
This commit is contained in:
parent
92f3d7bc79
commit
09f3ec9f70
@ -33,6 +33,7 @@ services:
|
|||||||
labels:
|
labels:
|
||||||
# expose Træfik using Træfik (dashboard)
|
# expose Træfik using Træfik (dashboard)
|
||||||
- traefik.enable=${TRAEFIK_ENABLED}
|
- traefik.enable=${TRAEFIK_ENABLED}
|
||||||
|
- traefik.docker.network=${TRAEFIK_NETWORK}
|
||||||
# configure a global whitelist for accessing the Træfik dashboard
|
# configure a global whitelist for accessing the Træfik dashboard
|
||||||
- traefik.http.middlewares.dashboard-whitelist.ipwhitelist.sourcerange=${TRAEFIK_DASHBOARD_WHITELIST}
|
- traefik.http.middlewares.dashboard-whitelist.ipwhitelist.sourcerange=${TRAEFIK_DASHBOARD_WHITELIST}
|
||||||
# configure a global middleware for redirecting HTTP to HTTPS
|
# configure a global middleware for redirecting HTTP to HTTPS
|
||||||
@ -44,18 +45,15 @@ services:
|
|||||||
- traefik.http.middlewares.hsts.headers.stsPreload=${TRAEFIK_STS_PRELOAD}
|
- traefik.http.middlewares.hsts.headers.stsPreload=${TRAEFIK_STS_PRELOAD}
|
||||||
### Section HTTP
|
### Section HTTP
|
||||||
- traefik.http.routers.http-${TRAEFIK_ROUTER}.entrypoints=http
|
- traefik.http.routers.http-${TRAEFIK_ROUTER}.entrypoints=http
|
||||||
# only some people can access the dashboard, hence protect it with it's whitelist
|
|
||||||
- traefik.http.routers.http-${TRAEFIK_ROUTER}.middlewares=dashboard-whitelist
|
|
||||||
# redirect Træfik dashboard to HTTPS only
|
# redirect Træfik dashboard to HTTPS only
|
||||||
- traefik.http.routers.http-${TRAEFIK_ROUTER}.middlewares=http-to-https
|
- traefik.http.routers.http-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_HTTP_MIDDLEWARES}
|
||||||
- traefik.http.routers.http-${TRAEFIK_ROUTER}.rule=Host(`${TRAEFIK_MATCHRULE}`)
|
- traefik.http.routers.http-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE}
|
||||||
- traefik.http.routers.http-${TRAEFIK_ROUTER}.service=api@internal
|
- traefik.http.routers.http-${TRAEFIK_ROUTER}.service=api@internal
|
||||||
### Section HTTPS
|
### Section HTTPS
|
||||||
- traefik.http.routers.https-${TRAEFIK_ROUTER}.entrypoints=https
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.entrypoints=https
|
||||||
# only some people can access the dashboard, hence protect it with it's whitelist (and add HSTS for security)
|
|
||||||
- traefik.http.routers.https-${TRAEFIK_ROUTER}.middlewares=hsts,dashboard-whitelist
|
|
||||||
# configure Træfik dashboard to be the exposed service
|
# configure Træfik dashboard to be the exposed service
|
||||||
- traefik.http.routers.https-${TRAEFIK_ROUTER}.rule=Host(`${TRAEFIK_MATCHRULE}`)
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_HTTPS_MIDDLEWARES}
|
||||||
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE}
|
||||||
- traefik.http.routers.https-${TRAEFIK_ROUTER}.service=api@internal
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.service=api@internal
|
||||||
# of course, enable TLS and it's certificate provider
|
# of course, enable TLS and it's certificate provider
|
||||||
- traefik.http.routers.https-${TRAEFIK_ROUTER}.tls=${TRAEFIK_TLSENABLED}
|
- traefik.http.routers.https-${TRAEFIK_ROUTER}.tls=${TRAEFIK_TLSENABLED}
|
||||||
@ -67,8 +65,8 @@ services:
|
|||||||
- 443:443
|
- 443:443
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
- ./config:/config:ro
|
- ${TRAEFIK_DYNAMIC}:/config:ro
|
||||||
- ./certs.json:/certs.json
|
- ${TRAEFIK_CERTFILE}:/certs.json
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
traefik:
|
traefik:
|
||||||
|
10
env.example
10
env.example
@ -1,11 +1,13 @@
|
|||||||
# General environment
|
# General environment
|
||||||
TRAEFIK_VERSION=2.4
|
TRAEFIK_VERSION=latest
|
||||||
TRAEFIK_CERTRESOLVER=letsencrypt
|
TRAEFIK_CERTRESOLVER=letsencrypt
|
||||||
TRAEFIK_DASHBOARD_WHITELIST=1.2.3.4/24
|
TRAEFIK_DASHBOARD_WHITELIST=1.2.3.4/24
|
||||||
TRAEFIK_ENABLED=true
|
TRAEFIK_ENABLED=true
|
||||||
TRAEFIK_NETWORK=traefik
|
TRAEFIK_NETWORK=traefik
|
||||||
TRAEFIK_MATCHRULE=traefik.mydomain.com
|
TRAEFIK_MATCHRULE=Host(`traefik.mydomain.com`)
|
||||||
TRAEFIK_ROUTER=traefik_mydomain_com
|
TRAEFIK_ROUTER=traefik_mydomain_com
|
||||||
|
TRAEFIK_HTTP_MIDDLEWARES=dashboard-whitelist,http-to-https
|
||||||
|
TRAEFIK_HTTPS_MIDDLEWARES=dashboard-whitelist,hsts
|
||||||
|
|
||||||
# Security
|
# Security
|
||||||
TRAEFIK_TLSENABLED=true
|
TRAEFIK_TLSENABLED=true
|
||||||
@ -22,3 +24,7 @@ LETSENCRYPT_EMAIL=admin@mydomain.com
|
|||||||
# Debugging
|
# Debugging
|
||||||
TRAEFIK_ACCESSLOG=false
|
TRAEFIK_ACCESSLOG=false
|
||||||
TRAEFIK_LOGLEVEL=INFO
|
TRAEFIK_LOGLEVEL=INFO
|
||||||
|
|
||||||
|
# Volumes
|
||||||
|
TRAEFIK_DYNAMIC=./config
|
||||||
|
TRAEFIK_CERTFILE=./certs.json
|
||||||
|
Loading…
Reference in New Issue
Block a user