completed lab6
This commit is contained in:
+124
@@ -0,0 +1,124 @@
|
||||
name: mtusi2026lab6
|
||||
x-app: &app
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
environment: &env
|
||||
DATABASE_URL: postgresql://messenger:${POSTGRES_PASSWORD:?Run scripts/bootstrap.sh}@postgres:5432/messenger
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_BUCKET: messenger-attachments
|
||||
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
|
||||
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
|
||||
BROKER_URL: amqp://messenger:${BROKER_PASSWORD}@broker:5672/%2F
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
|
||||
depends_on:
|
||||
postgres: {condition: service_healthy}
|
||||
broker: {condition: service_healthy}
|
||||
s3-init: {condition: service_completed_successfully}
|
||||
otel-collector: {condition: service_started}
|
||||
healthcheck:
|
||||
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready', timeout=15)"]
|
||||
interval: 10s
|
||||
timeout: 20s
|
||||
retries: 5
|
||||
services:
|
||||
api1:
|
||||
<<: *app
|
||||
environment:
|
||||
<<: *env
|
||||
INSTANCE_ID: api1
|
||||
api2:
|
||||
<<: *app
|
||||
environment:
|
||||
<<: *env
|
||||
INSTANCE_ID: api2
|
||||
worker:
|
||||
<<: *app
|
||||
command: [python, -m, app.worker]
|
||||
healthcheck: {disable: true}
|
||||
lb:
|
||||
image: haproxy:3.0.11-alpine
|
||||
ports: ['127.0.0.1:8080:8080']
|
||||
volumes: ['./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro']
|
||||
depends_on: [api1, api2]
|
||||
restart: unless-stopped
|
||||
postgres:
|
||||
image: postgres:17.5-alpine
|
||||
environment:
|
||||
POSTGRES_DB: messenger
|
||||
POSTGRES_USER: messenger
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes: [postgres:/var/lib/postgresql/data]
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'pg_isready -U messenger -d messenger']
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
s3:
|
||||
image: chrislusf/seaweedfs:3.85
|
||||
command: [server, '-dir=/data', '-ip=s3', '-ip.bind=0.0.0.0', '-volume.max=5', '-s3', '-s3.port=9000', '-s3.config=/etc/seaweedfs/s3.json']
|
||||
volumes:
|
||||
- seaweed:/data
|
||||
- ./secrets/seaweed-s3.json:/etc/seaweedfs/s3.json:ro
|
||||
- ./infra/seaweedfs/filer.toml:/etc/seaweedfs/filer.toml:ro
|
||||
restart: unless-stopped
|
||||
s3-init:
|
||||
build: .
|
||||
depends_on: [s3]
|
||||
environment:
|
||||
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
|
||||
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_BUCKET: messenger-attachments
|
||||
command: [python, -m, app.init_storage]
|
||||
broker:
|
||||
image: rabbitmq:4.1.0-alpine
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: messenger
|
||||
RABBITMQ_DEFAULT_PASS: ${BROKER_PASSWORD}
|
||||
volumes: [broker:/var/lib/rabbitmq]
|
||||
healthcheck:
|
||||
test: [CMD, rabbitmq-diagnostics, -q, ping]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:0.128.0
|
||||
command: ['--config=/etc/otelcol/config.yaml']
|
||||
volumes: ['./infra/otel/collector.yaml:/etc/otelcol/config.yaml:ro']
|
||||
depends_on: [loki, tempo]
|
||||
restart: unless-stopped
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.4.0
|
||||
command: ['--config.file=/etc/prometheus/prometheus.yml', '--storage.tsdb.retention.time=7d']
|
||||
volumes: ['./infra/prometheus.yaml:/etc/prometheus/prometheus.yml:ro', 'prometheus:/prometheus']
|
||||
ports: ['127.0.0.1:9090:9090']
|
||||
loki:
|
||||
image: grafana/loki:3.5.0
|
||||
command: ['-config.file=/etc/loki/local.yaml']
|
||||
volumes: ['./infra/loki.yaml:/etc/loki/local.yaml:ro', 'loki:/loki']
|
||||
ports: ['127.0.0.1:3100:3100']
|
||||
tempo:
|
||||
image: grafana/tempo:2.7.2
|
||||
command: ['-config.file=/etc/tempo.yaml']
|
||||
volumes: ['./infra/tempo.yaml:/etc/tempo.yaml:ro', 'tempo:/var/tempo']
|
||||
ports: ['127.0.0.1:3200:3200']
|
||||
grafana:
|
||||
image: grafana/grafana:12.0.1
|
||||
environment:
|
||||
GF_SECURITY_ADMIN_USER: admin
|
||||
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
|
||||
GF_USERS_ALLOW_SIGN_UP: 'false'
|
||||
ports: ['127.0.0.1:3000:3000']
|
||||
volumes:
|
||||
- grafana:/var/lib/grafana
|
||||
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
||||
volumes:
|
||||
postgres:
|
||||
s3:
|
||||
seaweed:
|
||||
broker:
|
||||
prometheus:
|
||||
loki:
|
||||
tempo:
|
||||
grafana:
|
||||
Reference in New Issue
Block a user