Skip to content

Instantly share code, notes, and snippets.

@naviarh
Last active February 12, 2022 15:22
Show Gist options
  • Select an option

  • Save naviarh/2b1d738844ceeac75ece806638e4366c to your computer and use it in GitHub Desktop.

Select an option

Save naviarh/2b1d738844ceeac75ece806638e4366c to your computer and use it in GitHub Desktop.
version: '3.7'
services:
traefik:
image: traefik:2.6
container_name: traefik
restart: unless-stopped
network_mode: "host"
command:
#- "--log.level=DEBUG"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
#- "--providers.docker.network=traefik-public"
# Configure entrypoint
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.tss.address=:59993"
#- "--entrypoints.odoo.address=:8069"
#- "--entrypoints.dashboard.address=:8080"
# SSL configuration
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "[email protected]"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
# Test sertificates:
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
# Global HTTP -> HTTPS
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
# Enable dashboard
- "--api.dashboard=true"
- "--api.insecure=true"
ports:
- 80:80
- 443:443
#- 8080:8080
- 59993:59993
#- 8069:8069
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
#- "/user-credentials:/user-credentials:ro"
labels:
- "traefik.enable=true"
# https access for domain
- "traefik.http.routers.traefik-https.rule=Host(`traefik.picsor.ru`)"
- "traefik.http.routers.traefik-https.entrypoints=websecure"
- "traefik.http.routers.traefik-https.tls=true"
- "traefik.http.routers.traefik-https.tls.options=default"
- "traefik.http.routers.traefik-https.tls.certresolver=myresolver"
- "traefik.http.routers.traefik-https.service=traefik"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
# Authorization
#- "traefik.http.routers.api.middlewares=auth"
#- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.routers.traefik-https.middlewares=auth"
#- "traefik.http.middlewares.auth.basicauth.usersfile=/user-credentials"
- "traefik.http.middlewares.auth.basicauth.users=user:$$2y$$05$$3gUrh/zZgyafa1HvkssKi.45uDbaCsG2Vv3xzv6c2LD0OzCW5uX16" # пароль: password
- "traefik.http.middlewares.auth.basicauth.removeheader=true"
# Содать пароль для пользавателя "user":
# (htpasswd -nB user) | sed -e s/\\$/\\$\\$/g
# Установить команду htpasswd:
# sudo apt install apache2-utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment