Last active
March 17, 2022 22:11
-
-
Save SamuelMwangiW/3ffd75c4f982d25a9ab66ee77474c220 to your computer and use it in GitHub Desktop.
An example docker-compose YAML to deploy an Traefik to proxy an application
This file contains hidden or 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.3" | |
| services: | |
| traefik: | |
| image: "traefik:latest" | |
| command: | |
| - --providers.docker | |
| - --entrypoints.web.address=:80 | |
| - --entrypoints.websecure.address=:443 | |
| - --api | |
| - [email protected] | |
| - --certificatesresolvers.le.acme.storage=/acme.json | |
| - --certificatesresolvers.le.acme.tlschallenge=true | |
| labels: | |
| - traefik.http.routers.traefik.rule=Host(`traefik.example.com`) | |
| - traefik.http.routers.traefik.service=api@internal | |
| - traefik.http.routers.traefik.middlewares=ip | |
| - traefik.http.middlewares.ip.ipwhitelist.sourcerange=19.69.42.96 # with Apologies to Ford Motor Corporation | |
| - traefik.http.routers.traefik.tls.certresolver=le | |
| - traefik.http.routers.traefik.entrypoints=websecure | |
| # middleware redirect | |
| - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https | |
| # global redirect to https | |
| - traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`) | |
| - traefik.http.routers.redirs.entrypoints=web | |
| - traefik.http.routers.redirs.middlewares=redirect-to-https | |
| ports: | |
| - "80:80" | |
| - "443:443" | |
| volumes: | |
| - "/var/run/docker.sock:/var/run/docker.sock:ro" | |
| - "./letsencrypt/acme.json:/acme.json" | |
| app: | |
| image: containous/whoami:latest | |
| labels: | |
| - traefik.http.routers.app.rule=Host(`app.example.com`) | |
| - traefik.http.services.app.loadbalancer.server.port=80 | |
| - traefik.http.routers.app.tls.certresolver=le | |
| - traefik.http.routers.app.entrypoints=websecure |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding traefik-modsecurity-plugin for my own future reference