forked from mtusi2026/mtusi2026lab6
Реализовать минимум наблюдаемости: OTLP, хранилища и Grafana
This commit is contained in:
+62
-1
@@ -2,8 +2,10 @@ name: lyakhonov-lab6
|
||||
|
||||
x-app: &app
|
||||
image: lyakhonov-messenger:lab6
|
||||
build: .
|
||||
environment:
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
|
||||
TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-1}
|
||||
TRACE_SAMPLE_RATIO: ${TRACE_SAMPLE_RATIO:-1}
|
||||
DATABASE_URL_FILE: /run/secrets/database_url
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_ACCESS_KEY_FILE: /run/secrets/s3_access_key
|
||||
@@ -28,6 +30,58 @@ x-dependencies: &dependencies
|
||||
condition: service_completed_successfully
|
||||
|
||||
services:
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:0.137.0
|
||||
command: [--config=/etc/otelcol/config.yaml]
|
||||
volumes: [./infra/otel/collector.yaml:/etc/otelcol/config.yaml:ro]
|
||||
cpus: 0.5
|
||||
mem_limit: 256m
|
||||
restart: unless-stopped
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.7.3
|
||||
command: [--config.file=/etc/prometheus/prometheus.yaml, --storage.tsdb.retention.time=24h, --storage.tsdb.retention.size=512MB]
|
||||
volumes: [./infra/otel/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro, ./infra/otel/alerts.yaml:/etc/prometheus/alerts.yaml:ro, metrics_data:/prometheus]
|
||||
cpus: 0.5
|
||||
mem_limit: 384m
|
||||
restart: unless-stopped
|
||||
loki:
|
||||
image: grafana/loki:3.5.7
|
||||
command: [-config.file=/etc/loki/config.yaml]
|
||||
volumes: [./infra/otel/loki.yaml:/etc/loki/config.yaml:ro, logs_data:/loki]
|
||||
cpus: 0.5
|
||||
mem_limit: 384m
|
||||
restart: unless-stopped
|
||||
tempo:
|
||||
image: grafana/tempo:2.9.0
|
||||
command: [-config.file=/etc/tempo.yaml]
|
||||
volumes: [./infra/otel/tempo.yaml:/etc/tempo.yaml:ro, traces_data:/var/tempo]
|
||||
cpus: 0.5
|
||||
mem_limit: 384m
|
||||
restart: unless-stopped
|
||||
grafana:
|
||||
image: grafana/grafana:12.2.1
|
||||
ports: ['127.0.0.1:${GRAFANA_PORT:-3006}:3000']
|
||||
environment:
|
||||
GF_AUTH_ANONYMOUS_ENABLED: 'true'
|
||||
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_password
|
||||
GF_USERS_ALLOW_SIGN_UP: 'false'
|
||||
GF_ANALYTICS_REPORTING_ENABLED: 'false'
|
||||
GF_ANALYTICS_CHECK_FOR_UPDATES: 'false'
|
||||
secrets: [grafana_password]
|
||||
volumes: [grafana_data:/var/lib/grafana, ./infra/grafana/provisioning:/etc/grafana/provisioning:ro, ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro]
|
||||
cpus: 0.5
|
||||
mem_limit: 384m
|
||||
restart: unless-stopped
|
||||
diagnostics:
|
||||
<<: *app
|
||||
command: [python, -m, src.diagnostics]
|
||||
depends_on: *dependencies
|
||||
healthcheck:
|
||||
disable: true
|
||||
cpus: 0.25
|
||||
mem_limit: 128m
|
||||
restart: unless-stopped
|
||||
inspector:
|
||||
<<: *app
|
||||
profiles: [tools]
|
||||
@@ -107,6 +161,7 @@ services:
|
||||
disable: true
|
||||
api:
|
||||
<<: *app
|
||||
build: .
|
||||
depends_on: *dependencies
|
||||
deploy:
|
||||
replicas: ${API_REPLICAS:-2}
|
||||
@@ -155,6 +210,8 @@ services:
|
||||
stop_grace_period: 12s
|
||||
|
||||
secrets:
|
||||
grafana_password:
|
||||
file: ./secrets/grafana_password
|
||||
s3_root_user:
|
||||
file: ./secrets/s3_root_user
|
||||
s3_root_password:
|
||||
@@ -175,3 +232,7 @@ volumes:
|
||||
postgres_data:
|
||||
s3_data:
|
||||
broker_data:
|
||||
metrics_data:
|
||||
logs_data:
|
||||
traces_data:
|
||||
grafana_data:
|
||||
|
||||
Reference in New Issue
Block a user