Started traefik role

This commit is contained in:
Mike Wilson
2023-02-01 22:53:04 -05:00
parent 85237382ca
commit bae3aee014
5 changed files with 93 additions and 3 deletions

View File

@@ -0,0 +1,26 @@
version: "{{ docker_compose_version }}"
networks:
traefik:
external: true
services:
traefik:
container_name: traefik
image: traefik:latest
networks:
- traefik
- docker-socket-proxy
ports:
- 80:80 # HTTP
- 443:443 # HTTPS
environment:
PORKBUN_API_KEY: "{{ porkbun_api_key }}"
PORKBUN_SECRET_API_KEY: "{{ porkbun_secret_api_key }}"
volumes:
- "{{ data_dir }}/traefik:/etc/traefik"
labels:
traefik.enable: true
traefik.http.routers.traefik-dashboard.rule: "Host(`traefik.local.{{ personal_domain }}`)"
traefik.http.routers.traefik-dashboard.service: api@internal
traefik.http.routers.traefik-dashboard.middlewares: lan-whitelist@file

View File

@@ -0,0 +1,55 @@
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: web-secure
scheme: https
web-secure:
address: :443
http:
tls:
certResolver: letsencrypt
domains:
- main: "{{ personal_domain }}"
- sans: "*.{{ personal_domain }}"
- main: "local.{{ personal_domain }}"
- sans: "*.local.{{ personal_domain }}"
middlewares:
- secure-headers@file
traefik:
address: :8080
certificatesResolvers:
letsencrypt:
acme:
# Staging server
caServer: https://acme-staging-v02.api.letsencrypt.org/directory
# Production server
# caServer: https://acme-v02.api.letsencrypt.org/directory
email: "{{ letsencrypt_email }}"
storage: /etc/traefik.acme.json
dnsChallenge:
provider: porkbun
delayBeforeCheck: 0
serversTransport:
insecureSkipVerify: true
tls:
options:
default:
minVersion: VersionTLS12
providers:
docker:
endpoint: tcp://docker_socket_proxy:2375
exposedByDefault: false
network: traefik
file:
directory: /etc/traefik/conf
watch: true