add traefik

This commit is contained in:
2025-01-09 19:31:40 -06:00
parent 5b693abc28
commit 9ad52dc663
5 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
CF_API_EMAIL=alexanderlebens@gmail.com
CF_API_KEY=""
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

View File

@@ -0,0 +1,29 @@
services:
traefik:
command: traefik
container_name: traefik
env_file:
- .env
image: docker.io/traefik:v3.2
labels:
traefik.docker.network: traefik
traefik.enable: true
traefik.http.routers.dashboard.entrypoints: websecure
traefik.http.routers.dashboard.rule: (Host(`traefik-ps08rp.alexlebens.net`) && (PathPrefix(`/api/`) || PathPrefix(`/dashboard/`)))
traefik.http.routers.dashboard.service: api@internal
traefik.http.routers.dashboard.tls: true
traefik.http.routers.dashboard.tls.certresolver: cloudflare
networks:
internal: null
ports:
- 80:80
- 443:443
privileged: true
restart: always
volumes:
- ./traefik_config:/etc/traefik
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
internal:
name: internal

View File

@@ -0,0 +1,15 @@
http:
middlewares:
ip-local:
IPAllowList:
sourceRange:
- "192.168.1.1/16"
- "172.27.0.0/16"
tcp:
middlewares:
ip-local:
IPAllowList:
sourceRange:
- "192.168.1.1/16"
- "172.27.0.0/16"

View File

@@ -0,0 +1,8 @@
http:
routers:
prometheus:
rule: "(Host(`traefik-ps10rp.alexlebens.net`) && Path(`/metrics`))"
entryPoints: websecure
service: prometheus@internal
middlewares:
- "ip-local@file"

View File

@@ -0,0 +1,113 @@
################################################################
# Global
################################################################
global:
checkNewVersion: false
sendAnonymousUsage: false
################################################################
# EntryPoints
################################################################
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443
forwardedHeaders:
trustedIPs:
- "192.168.1.1/16"
proxyProtocol:
trustedIPs:
- "192.168.1.1/16"
http:
tls:
options: default
certResolver: cloudflare
domains:
- main: "*.alexlebens.net"
sans:
- "alexlebens.net"
middlewares:
- ip-local@file
################################################################
# Certificate Resolvers
################################################################
certificatesResolvers:
cloudflare:
acme:
email: alexanderlebens@gmail.com
storage: /etc/traefik/acme/acme.json
preferredChain: "ISRG Root X1"
dnsChallenge:
provider: cloudflare
delayBeforeCheck: "3"
resolvers:
- "1.1.1.1"
- "1.0.0.1"
################################################################
# Traefik logs
################################################################
log:
level: INFO
################################################################
# Access logs
################################################################
accessLog: {}
################################################################
# API and Dashboard
################################################################
api:
insecure: false
dashboard: true
################################################################
# Ping
################################################################
# ping:
################################################################
# Metrics
################################################################
metrics:
prometheus:
addEntryPointsLabels: true
addRoutersLabels: true
addServicesLabels: true
buckets:
- 0.1
- 0.3
- 1.2
- 5.0
entryPoint: websecure
manualRouting: true
################################################################
# Providers
################################################################
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
file:
directory: "/etc/traefik/conf"
watch: true