Guest User

config files

a guest
Jul 4th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.72 KB | None | 0 0
  1. ### traefik/docker-compose.yml
  2. version: '3'
  3. services:
  4.   main:
  5.     image: traefik:latest
  6.     restart: unless-stopped
  7.     security_opt:
  8.      - no-new-privileges:true
  9.     command:
  10.      - "--log.level=DEBUG"
  11.     networks:
  12.      - webproxy
  13.     ports:
  14.      - 80:80
  15.       - 443:443
  16.     volumes:
  17.      - /etc/localtime:/etc/localtime:ro
  18.       - /var/run/docker.sock:/var/run/docker.sock:ro
  19.       - ./data/traefik.yml:/traefik.yml:ro
  20.       - ./data/acme.json:/acme.json
  21.     deploy:
  22.       mode: global
  23.       placement:
  24.         constraints:
  25.          - node.role == manager
  26.       update_config:
  27.         parallelism: 1
  28.         delay: 10s
  29.       restart_policy:
  30.         condition: on-failure
  31.       labels:
  32.        - "traefik.enable=false"
  33.         - "traefik.http.routers.traefik.entrypoints=http"
  34.         - "traefik.http.routers.traefik.rule=Host(`traefik.mydomain.com`)"
  35.         # generate user:password with echo $(htpasswd -nb user password) | sed -e s/\\$/\\$\\$/g
  36.         - "traefik.http.middlewares.traefik-auth.basicauth.users=admin:password-hash"
  37.         - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
  38.         - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
  39.         - "traefik.http.routers.traefik-secure.entrypoints=https"
  40.         - "traefik.http.routers.traefik-secure.rule=Host(`traefik.mydomain.com`)"
  41.         - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
  42.         - "traefik.http.routers.traefik-secure.tls=true"
  43.         - "traefik.http.routers.traefik-secure.tls.certresolver=http"
  44.         - "traefik.http.routers.traefik-secure.service=api@internal"
  45.         - "traefik.http.services.traefik-secure.loadbalancer.server.port=8080"
  46.  
  47. networks:
  48.   webproxy:
  49.     external: true
  50.  
  51.  
  52.  
  53. ### traefik/data/traefik.yml
  54. api:
  55.   dashboard: true
  56.  
  57. entryPoints:
  58.   http:
  59.     address: ":80"
  60.   https:
  61.     address: ":443"
  62.  
  63. log:
  64.   level: DEBUG
  65.  
  66. providers:
  67.   docker:
  68.     endpoint: "unix:///var/run/docker.sock"
  69.     #endpoint: "tcp://127.0.0.1:2375"
  70.     swarmMode: true
  71.     exposedByDefault: false
  72.     network: webproxy
  73.  
  74. certificatesResolvers:
  75.   http:
  76.     acme:
  77.       email: hostmaster@mydomain.com
  78.       storage: acme.json
  79.       tlsChallenge: true
  80.       #httpChallenge:
  81.       #  entryPoint: http
  82.  
  83.  
  84.  
  85.  
  86. ### portainer/docker-compose.yml
  87. version: "3"
  88. services:
  89.   main:
  90.     image: portainer/portainer
  91.     volumes:
  92.      - ./data:/data
  93.     networks:
  94.      - internal
  95.       - webproxy
  96.     deploy:
  97.       labels:
  98.        - "traefik.enable=true"
  99.         - "traefik.http.services.portainer.loadbalancer.server.port=9000"
  100.         - "traefik.http.routers.portainer.entrypoints=http"
  101.         - "traefik.http.routers.portainer.rule=Host(`portainer.mydomain.com`)"
  102.         - "traefik.http.middlewares.portainer-https-redirect.redirectscheme.scheme=https"
  103.         - "traefik.http.routers.portainer.middlewares=portainer-https-redirect"
  104.         - "traefik.http.routers.portainer-secure.entrypoints=https"
  105.         - "traefik.http.routers.portainer-secure.rule=Host(`portainer.mydomain.com`)"
  106.         - "traefik.http.routers.portainer-secure.tls=true"
  107.         - "traefik.http.routers.portainer-secure.tls.certresolver=http"
  108.       placement:
  109.         constraints:
  110.          - node.role == manager
  111.       update_config:
  112.         parallelism: 1
  113.         delay: 10s
  114.       restart_policy:
  115.         condition: on-failure
  116.     command: -H tcp://tasks.agent:9001 --tlsskipverify
  117.  
  118.   agent:
  119.     image: portainer/agent
  120.     networks:
  121.      - internal
  122.     environment:
  123.       AGENT_CLUSTER_ADDR: tasks.agent
  124.     volumes:
  125.      - /var/run/docker.sock:/var/run/docker.sock
  126.     deploy:
  127.       mode: global
  128.  
  129. networks:
  130.   webproxy:
  131.     external: true
  132.   internal:
  133.     driver: overlay
Add Comment
Please, Sign In to add comment