services: traefik: image:"traefik:latest" command: -"--api.dashboard=true"# Enabling the dashboard -"--providers.docker=true"# Enabling docker as the provider for traefik -"--entrypoints.web.address=:80"# Defining an entrypoint for port :80 named web -"--entrypoints.websecure.address=:443"# Defining an entrypoint for port :443 named websecure - SSL port (HTTPS) -"--providers.docker.exposedbydefault=false"# Don't expose every container to traefik, only expose enabled ones -"--providers.docker.swarmMode=true"# Enable swarm mode (Comment this if not using Swarm) -"--providers.docker.network=traefik_public" -"--providers.docker.endpoint=unix:///var/run/docker.sock" # SSL configuration - Let's Encrypt -"--certificatesresolvers.le.acme.httpchallenge=true" -"[email protected]" -"--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json" -"--certificatesresolvers.le.acme.tlschallenge=true" # Global redirect HTTP to HTTPS -"--entrypoints.web.http.redirections.entryPoint.to=websecure" -"--entrypoints.web.http.redirections.entryPoint.scheme=https" ports: -"80:80"# http -"8080:8080"# traefik dashboard -"443:443"# https volumes: -"traefik_certificates:/letsencrypt"# Volume for SSL certificates -"/var/run/docker.sock:/var/run/docker.sock"# Volume for docker admin deploy:# Swarm mode (Comment this if not using Swarm) mode:replicated replicas:1 # resources: # Uncomment this if you want to limit resources on Traefik # limits: # cpus: '0.25' # memory: 300M placement: constraints: -node.role==manager networks: -traefik_public volumes: traefik_certificates:# SSL certificates external:true networks: traefik_public:# Public network external:true
portainer: image:portainer/portainer-ce:2.19.1 command:-Htcp://tasks.agent:9001--tlsskipverify # ports: # Remove these ports if traefik is used # - "9443:9443" # - "9000:9000" # - "8000:8000" volumes: -portainer_data:/data networks: -agent_network -traefik_public# Traefik public network deploy: mode:replicated replicas:1 placement: constraints: [node.role==manager] labels: -"traefik.enable=true"# Enable traefik -"traefik.http.routers.portainer.rule=Host(`portainer.yourdomain.com`)"# Set the portainer subdomain -"traefik.http.services.portainer.loadbalancer.server.port=9000"# Load balance port 9000 -"traefik.http.routers.portainer.service=portainer"# Set the portainer service -"traefik.http.routers.portainer.tls.certresolver=le"# Use the Let's Encrypt resolver -"traefik.http.routers.portainer.entrypoints=websecure"# Use the websecure entrypoint -"traefik.http.routers.portainer.tls=true"# Enable TLS networks: agent_network: driver:overlay attachable:true traefik_public:# Traefik public network external:true
services: traefik: container_name:traefik image:"traefik:latest" command: ---entrypoints.web.address=:80 ---entrypoints.websecure.address=:443 ---api.dashboard=true ---providers.docker ---log.level=ERROR ---certificatesresolvers.leresolver.acme.httpchallenge=true -[email protected]#Set your email address here, is for the generation of SSL certificates with Let's Encrypt. ---certificatesresolvers.leresolver.acme.storage=./acme.json ---certificatesresolvers.leresolver.acme.httpchallenge.entrypoint=web ports: -"80:80" -"443:443" volumes: -"/var/run/docker.sock:/var/run/docker.sock:ro" -"./acme.json:/acme.json" labels: -"traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)" -"traefik.http.routers.http-catchall.entrypoints=web" -"traefik.http.routers.http-catchall.middlewares=redirect-to-https" -"traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https" -"traefik.http.routers.traefik-dashboard.rule=Host(`traefik.domain.com`)" -"traefik.http.routers.traefik-dashboard.entrypoints=websecure" -"traefik.http.routers.traefik-dashboard.service=api@internal" -"traefik.http.routers.traefik-dashboard.tls.certresolver=leresolver" -"traefik.http.middlewares.traefik-auth.basicauth.users=admin:password"# Use this site to generate the password: https://hostingcanada.org/htpasswd-generator/ -"traefik.http.routers.traefik-dashboard.middlewares=traefik-auth"
This is my personal knowledge-base. Here you'll find code-snippets, technical documentation, and command reference for various tools, and technologies.