Replace Traefik with Caddy as proxy

This commit is contained in:
Florian Zirker 2024-10-08 16:02:32 +02:00
parent fdd4b6faf1
commit a3944d3867
10 changed files with 69 additions and 122 deletions

View file

@ -1,54 +1,25 @@
services:
traefik:
image: traefik:${TRAEFIK_VERSION}
restart: always
caddy:
image: caddy:2
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- 80:80
volumes:
- ${VOLUMES_PATH}/proxy/caddy/data:/data
- ${VOLUMES_PATH}/proxy/caddy/config:/config
- ./Caddyfile:/etc/caddy/Caddyfile:ro
networks:
- web
- dockersocket
volumes:
- "$PWD/traefik.yml:/etc/traefik/traefik.yml"
- "$PWD/extraProviders/:/extraProviders:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.${HOSTNAME}`)"
- "traefik.http.routers.traefik.entrypoints=web"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
- "docker.group=proxy"
extra_hosts:
- host.docker.internal:host-gateway
depends_on:
- docker-socket-proxy
docker-socket-proxy:
image: tecnativa/docker-socket-proxy
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
# grant privileges as environment variables: https://github.com/Tecnativa/docker-socket-proxy#grant-or-revoke-access-to-certain-api-sections
- CONTAINERS=1
- INFO=1
whoami:
image: containous/whoami
networks:
- dockersocket
privileged: true
# whoami:
# image: containous/whoami
# networks:
# - web
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.whoami.rule=Host(`whoami.${HOSTNAME}`)"
# - "traefik.http.routers.whoami.entrypoints=web"
# - "traefik.http.services.whoami.loadbalancer.server.port=80"
# - "docker.group=proxy"
# restart: unless-stopped
- web
labels:
- "docker.group=proxy"
restart: unless-stopped
networks: