Add traefik-consul
This commit is contained in:
65
traefik-consul
Normal file
65
traefik-consul
Normal file
@@ -0,0 +1,65 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:v3.6.4
|
||||
container_name: traefik35
|
||||
restart: always
|
||||
command:
|
||||
- "--api.dashboard=true"
|
||||
- "--api.insecure=true"
|
||||
- "--api.dashboard.entryPoint=traefik" # Bind dashboard to 8086
|
||||
- "--log.level=DEBUG"
|
||||
- "--accesslog=true"
|
||||
- "--providers.file.filename=/etc/traefik/traefik.yml"
|
||||
- "--providers.file.directory=/dynamic"
|
||||
- "--providers.file.watch=true"
|
||||
- "--providers.consulcatalog.endpoint.address=consul:8500"
|
||||
- "--providers.docker=true"
|
||||
- "--entrypoints.web.address=:80"
|
||||
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
|
||||
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
|
||||
- "--entrypoints.web.http.redirections.entryPoint.permanent=true"
|
||||
- "--entrypoints.websecure.address=:443"
|
||||
- "--entrypoints.traefik.address=:8086" # Dashboard on 8087
|
||||
- "--certificatesresolvers.myresolver.acme.email=jakub@zacekj.cz"
|
||||
- "--certificatesresolvers.myresolver.acme.storage=/data/acme.json"
|
||||
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
|
||||
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "8087:8086" # Dashboard (Disable in production)
|
||||
volumes:
|
||||
- "/data/compose/traefik/traefik-data/traefik.yml:/etc/traefik/traefik.yml:ro"
|
||||
- "/data/compose/traefik/dynamic:/dynamic:ro"
|
||||
- "/data/compose/traefik/traefik-data/acme.json:/data/acme.json"
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
depends_on:
|
||||
consul:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- traefik-net
|
||||
|
||||
consul:
|
||||
image: hashicorp/consul:latest
|
||||
container_name: consul2
|
||||
restart: always
|
||||
command: "agent -server -bootstrap-expect=1 -ui -client=0.0.0.0"
|
||||
ports:
|
||||
- "8500:8500" # Consul Web UI
|
||||
- "8600:8600/udp" # DNS
|
||||
volumes:
|
||||
- "/data/compose/consul/data:/consul/data"
|
||||
- "/data/compose/consul/config:/consul/config"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8500/v1/status/leader"]
|
||||
interval: 10s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
networks:
|
||||
- traefik-net
|
||||
|
||||
networks:
|
||||
traefik-net:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user