traefik/docker-compose.yml

69 lines
2.5 KiB
YAML
Raw Normal View History

2024-07-15 04:30:09 +05:00
services:
traefik:
container_name: traefik
image: traefik:v3.0.1
restart: always
env_file:
2024-08-08 05:51:09 +05:00
- /data/secrets/${SERVER_DOMAIN}/${SERVER_DOMAIN}.env
2024-07-15 04:30:09 +05:00
command:
- "--providers.file.filename=/traefik/certs.yml"
2024-08-08 05:51:09 +05:00
- "--providers.docker.network=proxynet"
2024-07-15 04:30:09 +05:00
- "--api.insecure=false"
- "--api.dashboard=true"
- "--providers.docker"
2024-08-08 05:51:09 +05:00
- "--log=true"
- "--log.level=${TRAEFIK_LOG_LEVEL}"
2024-07-15 04:30:09 +05:00
- "--providers.docker.exposedByDefault=false"
#Entrypoints:
- "--entrypoints.http.address=:80"
- "--entrypoints.https.address=:443"
- "--entrypoints.postgres.address=:5432"
2024-08-14 10:49:58 +05:00
- "--entrypoints.mariadb.address=:3306"
2024-07-15 04:30:09 +05:00
- "--entrypoints.http.http.redirections.entrypoint.to=https"
- "--entrypoints.http.http.redirections.entrypoint.scheme=https"
#SSL Let's Encrypt:
- "--entrypoints.https.http.tls.certResolver=le"
- "--certificatesresolvers.le.acme.tlschallenge=true"
2024-08-08 05:51:09 +05:00
- "--certificatesresolvers.le.acme.email=${ADMIN_EMAIL}"
- "--certificatesresolvers.le.acme.storage=/letsencrypt/${SERVER_DOMAIN}.acme.json"
2024-07-15 04:30:09 +05:00
#Dashboard secure:
labels:
- "traefik.enable=true"
2024-08-08 05:51:09 +05:00
- "traefik.http.routers.dashboard.rule=Host(`traefik.${SERVER_DOMAIN}`)"
2024-07-15 04:30:09 +05:00
- "traefik.http.routers.dashboard.entrypoints=https"
- "traefik.http.routers.dashboard.tls=true"
2024-08-08 11:05:58 +05:00
- "traefik.http.routers.dashboard.tls.certresolver=le"
2024-07-15 04:30:09 +05:00
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.usersfile=/httpauth/usersfile.htpasswd"
ports:
- "80:80"
- "443:443"
- "5432:5432"
2024-08-14 10:49:58 +05:00
- "3306:3306"
2024-07-15 04:30:09 +05:00
volumes:
2024-08-08 05:51:09 +05:00
- /var/run/docker.sock:/var/run/docker.sock:ro
- /data/secrets/${SERVER_DOMAIN}/letsencrypt:/letsencrypt
- /data/secrets/${SERVER_DOMAIN}/httpauth:/httpauth
- /data/traefik/certs.yml:/traefik/certs.yml
- /data/secrets/${SERVER_DOMAIN}/selfsigned:/selfsigned
2024-07-15 04:30:09 +05:00
logging:
driver: "json-file"
options:
max-size: "1m"
2024-08-08 11:48:12 +05:00
#initContainers:
#container_name: volume-permissions
#image: busybox:1.36.1-glibc
2024-07-15 04:30:09 +05:00
2024-08-08 11:48:12 +05:00
#command: >
# sh -c "touch /letsencrypt/${SERVER_DOMAIN}.acme.json &&
# chmod -Rv 600 /letsencrypt/* &&
# chown 65532:65532 /letsencrypt/${SERVER_DOMAIN}.acme.json"
#volumes:
# - /data/secrets/${SERVER_DOMAIN}/letsencrypt:/letsencrypt
2024-07-15 04:30:09 +05:00
networks:
default:
name: proxynet
external: true