# Maintainer: Mickael "PAPAMICA" Asseline
# Update: 2022-05-12
#& type: 3
#& title: Traefik
#& description: Perfect proxy for Docker environment
#& note: Website: Traefik.ioPorts to open: 80, 443You need to create these files: traefik.yml, config.yml, acme.jsonCheck my repo PAPAMICA/docker-environment
#& categories: SelfHosted, PAPAMICA
#& platform: linux
#& logo: https://img.papamica.com/logo/traefik.png
#% SERVICE: Name of the service (No spaces or points) [traefik]
#% DATA_LOCATION: Data localization (Example: /apps/service) [/_data/apps]
#% URL: Service URL (Example: service.papamica.fr or service.com)
#% NETWORK: Your Traefik network (Example: proxy, you need to create it before) [proxy]
#% ADMIN_PASS: Admin user and password (Format: USER:{SHA}XXXXXXXXXXXXXXXX)
# Work with Portainer
version: "3.3"
services:
traefik:
image: traefik:latest
container_name: $SERVICE
restart: always
healthcheck:
test: grep -qr "traefik" /proc/*/status || exit 1
interval: 1m
timeout: 30s
retries: 3
ports:
- 80:80
- 443:443
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- $DATA_LOCATION/$SERVICE/config/traefik.yml:/traefik.yml:ro
- $DATA_LOCATION/$SERVICE/config/config.yml:/config.yml:ro
- $DATA_LOCATION/$SERVICE/config/acme.json:/acme.json
labels:
autoupdate: "monitor"
traefik.enable: true
traefik.http.routers.$SERVICE.entrypoints: https
traefik.http.routers.$SERVICE.rule: Host("$URL")
traefik.http.routers.$SERVICE.service: api@internal
traefik.http.routers.$SERVICE.middlewares: auth
traefik.http.middlewares.auth.basicauth.users: $ADMIN_PASS
networks:
- default
networks:
default:
external:
name: $NETWORK