Add traefik, grafana, traefik dynamic conf

This commit is contained in:
stcb 2024-11-21 13:37:24 +01:00
commit cba188f8ea
3 changed files with 124 additions and 0 deletions

63
docker-compose.yml Normal file
View File

@ -0,0 +1,63 @@
version: "3.3"
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
command:
# - "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.file.directory=/etc/traefik/dynamic_conf.d"
- "--entryPoints.https.address=:443"
- "--entryPoints.http.address=:80"
- "--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/letsencrypt/acme.json"
- "--certificatesresolvers.letsencrypt.acme.email=infra@clps.ch"
- "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
volumes:
- "/home/cloud/traefik/dynamic_conf.d:/etc/traefik/dynamic_conf.d/"
- "/home/cloud/traefik/letsencrypt/acme.json:/etc/traefik/letsencrypt/acme.json"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "8069:8080"
grafana:
image: "grafana/grafana:latest"
container_name: "grafana"
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`grafana.clps.ch`)"
- "traefik.http.routers.grafana.entrypoints=https"
- "traefik.http.routers.grafana.tls.certresolver=letsencrypt"
- "traefik.http.routers.grafana.tls=true"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
depends_on:
- traefik
#networks:
# - traefik-net
nextcloud:
image: "nextcloud/all-in-one:latest"
container_name: "nextcloud-aio-mastercontainer"
init: true
environment:
- "APACHE_PORT=11000"
- "APACHE_IP_BINDING=0.0.0.0"
ports:
- "8080:8080"
- "8443:8443"
volumes:
- "nextcloud_aio_mastercontainer:/mnt/docker-aio-config"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
depends_on:
- traefik
restart: unless-stopped
volumes:
nextcloud_aio_mastercontainer:

View File

@ -0,0 +1,35 @@
http:
routers:
nextcloud:
rule: "Host(`cloud.clps.ch`)"
entrypoints:
- "https"
service: nextcloud
middlewares:
- nextcloud-chain
tls:
certresolver: "letsencrypt"
services:
nextcloud:
loadBalancer:
servers:
- url: "http://nextcloud-aio-mastercontainer:11000" # Use the host's IP address if Traefik runs outside the host network
middlewares:
nextcloud-secure-headers:
headers:
hostsProxyHeaders:
- "X-Forwarded-Host"
referrerPolicy: "same-origin"
https-redirect:
redirectscheme:
scheme: https
nextcloud-chain:
chain:
middlewares:
# - ... (e.g. rate limiting middleware)
- https-redirect
- nextcloud-secure-headers

26
traefik/traefik.yml Normal file
View File

@ -0,0 +1,26 @@
# STATIC CONFIGURATION
entryPoints:
https:
address: ":443" # Create an entrypoint called "https" that uses port 443
# If you want to enable HTTP/3 support, uncomment the line below
# http3: {}
web:
address: ":80"
certificatesResolvers:
# Define "letsencrypt" certificate resolver
letsencrypt:
acme:
storage: /letsencrypt/acme.json # Defines the path where certificates should be stored
email: "infra@clps.ch" #Where LE sends notification about certificates expiring
tlschallenge: true
providers:
file:
directory: "/etc/traefik/dynamic_conf.d" # Adjust the path according your needs.
watch: true
# Enable HTTP/3 feature by uncommenting the lines below. Don't forget to route 443 UDP to Traefik (Firewall\NAT\Traefik Container)
# experimental:
# http3: true