diff --git a/caddy/Caddyfile.production b/caddy/Caddyfile.production index a740106..1732813 100644 --- a/caddy/Caddyfile.production +++ b/caddy/Caddyfile.production @@ -3,6 +3,13 @@ admin localhost:2019 } +# Enable telemetry module for Prometheus metrics +(telemetry) { + telemetry { + enabled false + } +} + (security) { # Basic rate limiting - 30 requests per minute per IP header X-Rate-Limit "30/minute" @@ -18,6 +25,14 @@ } } +# Metrics endpoint - exposed on localhost only for vmagent scraping +:9090 { + import telemetry + respond /metrics 200 { + content_type text/plain + } +} + *.mfilipe.eu { tls { dns gandi {env.GANDI_API_TOKEN} diff --git a/caddy/Dockerfile b/caddy/Dockerfile index f1b6d2c..03d9b41 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -1,7 +1,8 @@ FROM caddy:2-builder AS builder RUN xcaddy build \ - --with github.com/caddy-dns/gandi + --with github.com/caddy-dns/gandi \ + --with github.com/caddyserver/caddy/v2/modules/caddytelemetry FROM caddy:2 diff --git a/monitoring/vmagent/prometheus.yml b/monitoring/vmagent/prometheus.yml index b54068e..e27f2e8 100644 --- a/monitoring/vmagent/prometheus.yml +++ b/monitoring/vmagent/prometheus.yml @@ -8,3 +8,7 @@ scrape_configs: - job_name: 'victoriametrics' static_configs: - targets: ['victoriametrics:8428'] + - job_name: 'caddy' + static_configs: + - targets: ['localhost:9090'] + metrics_path: /metrics