Moved from Nginx to Caddy

This commit is contained in:
Davide 2024-09-19 14:52:14 +02:00
parent 203e51c576
commit cfc9ddec9e
4 changed files with 45 additions and 25 deletions

View File

@ -1,9 +1,13 @@
---
x-logging: &default-logging
driver: local
x-logging:
&default-logging
driver: syslog
options:
max-size: "1m"
max-file: "50"
# This requires two files in /etc/rsyslog.d
# https://www.loggly.com/use-cases/docker-syslog-logging-and-troubleshooting/
tag: "container_name/{{.Name}}"
labels: "${hostname}"
syslog-facility: # cron, local7, etc.
x-opt-values: &volume-opt
driver_opts: &options
@ -25,17 +29,27 @@ services:
security_opt:
- apparmor:unconfined
volumes:
- netdataconfig:/etc/netdata:ro
- ./netdataconfig:/etc/netdata:rw
- netdatalib:/var/lib/netdata
- netdatacache:/var/cache/netdata
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
# - /dev:/host/dev:ro
# - /mnt:/host/mns:ro
# - /var/log:/host/var/log:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /etc/os-release:/host/etc/os-release:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
caddy: ${NETDATA_HOSTNAME}
caddy.log:
caddy.encode: "zstd gzip"
caddy.reverse_proxy: "{{upstreams 19999}}"
caddy.basicauth.{USERNAME}: "hashed_password"
networks:
- reverse-proxy
- netdata
- caddy
- npg
logging: *default-logging
@ -43,33 +57,46 @@ services:
image: prom/prometheus
container_name: prometheus
hostname: prometheus
# Only if you need to access it locally
# ports:
# - "9090:9090"
env_file:
prometheus.env
volumes:
- prometheus:/etc/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=180d'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
# - '--web.enable-admin-api'
# - '--web.enable-remote-write-receiver'
networks:
- npg
- caddy
logging: *default-logging
grafana:
image: grafana/grafana
container_name: grafana
restart: unless-stopped
env_file:
grafana.env
volumes:
- grafana:/var/lib/grafana
labels:
caddy: grafana.domain.tld
caddy.log:
caddy.reverse_proxy: "{{upstreams 3000}}"
networks:
- npg
- caddy
logging: *default-logging
# Can be substituted by a standard volume declaration if it's just a test
# environment or no nfs server is available
volumes:
netdataconfig:
<<: *volume-opt
driver_opts:
<<: *options
device: ":/mnt/path/netdata/netdataconfig"
netdatalib:
<<: *volume-opt
driver_opts:
@ -92,7 +119,7 @@ volumes:
device: ":/mnt/path/grafana/grafana"
networks:
reverse-proxy:
name: rp_reverse-proxy
external: true
netdata:
npg:
caddy:
external: true

View File

@ -1,3 +1 @@
VIRTUAL_HOST="grafana.domain.tld"
VIRTUAL_PORT=3000
LETSENCRYPT_HOST="grafana.domain.tld"

View File

@ -1,6 +1,3 @@
VIRTUAL_HOST="netdata.domain.tld"
VIRTUAL_PORT=19999
LETSENCRYPT_HOST="netdata.domain.tld"
NETDATA_CLAIM_TOKEN=hOOww34Yc-6vYBYxRKBop6Ozbsf0B2WSaPBTsW_mbHuBYiHcGDVsvbqETz5SaevMvOVBK_4r7q6WwLZTTD3iwHy2T2X1NsRExqUWWUn3LQXDGYlvKKCynVRafuNT9xmH1cuQ0l8
NETDATA_CLAIM_TOKEN=${TOKEN}
NETDATA_CLAIM_URL=https://app.netdata.cloud
NETDATA_CLAIM_ROOMS=

View File

@ -1,3 +1 @@
VIRTUAL_HOST="prometheus.domain.tld"
VIRTUAL_PORT=9090
LETSENCRYPT_HOST="prometheus.domain.tld"