forked from mtusi2026/mtusi2026lab7
3grade_1change
This commit is contained in:
+226
@@ -0,0 +1,226 @@
|
||||
x-api-common: &api-common
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
- OPENBAO_ADDR=http://openbao:8200
|
||||
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
- OTEL_SERVICE_NAME=messenger-api
|
||||
- OTEL_RESOURCE_ATTRIBUTES=deployment.environment=lab7
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
broker:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
openbao:
|
||||
condition: service_started
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
otel-collector:
|
||||
condition: service_started
|
||||
|
||||
services:
|
||||
lb:
|
||||
image: nginx:1.25-alpine
|
||||
ports:
|
||||
- "8443:8443"
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./nginx/certs:/etc/nginx/certs:ro
|
||||
depends_on:
|
||||
- api1
|
||||
- api2
|
||||
|
||||
api1:
|
||||
<<: *api-common
|
||||
expose:
|
||||
- "8080"
|
||||
|
||||
api2:
|
||||
<<: *api-common
|
||||
expose:
|
||||
- "8080"
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.worker
|
||||
command: python -m worker.main
|
||||
environment:
|
||||
- OPENBAO_ADDR=http://openbao:8200
|
||||
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
||||
- OTEL_SERVICE_NAME=messenger-worker
|
||||
- OTEL_RESOURCE_ATTRIBUTES=deployment.environment=lab7
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
broker:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
openbao:
|
||||
condition: service_started
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
otel-collector:
|
||||
condition: service_started
|
||||
|
||||
migrate:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
command: python scripts/migrate.py
|
||||
environment:
|
||||
- OPENBAO_ADDR=http://openbao:8200
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
openbao:
|
||||
condition: service_started
|
||||
|
||||
openbao:
|
||||
image: openbao/openbao:2.0.0
|
||||
command: server -config=/openbao/config.hcl
|
||||
volumes:
|
||||
- ./infra/openbao/config.hcl:/openbao/config.hcl:ro
|
||||
- openbaodata:/openbao/data
|
||||
cap_add:
|
||||
- IPC_LOCK
|
||||
ports:
|
||||
- "8200:8200"
|
||||
|
||||
init-openbao:
|
||||
image: alpine/curl:latest
|
||||
volumes:
|
||||
- ./scripts/init_openbao.sh:/init_openbao.sh:ro
|
||||
command: sh /init_openbao.sh
|
||||
depends_on:
|
||||
openbao:
|
||||
condition: service_started
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=messenger
|
||||
- POSTGRES_PASSWORD=messenger_password
|
||||
- POSTGRES_DB=messenger
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
minio:
|
||||
image: pgsty/silo:latest
|
||||
command: server /data --console-address ":9001"
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- s3data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
|
||||
broker:
|
||||
image: rabbitmq:3.13-alpine
|
||||
environment:
|
||||
- RABBITMQ_DEFAULT_USER=guest
|
||||
- RABBITMQ_DEFAULT_PASS=guest
|
||||
volumes:
|
||||
- brokerdata:/var/lib/rabbitmq
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
command: redis-server --appendonly yes
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:0.95.0
|
||||
command: ["--config=/etc/otelcol/config.yaml"]
|
||||
volumes:
|
||||
- ./observability/otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
|
||||
depends_on:
|
||||
- tempo
|
||||
- loki
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.51.0
|
||||
command:
|
||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||
- "--storage.tsdb.path=/prometheus"
|
||||
volumes:
|
||||
- ./observability/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- ./observability/prometheus/alerts.yml:/etc/prometheus/alerts.yml:ro
|
||||
- promdata:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
|
||||
loki:
|
||||
image: grafana/loki:2.9.4
|
||||
command: -config.file=/etc/loki/local-config.yaml
|
||||
volumes:
|
||||
- ./observability/loki/loki-config.yaml:/etc/loki/local-config.yaml:ro
|
||||
- lokidata:/loki
|
||||
ports:
|
||||
- "3100:3100"
|
||||
|
||||
tempo:
|
||||
image: grafana/tempo:2.4.0
|
||||
command: [ "-config.file=/etc/tempo.yaml" ]
|
||||
volumes:
|
||||
- ./observability/tempo/tempo-config.yaml:/etc/tempo.yaml:ro
|
||||
- tempodata:/var/tempo
|
||||
ports:
|
||||
- "3200:3200"
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:10.4.1
|
||||
environment:
|
||||
- GF_AUTH_ANONYMOUS_ENABLED=true
|
||||
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
|
||||
- GF_AUTH_DISABLE_LOGIN_FORM=true
|
||||
- GF_PATHS_DASHBOARDS=/var/lib/grafana/dashboards
|
||||
volumes:
|
||||
- grafanadata:/var/lib/grafana
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- prometheus
|
||||
- loki
|
||||
- tempo
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
s3data:
|
||||
brokerdata:
|
||||
redisdata:
|
||||
promdata:
|
||||
lokidata:
|
||||
tempodata:
|
||||
grafanadata:
|
||||
openbaodata:
|
||||
Reference in New Issue
Block a user