feat: secure telemetry ingestion and grafana data sources
This commit is contained in:
+91
-39
@@ -23,10 +23,18 @@ x-s3-env: &s3-env
|
||||
S3_REGION: us-east-1
|
||||
|
||||
x-otel-env: &otel-env
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
||||
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=lab
|
||||
|
||||
x-telemetry-proxy: &telemetry-proxy
|
||||
<<: *lockdown
|
||||
image: haproxy:3.0.6-alpine
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits: {cpus: "0.15", memory: 64M}
|
||||
|
||||
services:
|
||||
bootstrap:
|
||||
build:
|
||||
@@ -277,99 +285,142 @@ services:
|
||||
limits: {cpus: "0.25", memory: 96M}
|
||||
|
||||
otel-collector:
|
||||
<<: *lockdown
|
||||
image: otel/opentelemetry-collector-contrib:0.115.1@sha256:d2da12c4336a79758826700be9e21ecf4a9f7d945b7f8a58ba55ee3fa45427c8
|
||||
command: ["--config=/etc/otelcol/collector.yaml"]
|
||||
volumes:
|
||||
- ./infra/otel/collector.yaml:/etc/otelcol/collector.yaml:ro
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: otel-collector}}
|
||||
networks: [default, telemetry]
|
||||
depends_on:
|
||||
bootstrap: {condition: service_completed_successfully}
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 256M }
|
||||
restart: unless-stopped
|
||||
limits: {cpus: "0.5", memory: 256M}
|
||||
|
||||
collector-scrape:
|
||||
<<: *telemetry-proxy
|
||||
user: "10001:10001"
|
||||
network_mode: service:otel-collector
|
||||
environment: {READ_PORT: "8888", INGEST_PORT: "8888", MODE: scrape}
|
||||
volumes:
|
||||
- ./infra/haproxy/telemetry.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: otel-collector}}
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.1.0@sha256:6559acbd5d770b15bb3c954629ce190ac3cbbdb2b7f1c30f0385c4e05104e218
|
||||
<<: *lockdown
|
||||
image: prom/prometheus:v3.1.0
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=7d
|
||||
- --storage.tsdb.retention.size=1GB
|
||||
- --web.enable-otlp-receiver
|
||||
- --web.listen-address=127.0.0.1:9090
|
||||
volumes:
|
||||
- ./infra/prometheus:/etc/prometheus:ro
|
||||
- prometheusdata:/prometheus
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: prometheus}}
|
||||
networks: [telemetry]
|
||||
depends_on:
|
||||
bootstrap: {condition: service_completed_successfully}
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 512M }
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9090/-/ready"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
restart: unless-stopped
|
||||
limits: {cpus: "0.5", memory: 512M}
|
||||
|
||||
prometheus-tls:
|
||||
<<: *telemetry-proxy
|
||||
user: "65534:65534"
|
||||
network_mode: service:prometheus
|
||||
environment: {READ_PORT: "9090", INGEST_PORT: "9090", MODE: backend}
|
||||
volumes:
|
||||
- ./infra/haproxy/telemetry.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: prometheus}}
|
||||
|
||||
loki:
|
||||
image: grafana/loki:3.3.2@sha256:8af2de1abbdd7aa92b27c9bcc96f0f4140c9096b507c77921ffddf1c6ad6c48f
|
||||
<<: *lockdown
|
||||
image: grafana/loki:3.3.2
|
||||
command: ["-config.file=/etc/loki/loki.yaml"]
|
||||
volumes:
|
||||
- ./infra/loki/loki.yaml:/etc/loki/loki.yaml:ro
|
||||
- lokidata:/loki
|
||||
networks: [telemetry]
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 512M }
|
||||
restart: unless-stopped
|
||||
limits: {cpus: "0.5", memory: 512M}
|
||||
|
||||
loki-tls:
|
||||
<<: *telemetry-proxy
|
||||
user: "10001:10001"
|
||||
network_mode: service:loki
|
||||
environment: {READ_PORT: "3100", INGEST_PORT: "3100", MODE: backend}
|
||||
volumes:
|
||||
- ./infra/haproxy/telemetry.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: loki}}
|
||||
depends_on:
|
||||
bootstrap: {condition: service_completed_successfully}
|
||||
|
||||
tempo:
|
||||
image: grafana/tempo:2.6.1@sha256:ef4384fce6e8ad22b95b243d8fc165628cda655376fd50e7850536ad89d71d50
|
||||
<<: *lockdown
|
||||
image: grafana/tempo:2.6.1
|
||||
command: ["-config.file=/etc/tempo/tempo.yaml"]
|
||||
volumes:
|
||||
- ./infra/tempo/tempo.yaml:/etc/tempo/tempo.yaml:ro
|
||||
- tempodata:/var/tempo
|
||||
networks: [telemetry]
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 512M }
|
||||
restart: unless-stopped
|
||||
limits: {cpus: "0.5", memory: 512M}
|
||||
|
||||
tempo-tls:
|
||||
<<: *telemetry-proxy
|
||||
user: "10001:10001"
|
||||
network_mode: service:tempo
|
||||
environment: {READ_PORT: "3200", INGEST_PORT: "4318", MODE: backend}
|
||||
volumes:
|
||||
- ./infra/haproxy/telemetry.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: tempo}}
|
||||
depends_on:
|
||||
bootstrap: {condition: service_completed_successfully}
|
||||
|
||||
grafana:
|
||||
<<: *lockdown
|
||||
image: grafana/grafana:11.4.0@sha256:d8ea37798ccc41061a62ab080f2676dda6bf7815558499f901bdb0f533a456fb
|
||||
entrypoint: ["sh", "/work/grafana.sh"]
|
||||
ports:
|
||||
- "127.0.0.1:${GRAFANA_PORT:-3000}:3000"
|
||||
environment:
|
||||
GF_SERVER_PROTOCOL: https
|
||||
GF_SERVER_CERT_FILE: /run/tls/grafana.crt
|
||||
GF_SERVER_CERT_KEY: /run/tls/grafana.key
|
||||
GF_SECURITY_ADMIN_USER: admin
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/admin_password
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
||||
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
|
||||
GF_USERS_VIEWERS_CAN_EDIT: "true"
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/tls/admin_password
|
||||
GF_SECURITY_COOKIE_SECURE: "true"
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
||||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||||
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
||||
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
|
||||
GF_NEWS_NEWS_FEED_ENABLED: "false"
|
||||
volumes:
|
||||
- ./infra/grafana/start.sh:/work/grafana.sh:ro
|
||||
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
||||
- grafanadata:/var/lib/grafana
|
||||
- { type: volume, source: secrets, target: /run/secrets, read_only: true, volume: { subpath: grafana } }
|
||||
networks: [default, telemetry]
|
||||
- {type: volume, source: secrets, target: /run/tls, read_only: true, volume: {subpath: grafana}}
|
||||
networks: [telemetry, admin]
|
||||
depends_on:
|
||||
bootstrap: {condition: service_completed_successfully}
|
||||
prometheus-tls: {condition: service_started}
|
||||
loki-tls: {condition: service_started}
|
||||
tempo-tls: {condition: service_started}
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.5", memory: 256M }
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/api/health"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
depends_on:
|
||||
bootstrap:
|
||||
condition: service_completed_successfully
|
||||
prometheus:
|
||||
condition: service_healthy
|
||||
loki:
|
||||
condition: service_started
|
||||
tempo:
|
||||
condition: service_started
|
||||
restart: unless-stopped
|
||||
limits: {cpus: "0.5", memory: 256M}
|
||||
|
||||
checks:
|
||||
<<: *lockdown
|
||||
@@ -400,3 +451,4 @@ volumes:
|
||||
networks:
|
||||
telemetry:
|
||||
internal: true
|
||||
admin:
|
||||
|
||||
Reference in New Issue
Block a user