caddy / prometheus / grafana

a better version of the nginx otel config
This commit is contained in:
Oliver Atkinson 2024-05-23 14:05:32 -06:00
parent b3bd53fddc
commit 7a0705c4d3
5 changed files with 73 additions and 0 deletions

11
Caddy/Caddyfile Normal file
View File

@ -0,0 +1,11 @@
{
admin :2019
servers {
metrics
}
}
:80
respond "Data\n"

3
Caddy/README.md Normal file
View File

@ -0,0 +1,3 @@
This is almost production ready.
You would want to change the Caddyfile and also the Grafana config in the docker compose file. Currently it doesn't ask for credentials as just gives you admin privilages. Nice for testing tho.

36
Caddy/docker-compose.yml Normal file
View File

@ -0,0 +1,36 @@
services:
# r-proxy, log generator
caddy:
image: caddy:latest
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- './Caddyfile:/etc/caddy/Caddyfile'
# log collector
prometheus:
image: prom/prometheus:latest
volumes:
- './prometheus.yaml:/etc/prometheus/prometheus.yml'
depends_on:
- caddy
# log viewer
grafana:
image: grafana/grafana:latest
volumes:
# needs another volume for persistant storage
- './grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml'
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
ports:
- "3000:3000"
depends_on:
- prometheus

15
Caddy/grafana.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
uid: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
basicAuth: false
isDefault: false
version: 1
editable: false
jsonData:
httpMethod: GET

8
Caddy/prometheus.yaml Normal file
View File

@ -0,0 +1,8 @@
global:
scrape_interval: 15s # default is 1 minute
scrape_configs:
- job_name: caddy
static_configs:
# docker networking
- targets: ['caddy:2019']