forked from mtusi2026/mtusi2026lab7
LB ходит в API только с клиентским сертификатом нужной identity, остальные связи проверяют серверный сертификат, root token в приложение не попадает. Co-authored-by: Cursor <cursoragent@cursor.com>
657 lines
19 KiB
YAML
657 lines
19 KiB
YAML
# Client -TLS-> lb:8443 -mTLS-> api x2. API listens on 127.0.0.1 only.
|
|
# Postgres, Redis, RabbitMQ (via local mTLS proxy), S3 (via local TLS proxy),
|
|
# the collector and OpenBao are TLS. Secrets are read from OpenBao with AppRole.
|
|
# Run scripts/bootstrap.ps1 before the first start: it creates certs, unseals
|
|
# OpenBao and does not print secret values.
|
|
|
|
x-app-hardening: &app-hardening
|
|
read_only: true
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,size=64m
|
|
pids_limit: 128
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16.6-alpine
|
|
environment:
|
|
POSTGRES_USER: messenger
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/db_super_password
|
|
POSTGRES_DB: messenger
|
|
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
|
volumes:
|
|
- pg_data:/var/lib/postgresql/data
|
|
- ./infra/postgres/entrypoint.sh:/entrypoint.sh:ro
|
|
- ./infra/postgres/pg_hba.conf:/etc/postgres/pg_hba.conf:ro
|
|
- ./infra/postgres/grant.sh:/etc/postgres/grant.sh:ro
|
|
- ./certs/postgres.crt:/certs/postgres.crt:ro
|
|
- ./certs/postgres.key:/certs/postgres.key:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
secrets:
|
|
- db_super_password
|
|
- db_api_password
|
|
- db_worker_password
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|
|
restart: unless-stopped
|
|
mem_limit: ${POSTGRES_MEM:-512m}
|
|
cpus: ${POSTGRES_CPUS:-1.0}
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [data]
|
|
|
|
redis:
|
|
image: redis:7.4.2-alpine
|
|
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
|
volumes:
|
|
- redis_data:/data
|
|
- ./infra/redis/entrypoint.sh:/entrypoint.sh:ro
|
|
- ./certs/redis.crt:/certs/redis.crt:ro
|
|
- ./certs/redis.key:/certs/redis.key:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
secrets:
|
|
- redis_password
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD-SHELL",
|
|
"redis-cli --tls --cacert /tmp/ca.crt -p 6379 --user api --pass \"$$(cat /run/secrets/redis_password)\" ping | grep -q PONG",
|
|
]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 20
|
|
restart: unless-stopped
|
|
mem_limit: 128m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [data]
|
|
|
|
rabbitmq:
|
|
image: rabbitmq:3.13.7-alpine
|
|
hostname: rabbitmq
|
|
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
|
environment:
|
|
RABBITMQ_DEFAULT_USER: messenger_api
|
|
RABBITMQ_DEFAULT_PASS_FILE: /run/secrets/rabbit_api_password
|
|
volumes:
|
|
- rabbitmq_data:/var/lib/rabbitmq
|
|
- ./infra/rabbitmq/entrypoint.sh:/entrypoint.sh:ro
|
|
- ./certs/rabbitmq.crt:/certs/rabbitmq.crt:ro
|
|
- ./certs/rabbitmq.key:/certs/rabbitmq.key:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
secrets:
|
|
- rabbit_api_password
|
|
- rabbit_worker_password
|
|
healthcheck:
|
|
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 20s
|
|
restart: unless-stopped
|
|
mem_limit: 256m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [data]
|
|
|
|
rabbit-mtls:
|
|
image: haproxy:3.1.7-alpine
|
|
network_mode: service:rabbitmq
|
|
depends_on:
|
|
rabbitmq:
|
|
condition: service_started
|
|
volumes:
|
|
- ./infra/haproxy-rabbit.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
- ./certs/rabbitmq.pem:/certs/rabbitmq.pem:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,size=16m
|
|
- /var/run:rw,nosuid,size=8m
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
|
|
s3:
|
|
image: chrislusf/seaweedfs:3.85
|
|
entrypoint: ["/bin/sh", "/seaweed-entrypoint.sh"]
|
|
environment:
|
|
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
|
ports:
|
|
- "127.0.0.1:9000:9000"
|
|
volumes:
|
|
- s3_data:/data
|
|
- ./infra/s3/seaweed-entrypoint.sh:/seaweed-entrypoint.sh:ro
|
|
secrets:
|
|
- s3_admin_access
|
|
- s3_admin_secret
|
|
- s3_api_access
|
|
- s3_api_secret
|
|
- s3_worker_access
|
|
- s3_worker_secret
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:9333/cluster/status || exit 1"]
|
|
interval: 3s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 8s
|
|
restart: unless-stopped
|
|
mem_limit: 256m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [data]
|
|
|
|
s3-tls:
|
|
image: haproxy:3.1.7-alpine
|
|
network_mode: service:s3
|
|
depends_on:
|
|
s3:
|
|
condition: service_started
|
|
volumes:
|
|
- ./infra/haproxy-s3.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
- ./certs/s3.pem:/certs/s3.pem:ro
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,size=16m
|
|
- /var/run:rw,nosuid,size=8m
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
|
|
openbao:
|
|
image: openbao/openbao:2.2.0
|
|
entrypoint: ["bao"]
|
|
command: ["server", "-config=/openbao/config/openbao.hcl"]
|
|
volumes:
|
|
- bao_data:/openbao/file
|
|
- ./infra/openbao/openbao.hcl:/openbao/config/openbao.hcl:ro
|
|
- ./certs/openbao.crt:/certs/openbao.crt:ro
|
|
- ./certs/openbao.key:/certs/openbao.key:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
healthcheck:
|
|
test: ["CMD", "bao", "status", "-address=https://127.0.0.1:8200", "-ca-cert=/certs/ca.crt"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 40
|
|
start_period: 5s
|
|
restart: unless-stopped
|
|
mem_limit: 256m
|
|
cpus: "0.50"
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [data]
|
|
|
|
openbao-bootstrap:
|
|
profiles: ["bootstrap"]
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: mtusi-messenger:lab7
|
|
command: ["python", "-m", "app.tools.openbao_bootstrap"]
|
|
environment:
|
|
BAO_ADDR: https://openbao:8200
|
|
TLS_CA_FILE: /certs/ca.crt
|
|
BAO_INIT_FILE: /secrets/openbao-init.json
|
|
volumes:
|
|
- ./secrets:/secrets
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
- ./infra/openbao/policies:/policies:ro
|
|
- ./evidence:/evidence
|
|
networks: [data]
|
|
depends_on:
|
|
openbao:
|
|
condition: service_started
|
|
restart: "no"
|
|
|
|
migrate:
|
|
<<: *app-hardening
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: mtusi-messenger:lab7
|
|
command: ["python", "-m", "app.migrate"]
|
|
environment:
|
|
APP_ENV: lab
|
|
LOG_LEVEL: info
|
|
TLS_CA_FILE: /certs/ca.crt
|
|
BAO_ADDR: https://openbao:8200
|
|
BAO_CACERT: /certs/ca.crt
|
|
BAO_ROLE_ID_FILE: /run/secrets/migrate_role_id
|
|
BAO_SECRET_ID_FILE: /run/secrets/migrate_secret_id
|
|
BAO_SECRET_PATH: secret/data/messenger/migrate
|
|
DB_POOL_MIN: "1"
|
|
DB_POOL_MAX: "2"
|
|
MIGRATIONS_ON_START: "1"
|
|
secrets:
|
|
- source: migrate_role_id
|
|
target: migrate_role_id
|
|
- source: migrate_secret_id
|
|
target: migrate_secret_id
|
|
volumes:
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
openbao:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
mem_limit: 256m
|
|
cpus: "0.50"
|
|
networks: [data]
|
|
|
|
s3-init:
|
|
<<: *app-hardening
|
|
image: mtusi-messenger:lab7
|
|
command: ["python", "-m", "app.s3bootstrap"]
|
|
environment:
|
|
S3_ENDPOINT: https://s3:9000
|
|
S3_REGION: ${S3_REGION:-us-east-1}
|
|
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
|
TLS_CA_FILE: /certs/ca.crt
|
|
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_admin_access
|
|
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_admin_secret
|
|
secrets:
|
|
- source: s3_admin_access
|
|
target: s3_admin_access
|
|
- source: s3_admin_secret
|
|
target: s3_admin_secret
|
|
volumes:
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
depends_on:
|
|
s3:
|
|
condition: service_healthy
|
|
s3-tls:
|
|
condition: service_started
|
|
restart: "no"
|
|
networks: [data]
|
|
|
|
api:
|
|
<<: *app-hardening
|
|
image: mtusi-messenger:lab7
|
|
command: ["sh", "/scripts/api-entrypoint.sh"]
|
|
environment: &api-env
|
|
APP_HOST: 127.0.0.1
|
|
APP_PORT: "8080"
|
|
MTLS_PORT: "8443"
|
|
APP_ENV: lab
|
|
LOG_LEVEL: info
|
|
TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-1}
|
|
TRACE_SAMPLE_RATIO: ${TRACE_SAMPLE_RATIO:-1}
|
|
OTEL_SERVICE_NAME: messenger-api
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
|
|
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
|
OTEL_EXPORTER_OTLP_CERTIFICATE: /certs/ca.crt
|
|
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /certs/api-client.crt
|
|
OTEL_EXPORTER_OTLP_CLIENT_KEY: /certs/api-client.key
|
|
SERVICE_VERSION: lab7
|
|
SHUTDOWN_GRACE_SECONDS: "3"
|
|
LB_DRAIN_SECONDS: ${LB_DRAIN_SECONDS:-2}
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
CACHE_TTL_SECONDS: ${CACHE_TTL_SECONDS:-60}
|
|
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
|
|
SESSION_STORE: redis
|
|
S3_ENDPOINT: https://s3:9000
|
|
S3_REGION: ${S3_REGION:-us-east-1}
|
|
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
|
S3_PUBLIC_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-https://127.0.0.1:9000}
|
|
PRESIGN_TTL_SECONDS: ${PRESIGN_TTL_SECONDS:-60}
|
|
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760}
|
|
MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000}
|
|
ORPHAN_GRACE_SECONDS: ${ORPHAN_GRACE_SECONDS:-120}
|
|
S3_SWEEP_INTERVAL_SECONDS: ${S3_SWEEP_INTERVAL_SECONDS:-30}
|
|
TLS_CA_FILE: /certs/ca.crt
|
|
TLS_CERT_FILE: /certs/api-client.crt
|
|
TLS_KEY_FILE: /certs/api-client.key
|
|
TLS_SERVER_CERT_FILE: /certs/api.crt
|
|
TLS_SERVER_KEY_FILE: /certs/api.key
|
|
MTLS_ALLOW_FILE: /certs/allowed-lb.sha256
|
|
BAO_ADDR: https://openbao:8200
|
|
BAO_CACERT: /certs/ca.crt
|
|
BAO_ROLE_ID_FILE: /run/secrets/api_role_id
|
|
BAO_SECRET_ID_FILE: /run/secrets/api_secret_id
|
|
BAO_SECRET_PATH: secret/data/messenger/api
|
|
ARGON2_MEMORY_KIB: ${ARGON2_MEMORY_KIB:-19456}
|
|
ARGON2_ITERATIONS: ${ARGON2_ITERATIONS:-2}
|
|
ARGON2_PARALLELISM: ${ARGON2_PARALLELISM:-1}
|
|
LOGIN_RATE_LIMIT: ${LOGIN_RATE_LIMIT:-8}
|
|
LOGIN_RATE_WINDOW_SECONDS: ${LOGIN_RATE_WINDOW_SECONDS:-60}
|
|
DB_POOL_MIN: "1"
|
|
DB_POOL_MAX: ${DB_POOL_MAX:-4}
|
|
DB_COMMAND_TIMEOUT: "5"
|
|
DB_CONNECT_TIMEOUT: "5"
|
|
MIGRATIONS_ON_START: "0"
|
|
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
|
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-60}
|
|
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-86400}
|
|
secrets:
|
|
- source: api_role_id
|
|
target: api_role_id
|
|
- source: api_secret_id
|
|
target: api_secret_id
|
|
volumes:
|
|
- ./scripts/api-entrypoint.sh:/scripts/api-entrypoint.sh:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
- ./certs/api.crt:/certs/api.crt:ro
|
|
- ./certs/api.key:/certs/api.key:ro
|
|
- ./certs/api-client.crt:/certs/api-client.crt:ro
|
|
- ./certs/api-client.key:/certs/api-client.key:ro
|
|
- ./certs/allowed-lb.sha256:/certs/allowed-lb.sha256:ro
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
s3-init:
|
|
condition: service_completed_successfully
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
rabbit-mtls:
|
|
condition: service_started
|
|
openbao:
|
|
condition: service_healthy
|
|
expose:
|
|
- "8443"
|
|
restart: unless-stopped
|
|
mem_limit: ${API_MEM:-384m}
|
|
cpus: ${API_CPUS:-0.50}
|
|
stop_grace_period: 8s
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"python",
|
|
"-c",
|
|
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)",
|
|
]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 15s
|
|
networks: [app, data, signals]
|
|
|
|
lb:
|
|
image: haproxy:3.1.7-alpine
|
|
volumes:
|
|
- ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
- ./certs/lb.pem:/certs/lb.pem:ro
|
|
- ./certs/lb-client.pem:/certs/lb-client.pem:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
ports:
|
|
- "127.0.0.1:8443:8443"
|
|
depends_on:
|
|
api:
|
|
condition: service_started
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,size=16m
|
|
- /var/run:rw,nosuid,size=8m
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
mem_limit: 128m
|
|
cpus: "0.25"
|
|
networks: [app]
|
|
|
|
worker:
|
|
<<: *app-hardening
|
|
image: mtusi-messenger:lab7
|
|
command: ["python", "-m", "app.worker"]
|
|
environment:
|
|
APP_ENV: lab
|
|
LOG_LEVEL: info
|
|
TELEMETRY_ENABLED: ${TELEMETRY_ENABLED:-1}
|
|
TRACE_SAMPLE_RATIO: ${TRACE_SAMPLE_RATIO:-1}
|
|
OTEL_SERVICE_NAME: messenger-worker
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
|
|
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
|
OTEL_EXPORTER_OTLP_CERTIFICATE: /certs/ca.crt
|
|
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /certs/worker-client.crt
|
|
OTEL_EXPORTER_OTLP_CLIENT_KEY: /certs/worker-client.key
|
|
SERVICE_VERSION: lab7
|
|
S3_ENDPOINT: https://s3:9000
|
|
S3_REGION: ${S3_REGION:-us-east-1}
|
|
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
|
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760}
|
|
MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000}
|
|
TLS_CA_FILE: /certs/ca.crt
|
|
TLS_CERT_FILE: /certs/worker-client.crt
|
|
TLS_KEY_FILE: /certs/worker-client.key
|
|
BAO_ADDR: https://openbao:8200
|
|
BAO_CACERT: /certs/ca.crt
|
|
BAO_ROLE_ID_FILE: /run/secrets/worker_role_id
|
|
BAO_SECRET_ID_FILE: /run/secrets/worker_secret_id
|
|
BAO_SECRET_PATH: secret/data/messenger/worker
|
|
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-2}
|
|
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
|
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-60}
|
|
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-86400}
|
|
DB_POOL_MIN: "1"
|
|
DB_POOL_MAX: "4"
|
|
MIGRATIONS_ON_START: "0"
|
|
secrets:
|
|
- source: worker_role_id
|
|
target: worker_role_id
|
|
- source: worker_secret_id
|
|
target: worker_secret_id
|
|
volumes:
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
- ./certs/worker-client.crt:/certs/worker-client.crt:ro
|
|
- ./certs/worker-client.key:/certs/worker-client.key:ro
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
postgres:
|
|
condition: service_healthy
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
rabbit-mtls:
|
|
condition: service_started
|
|
s3-init:
|
|
condition: service_completed_successfully
|
|
openbao:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
mem_limit: 768m
|
|
cpus: "1.0"
|
|
stop_grace_period: 20s
|
|
networks: [data, signals]
|
|
|
|
otel-collector:
|
|
image: otel/opentelemetry-collector-contrib:0.128.0
|
|
command: ["--config=/etc/otel/collector.yaml"]
|
|
volumes:
|
|
- ./infra/otel/collector.yaml:/etc/otel/collector.yaml:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
- ./certs/tempo.crt:/certs/tempo.crt:ro
|
|
- ./certs/loki.crt:/certs/loki.crt:ro
|
|
- ./certs/prometheus.crt:/certs/prometheus.crt:ro
|
|
restart: unless-stopped
|
|
mem_limit: 320m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [signals, telemetry]
|
|
|
|
otel-mtls:
|
|
image: haproxy:3.1.7-alpine
|
|
network_mode: service:otel-collector
|
|
depends_on:
|
|
otel-collector:
|
|
condition: service_started
|
|
volumes:
|
|
- ./infra/haproxy-otel.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
- ./certs/otel.pem:/certs/otel.pem:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,size=16m
|
|
- /var/run:rw,nosuid,size=8m
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
|
|
prometheus:
|
|
image: prom/prometheus:v2.55.1
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
- --web.config.file=/etc/prometheus/web.yml
|
|
- --web.enable-remote-write-receiver
|
|
- --storage.tsdb.path=/prometheus
|
|
- --storage.tsdb.retention.time=7d
|
|
volumes:
|
|
- ./infra/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./infra/prometheus/alerts.yml:/etc/prometheus/alerts.yml:ro
|
|
- ./infra/prometheus/web.yml:/etc/prometheus/web.yml:ro
|
|
- ./certs/prometheus.crt:/certs/prometheus.crt:ro
|
|
- ./certs/prometheus.key:/certs/prometheus.key:ro
|
|
- prometheus_data:/prometheus
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [telemetry]
|
|
|
|
loki:
|
|
image: grafana/loki:3.3.2
|
|
command: ["-config.file=/etc/loki/loki.yml"]
|
|
volumes:
|
|
- ./infra/loki/loki.yml:/etc/loki/loki.yml:ro
|
|
- ./certs/loki.crt:/certs/loki.crt:ro
|
|
- ./certs/loki.key:/certs/loki.key:ro
|
|
- loki_data:/loki
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [telemetry]
|
|
|
|
tempo:
|
|
image: grafana/tempo:2.7.1
|
|
command: ["-config.file=/etc/tempo/tempo.yml"]
|
|
volumes:
|
|
- ./infra/tempo/tempo.yml:/etc/tempo/tempo.yml:ro
|
|
- ./certs/tempo.crt:/certs/tempo.crt:ro
|
|
- ./certs/tempo.key:/certs/tempo.key:ro
|
|
- tempo_data:/var/tempo
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [telemetry]
|
|
|
|
grafana:
|
|
image: grafana/grafana:11.4.0
|
|
entrypoint: ["/bin/sh", "/entrypoint.sh"]
|
|
environment:
|
|
GF_SECURITY_ADMIN_USER: admin
|
|
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
|
GF_USERS_DEFAULT_THEME: light
|
|
GF_SERVER_PROTOCOL: https
|
|
GF_SERVER_CERT_FILE: /certs/grafana.crt
|
|
GF_SERVER_CERT_KEY: /certs/grafana.key
|
|
SSL_CERT_FILE: /certs/ca.crt
|
|
ports:
|
|
- "127.0.0.1:3000:3000"
|
|
volumes:
|
|
- ./infra/grafana/entrypoint.sh:/entrypoint.sh:ro
|
|
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
- ./certs/grafana.crt:/certs/grafana.crt:ro
|
|
- ./certs/grafana.key:/certs/grafana.key:ro
|
|
- ./certs/ca.crt:/certs/ca.crt:ro
|
|
- grafana_data:/var/lib/grafana
|
|
secrets:
|
|
- source: grafana_password
|
|
target: grafana_password
|
|
depends_on:
|
|
- prometheus
|
|
- loki
|
|
- tempo
|
|
restart: unless-stopped
|
|
mem_limit: 256m
|
|
cpus: "0.50"
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
networks: [telemetry]
|
|
|
|
secrets:
|
|
db_super_password:
|
|
file: ./secrets/db_super_password
|
|
db_api_password:
|
|
file: ./secrets/db_api_password
|
|
db_worker_password:
|
|
file: ./secrets/db_worker_password
|
|
redis_password:
|
|
file: ./secrets/redis_password
|
|
rabbit_api_password:
|
|
file: ./secrets/rabbit_api_password
|
|
rabbit_worker_password:
|
|
file: ./secrets/rabbit_worker_password
|
|
s3_admin_access:
|
|
file: ./secrets/s3_admin_access
|
|
s3_admin_secret:
|
|
file: ./secrets/s3_admin_secret
|
|
s3_api_access:
|
|
file: ./secrets/s3_api_access
|
|
s3_api_secret:
|
|
file: ./secrets/s3_api_secret
|
|
s3_worker_access:
|
|
file: ./secrets/s3_worker_access
|
|
s3_worker_secret:
|
|
file: ./secrets/s3_worker_secret
|
|
grafana_password:
|
|
file: ./secrets/grafana_password
|
|
api_role_id:
|
|
file: ./secrets/api.role_id
|
|
api_secret_id:
|
|
file: ./secrets/api.secret_id
|
|
worker_role_id:
|
|
file: ./secrets/worker.role_id
|
|
worker_secret_id:
|
|
file: ./secrets/worker.secret_id
|
|
migrate_role_id:
|
|
file: ./secrets/migrate.role_id
|
|
migrate_secret_id:
|
|
file: ./secrets/migrate.secret_id
|
|
|
|
networks:
|
|
app:
|
|
data:
|
|
signals:
|
|
telemetry:
|
|
|
|
volumes:
|
|
pg_data:
|
|
redis_data:
|
|
s3_data:
|
|
rabbitmq_data:
|
|
prometheus_data:
|
|
loki_data:
|
|
tempo_data:
|
|
grafana_data:
|
|
bao_data:
|