cleanup and add alloy

This commit is contained in:
Oliver Atkinson
2025-03-11 15:27:16 -06:00
parent cd4854f2c6
commit 265e30ea7d
7 changed files with 48 additions and 22 deletions

26
server/Caddyfile Normal file
View File

@@ -0,0 +1,26 @@
{
admin :2019
servers :3000 {
name grafana
metrics
}
servers :3001 {
name loki
metrics
}
log debug {
level debug
output file /var/log/caddy/debug.log
}
}
:3000 {
reverse_proxy grafana:3000
}
:3100 {
reverse_proxy loki:3100
}

58
server/compose.yml Normal file
View File

@@ -0,0 +1,58 @@
services:
# r-proxy
caddy:
image: caddy:latest
restart: unless-stopped
ports:
# HTTP
- 80:80
- 443:443
- '443:443/udp'
# Grafana
- 3000:3000
# Loki
- 3100:3100
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
# Metrics collector
prometheus:
image: prom/prometheus:latest
expose:
- 9090
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
# persist data
- prometheus_storage:/prometheus
depends_on:
- caddy
command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
# Logs
loki:
image: grafana/loki:2.9.2
expose:
- 3100
command: -config.file=/etc/loki/local-config.yaml
volumes:
- ./loki.yaml:/etc/loki/local-config.yaml
# Everything viewer
grafana:
image: grafana/grafana:latest
volumes:
- ./grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
- grafana_storage:/var/lib/grafana
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
expose:
- 3000
depends_on:
- prometheus
volumes:
prometheus_storage:
grafana_storage:

24
server/grafana.yaml Normal file
View File

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

15
server/prometheus.yaml Normal file
View File

@@ -0,0 +1,15 @@
global:
scrape_interval: 15s
query_log_file: /etc/prometheus/query.log
scrape_configs:
- job_name: caddy
static_configs:
- targets: ['caddy:2019']
- job_name: node
static_configs:
# put a list of all the nodes you are monitoring
- targets: ['10.0.0.92:9100']
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']