{ "name": "mtusi-lab7", "services": { "s3": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/s3.cfg:/etc/haproxy.cfg:ro", "./pki/s3:/tls:ro" ], "networks": [ "backend" ] }, "broker": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/broker.cfg:/etc/haproxy.cfg:ro", "./pki/broker:/tls:ro" ], "networks": [ "backend" ] }, "redis": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/redis.cfg:/etc/haproxy.cfg:ro", "./pki/redis:/tls:ro" ], "networks": [ "backend" ] }, "otel-collector": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/otel-collector.cfg:/etc/haproxy.cfg:ro", "./pki/otel-collector:/tls:ro" ], "networks": [ "backend" ] }, "tempo": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/tempo.cfg:/etc/haproxy.cfg:ro", "./pki/tempo:/tls:ro" ], "networks": [ "backend" ] }, "loki": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/loki.cfg:/etc/haproxy.cfg:ro", "./pki/loki:/tls:ro" ], "networks": [ "backend" ] }, "prometheus": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/tls/prometheus.cfg:/etc/haproxy.cfg:ro", "./pki/prometheus:/tls:ro" ], "networks": [ "backend" ] }, "postgres": { "image": "postgres:17-bookworm@sha256:837bed18782820fe967067cb5328b02b0d9992c1be9a37ee0c9c492cfc03af3b", "mem_limit": "512m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": false, "cap_add": [ "CHOWN", "SETUID", "SETGID", "DAC_OVERRIDE", "FOWNER" ], "environment": { "POSTGRES_USER": "messenger", "POSTGRES_DB": "messenger", "POSTGRES_PASSWORD_FILE": "/run/password" }, "volumes": [ "postgres_data:/var/lib/postgresql/data", "./pki/postgres:/tls:ro", "./secrets/postgres_password:/run/password:ro", "./secrets/pg-init.sql:/docker-entrypoint-initdb.d/01.sql:ro", "./infra/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro", "./infra/postgres-entrypoint.sh:/start.sh:ro" ], "entrypoint": [ "sh", "/start.sh" ], "networks": [ "backend" ], "healthcheck": { "test": [ "CMD", "pg_isready", "-h", "127.0.0.1", "-U", "messenger", "-d", "messenger" ], "interval": "2s", "timeout": "1s", "retries": 60 } }, "broker-raw": { "image": "redis:7.4-bookworm@sha256:2e3eb11462c4e3759e6972678dd051d150ff54b1e60714b3c33b701260172a90", "mem_limit": "192m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "999:999", "command": [ "redis-server", "/etc/redis.conf" ], "network_mode": "service:broker", "depends_on": [ "broker" ], "volumes": [ "./secrets/broker.conf:/etc/redis.conf:ro", "broker_data:/data" ] }, "redis-raw": { "image": "redis:7.4-bookworm@sha256:2e3eb11462c4e3759e6972678dd051d150ff54b1e60714b3c33b701260172a90", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "999:999", "command": [ "redis-server", "/etc/redis.conf" ], "network_mode": "service:redis", "depends_on": [ "redis" ], "volumes": [ "./secrets/redis.conf:/etc/redis.conf:ro" ] }, "s3-store": { "image": "chrislusf/seaweedfs:4.51@sha256:f7a49e3f3972ebed5be2ed4befa4a0c68eb7bdddba6e692d42729ceb545134b8", "mem_limit": "512m", "cpus": 0.5, "tmpfs": [ "/tmp:size=64m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "mini", "-dir=/data", "-ip=127.0.0.1", "-ip.bind=127.0.0.1", "-s3=false", "-admin.ui=false", "-webdav=false", "-master.telemetry=false", "-master.volumeSizeLimitMB=128", "-volume.max=16", "-volume.fileSizeLimitMB=11", "-volume.concurrentUploadLimitMB=64", "-volume.concurrentDownloadLimitMB=64" ], "network_mode": "service:s3", "depends_on": [ "s3", "volume-init" ], "volumes": [ "s3_data:/data" ] }, "s3-raw": { "image": "chrislusf/seaweedfs:4.51@sha256:f7a49e3f3972ebed5be2ed4befa4a0c68eb7bdddba6e692d42729ceb545134b8", "mem_limit": "384m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "s3", "-filer=127.0.0.1:8888", "-ip.bind=127.0.0.1", "-port=8333", "-config=/run/s3_config", "-iam=false", "-port.iceberg=0", "-port.lance=0", "-concurrentFileUploadLimit=16", "-concurrentUploadLimitMB=32", "-readerCacheSizeMB=16" ], "network_mode": "service:s3", "depends_on": [ "s3-store" ], "volumes": [ "./secrets/s3_config:/run/s3_config:ro" ] }, "bao": { "image": "openbao/openbao:2.4.4@sha256:595c83b42614a4d2b044608e4593c05b019c5db25bc9c185d8fff3ac96c03ddd", "mem_limit": "256m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "100:1000", "entrypoint": [ "bao" ], "command": [ "server", "-config=/etc/bao.hcl" ], "depends_on": [ "volume-init" ], "networks": [ "backend", "edge" ], "ports": [ "127.0.0.1:${BAO_PORT:-18207}:8200" ], "volumes": [ "bao_data:/bao/data", "./infra/openbao/config.hcl:/etc/bao.hcl:ro", "./pki/bao:/tls:ro" ] }, "volume-init": { "image": "mtusi-messenger:lab7", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "0:0", "cap_add": [ "CHOWN" ], "network_mode": "none", "entrypoint": [ "python", "-c", "import os\nfor base,uid,gid in [('/s3',10001,10001),('/bao',100,1000)]:\n os.chown(base,uid,gid)\n for root,dirs,files in os.walk(base):\n for name in dirs+files:os.chown(os.path.join(root,name),uid,gid)\n" ], "volumes": [ "s3_data:/s3", "bao_data:/bao" ] }, "api": { "image": "mtusi-messenger:lab7", "mem_limit": "256m", "cpus": 1, "tmpfs": [ "/tmp:size=128m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "python", "src/server.py" ], "environment": { "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "HTTP_WORKERS": "16", "DB_POOL_MAX": "8", "DB_ACCESS_MODE": "optimized", "S3_ENDPOINT": "https://s3:8443", "S3_BUCKET": "messenger-attachments", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:8443", "TRACE_SAMPLE_RATIO": "${TRACE_SAMPLE_RATIO:-0.25}", "JOB_LEASE_SECONDS": "10", "JOB_TIMEOUT_SECONDS": "20", "WORKER_CONCURRENCY": "1", "LOG_LEVEL": "WARNING", "BAO_ROLE": "api" }, "networks": [ "backend" ], "volumes": [ "./pki/api:/tls:ro" ], "depends_on": { "migrate": { "condition": "service_completed_successfully" }, "bucket-bootstrap": { "condition": "service_completed_successfully" } }, "build": ".", "deploy": { "replicas": 2 } }, "worker": { "image": "mtusi-messenger:lab7", "mem_limit": "768m", "cpus": 1, "tmpfs": [ "/tmp:size=128m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "python", "src/pipeline.py", "work" ], "environment": { "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "HTTP_WORKERS": "16", "DB_POOL_MAX": "8", "DB_ACCESS_MODE": "optimized", "S3_ENDPOINT": "https://s3:8443", "S3_BUCKET": "messenger-attachments", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:8443", "TRACE_SAMPLE_RATIO": "${TRACE_SAMPLE_RATIO:-0.25}", "JOB_LEASE_SECONDS": "10", "JOB_TIMEOUT_SECONDS": "20", "WORKER_CONCURRENCY": "1", "LOG_LEVEL": "WARNING", "BAO_ROLE": "worker" }, "networks": [ "backend" ], "volumes": [ "./pki/worker:/tls:ro" ], "depends_on": { "migrate": { "condition": "service_completed_successfully" }, "bucket-bootstrap": { "condition": "service_completed_successfully" } } }, "dispatcher": { "image": "mtusi-messenger:lab7", "mem_limit": "256m", "cpus": 1, "tmpfs": [ "/tmp:size=128m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "python", "src/pipeline.py", "dispatch" ], "environment": { "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "HTTP_WORKERS": "16", "DB_POOL_MAX": "8", "DB_ACCESS_MODE": "optimized", "S3_ENDPOINT": "https://s3:8443", "S3_BUCKET": "messenger-attachments", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:8443", "TRACE_SAMPLE_RATIO": "${TRACE_SAMPLE_RATIO:-0.25}", "JOB_LEASE_SECONDS": "10", "JOB_TIMEOUT_SECONDS": "20", "WORKER_CONCURRENCY": "1", "LOG_LEVEL": "WARNING", "BAO_ROLE": "dispatcher" }, "networks": [ "backend" ], "volumes": [ "./pki/dispatcher:/tls:ro" ], "depends_on": { "migrate": { "condition": "service_completed_successfully" }, "bucket-bootstrap": { "condition": "service_completed_successfully" } } }, "migrate": { "image": "mtusi-messenger:lab7", "mem_limit": "128m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "python", "src/migrate.py" ], "environment": { "DATABASE_URL_FILE": "/run/dsn" }, "volumes": [ "./secrets/migration_database_url:/run/dsn:ro", "./pki/operator:/tls:ro" ], "networks": [ "backend" ], "depends_on": { "postgres": { "condition": "service_healthy" } } }, "bucket-bootstrap": { "image": "mtusi-messenger:lab7", "mem_limit": "128m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "python", "src/bucket_bootstrap.py" ], "environment": { "S3_ENDPOINT": "https://s3:8443", "S3_ACCESS_KEY_ID_FILE": "/run/s3_key", "S3_SECRET_ACCESS_KEY_FILE": "/run/s3_secret" }, "volumes": [ "./pki/operator:/tls:ro", "./secrets/s3_admin_key:/run/s3_key:ro", "./secrets/s3_admin_secret:/run/s3_secret:ro" ], "networks": [ "backend" ], "depends_on": [ "s3-raw" ] }, "lb": { "image": "haproxy:3.0-alpine@sha256:7430e63d3052198b18a40665b59a5826bc428e8bceb0c561d82258149ef855ee", "mem_limit": "64m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "10001:10001", "command": [ "haproxy", "-W", "-db", "-f", "/etc/haproxy.cfg" ], "volumes": [ "./infra/haproxy.cfg:/etc/haproxy.cfg:ro", "./pki/lb:/tls:ro" ], "networks": [ "edge", "backend" ], "ports": [ "127.0.0.1:${APP_PORT:-18443}:8443" ], "depends_on": [ "api" ] }, "otel-collector-raw": { "image": "otel/opentelemetry-collector-contrib:0.132.0@sha256:e0f565815b2b8e78eb9fdbb80f6190c921ab323aaa8ccceab3255c6d4225f4af", "mem_limit": "256m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "command": [ "--config=/etc/otel.yaml" ], "volumes": [ "./infra/otel-collector.yaml:/etc/otel.yaml:ro", "./pki/collector:/client:ro" ], "network_mode": "service:otel-collector", "depends_on": [ "otel-collector" ] }, "prometheus-raw": { "image": "prom/prometheus:v3.5.0@sha256:63805ebb8d2b3920190daf1cb14a60871b16fd38bed42b857a3182bc621f4996", "mem_limit": "256m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "command": [ "--config.file=/etc/prometheus.yaml", "--web.listen-address=127.0.0.1:9090", "--storage.tsdb.path=/prometheus", "--storage.tsdb.retention.time=24h", "--storage.tsdb.retention.size=256MB" ], "volumes": [ "./infra/prometheus.yaml:/etc/prometheus.yaml:ro", "./infra/alerts.yaml:/etc/prometheus/alerts.yaml:ro", "./pki/prometheus:/tls:ro", "metrics_data:/prometheus" ], "network_mode": "service:prometheus", "depends_on": [ "prometheus" ] }, "loki-raw": { "image": "grafana/loki:3.5.3@sha256:3165cecce301ce5b9b6e3530284b080934a05cd5cafac3d3d82edcb887b45ecd", "mem_limit": "256m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "command": [ "-config.file=/etc/loki.yaml" ], "volumes": [ "./infra/loki.yaml:/etc/loki.yaml:ro", "logs_data:/loki" ], "network_mode": "service:loki", "depends_on": [ "loki" ] }, "tempo-raw": { "image": "grafana/tempo:2.8.2@sha256:0ef775495967cd5d7a6b2e146b6ea695d624803c8db8349fb8ce4164f719f9b7", "mem_limit": "384m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "command": [ "-config.file=/etc/tempo.yaml" ], "volumes": [ "./infra/tempo.yaml:/etc/tempo.yaml:ro", "traces_data:/var/tempo" ], "network_mode": "service:tempo", "depends_on": [ "tempo" ] }, "grafana": { "image": "grafana/grafana:12.1.1@sha256:a1701c2180249361737a99a01bc770db39381640e4d631825d38ff4535efa47d", "mem_limit": "256m", "cpus": 0.5, "tmpfs": [ "/tmp:size=32m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "environment": { "GF_SERVER_PROTOCOL": "https", "GF_SERVER_CERT_FILE": "/tls/tls.crt", "GF_SERVER_CERT_KEY": "/tls/tls.key", "GF_SECURITY_ADMIN_USER": "operator", "GF_SECURITY_ADMIN_PASSWORD__FILE": "/run/password", "GF_AUTH_ANONYMOUS_ENABLED": "false", "GF_USERS_ALLOW_SIGN_UP": "false", "GF_ANALYTICS_REPORTING_ENABLED": "false", "GF_ANALYTICS_CHECK_FOR_UPDATES": "false", "GF_SERVER_ROOT_URL": "https://localhost:${GRAFANA_PORT:-13407}" }, "networks": [ "backend", "edge" ], "ports": [ "127.0.0.1:${GRAFANA_PORT:-13407}:3000" ], "volumes": [ "./pki/grafana:/tls:ro", "./secrets/grafana_admin:/run/password:ro", "./secrets/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/lab7.yaml:ro", "./infra/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro", "./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro", "grafana_data:/var/lib/grafana" ] }, "audit": { "image": "mtusi-messenger:lab7", "mem_limit": "768m", "cpus": 0.5, "tmpfs": [ "/tmp:size=128m,mode=1777" ], "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "user": "0:0", "profiles": [ "tools" ], "entrypoint": [ "python" ], "environment": { "BASE_URL": "https://lb:8443", "CA_FILE": "/tls/ca.crt", "DATABASE_URL_FILE": "/operator/database_url", "S3_ENDPOINT": "https://s3:8443", "S3_ACCESS_KEY_ID_FILE": "/run/s3_key", "S3_SECRET_ACCESS_KEY_FILE": "/run/s3_secret", "BROKER_URL_FILE": "/operator/broker_url", "TELEMETRY_ENABLED": "0", "JOB_LEASE_SECONDS": "5" }, "networks": [ "backend" ], "volumes": [ "./pki/operator:/tls:ro", "./tests:/app/tests:ro", "./student-tests:/app/student-tests:ro", "./contracts:/app/contracts:ro", "./lab.json:/app/lab.json:ro", "./pki:/identities:ro", "./secrets/s3_admin_key:/run/s3_key:ro", "./secrets/s3_admin_secret:/run/s3_secret:ro", "./operator/settings.json:/operator/settings.json:ro", "./operator/database_url:/operator/database_url:ro", "./operator/broker_url:/operator/broker_url:ro", "./operator/revoked-worker-settings.json:/operator/revoked-worker-settings.json:ro" ], "cap_add": [ "DAC_OVERRIDE" ] } }, "networks": { "backend": { "internal": true }, "edge": {} }, "volumes": { "postgres_data": {}, "broker_data": {}, "s3_data": {}, "bao_data": {}, "metrics_data": {}, "logs_data": {}, "traces_data": {}, "grafana_data": {} } }