From 7a0705c4d32f962b87727c283049da30dfd34a36 Mon Sep 17 00:00:00 2001 From: Oliver Atkinson Date: Thu, 23 May 2024 14:05:32 -0600 Subject: [PATCH] caddy / prometheus / grafana a better version of the nginx otel config --- Caddy/Caddyfile | 11 +++++++++++ Caddy/README.md | 3 +++ Caddy/docker-compose.yml | 36 ++++++++++++++++++++++++++++++++++++ Caddy/grafana.yaml | 15 +++++++++++++++ Caddy/prometheus.yaml | 8 ++++++++ 5 files changed, 73 insertions(+) create mode 100644 Caddy/Caddyfile create mode 100644 Caddy/README.md create mode 100644 Caddy/docker-compose.yml create mode 100644 Caddy/grafana.yaml create mode 100644 Caddy/prometheus.yaml diff --git a/Caddy/Caddyfile b/Caddy/Caddyfile new file mode 100644 index 0000000..f3986a8 --- /dev/null +++ b/Caddy/Caddyfile @@ -0,0 +1,11 @@ +{ + admin :2019 + + servers { + metrics + } +} + +:80 +respond "Data\n" + diff --git a/Caddy/README.md b/Caddy/README.md new file mode 100644 index 0000000..a802f19 --- /dev/null +++ b/Caddy/README.md @@ -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. diff --git a/Caddy/docker-compose.yml b/Caddy/docker-compose.yml new file mode 100644 index 0000000..f5f5698 --- /dev/null +++ b/Caddy/docker-compose.yml @@ -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 + diff --git a/Caddy/grafana.yaml b/Caddy/grafana.yaml new file mode 100644 index 0000000..434b278 --- /dev/null +++ b/Caddy/grafana.yaml @@ -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 diff --git a/Caddy/prometheus.yaml b/Caddy/prometheus.yaml new file mode 100644 index 0000000..16f6f25 --- /dev/null +++ b/Caddy/prometheus.yaml @@ -0,0 +1,8 @@ +global: + scrape_interval: 15s # default is 1 minute + +scrape_configs: + - job_name: caddy + static_configs: + # docker networking + - targets: ['caddy:2019']