Created
September 7, 2020 09:09
-
-
Save fty4/ceaf45898388d94e389ed12a125e0e95 to your computer and use it in GitHub Desktop.
Docker swarm traefik
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
docker network create --driver=overlay proxy | |
docker stack deploy -c traefik.yml traefik | |
docker stack deploy -c wai.yml whoami | |
docker service scale whoami_whoami=10 |
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:2.2.8 | |
restart: always | |
ports: | |
- "80:80" | |
- "8080:8080" # traefik dashboard | |
# - "443:443" | |
command: | |
- --api.insecure=true # set to 'false' on production | |
- --api.dashboard=true # see https://docs.traefik.io/v2.0/operations/dashboard/#secure-mode for how to secure the dashboard | |
- --api.debug=true # enable additional endpoints for debugging and profiling | |
- --log.level=DEBUG # debug while we get it working, for more levels/info see https://docs.traefik.io/observability/logs/ | |
- --providers.docker=true | |
- --providers.docker.swarmMode=true | |
- --providers.docker.exposedbydefault=false | |
- --providers.docker.network=proxy | |
- --entrypoints.web.address=:80 | |
# - --entrypoints.web-secured.address=:443 | |
# - --certificatesresolvers.mytlschallenge.acme.httpChallenge.entrypoint=web | |
# - --certificatesresolvers.mytlschallenge.acme.email=you@whatever.com | |
# - --certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json | |
volumes: | |
# - letsencrypt:/letsencrypt | |
- /var/run/docker.sock:/var/run/docker.sock | |
networks: | |
- proxy | |
deploy: | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.api.rule=Host(`traefik.master`)" | |
- "traefik.http.routers.api.service=api@internal" # Let the dashboard access the traefik api | |
networks: | |
proxy: | |
external: true | |
#volumes: | |
# letsencrypt: |
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: | |
whoami: | |
image: containous/whoami | |
restart: always | |
networks: | |
- proxy | |
- backend | |
deploy: | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.wai.rule=Host(`wai.master`)" | |
- "traefik.http.routers.wai.entrypoints=web" | |
- "traefik.http.services.wai.loadbalancer.server.port=80" # it seems you always need to give traefik a port so it 'notices' the service | |
# - "traefik.http.routers.wai-secured.rule=Host(`wai.master`)" | |
# - "traefik.http.routers.wai-secured.entrypoints=web-secured" | |
# - "traefik.http.routers.wai-secured.tls.certresolver=mytlschallenge" | |
networks: | |
backend: | |
proxy: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment