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"
|
|
|
|
- "--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"
|
|
|
|
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"
|
|
|
|
|
|
|
|
initContainers:
|
|
|
|
container_name: volume-permissions
|
|
|
|
image: busybox:1.36.1-glibc
|
|
|
|
|
|
|
|
command: >
|
2024-08-08 05:51:09 +05:00
|
|
|
sh -c "touch /letsencrypt/${SERVER_DOMAIN}.acme.json &&
|
2024-07-15 04:30:09 +05:00
|
|
|
chmod -Rv 600 /letsencrypt/* &&
|
2024-08-08 05:51:09 +05:00
|
|
|
chown 65532:65532 /letsencrypt/${SERVER_DOMAIN}.acme.json"
|
2024-07-15 04:30:09 +05:00
|
|
|
volumes:
|
2024-08-08 10:21:31 +05:00
|
|
|
- /data/secrets/${SERVER_DOMAIN}/letsencrypt:/letsencrypt
|
2024-07-15 04:30:09 +05:00
|
|
|
|
|
|
|
networks:
|
|
|
|
default:
|
|
|
|
name: proxynet
|
|
|
|
external: true
|