{ "name": "mtusi-lab7", "services": { "api1": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "768m", "cpus": 2, "networks": [ "private" ], "environment": { "BAO_ENABLED": "1", "BAO_ADDR": "https://openbao:8200", "S3_ENDPOINT": "https://s3:9000", "S3_BUCKET": "messenger-attachments", "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:4319", "WORKER_CONCURRENCY": "2", "JOB_TIMEOUT_SECONDS": "10", "JOB_LEASE_SECONDS": "20", "MAX_PENDING_JOBS": "1000", "SERVICE_ROLE": "api1", "OTEL_SERVICE_NAME": "messenger-api", "INSTANCE_ID_FILE": "/run/identity/instance_id" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/api1:/run/tls:ro", "./identity/api1.txt:/run/identity/instance_id:ro" ], "healthcheck": { "test": [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=4)" ], "interval": "5s", "timeout": "5s", "retries": 30 } }, "api2": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "768m", "cpus": 2, "networks": [ "private" ], "environment": { "BAO_ENABLED": "1", "BAO_ADDR": "https://openbao:8200", "S3_ENDPOINT": "https://s3:9000", "S3_BUCKET": "messenger-attachments", "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:4319", "WORKER_CONCURRENCY": "2", "JOB_TIMEOUT_SECONDS": "10", "JOB_LEASE_SECONDS": "20", "MAX_PENDING_JOBS": "1000", "SERVICE_ROLE": "api2", "OTEL_SERVICE_NAME": "messenger-api", "INSTANCE_ID_FILE": "/run/identity/instance_id" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/api2:/run/tls:ro", "./identity/api2.txt:/run/identity/instance_id:ro" ], "healthcheck": { "test": [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=4)" ], "interval": "5s", "timeout": "5s", "retries": 30 } }, "worker": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "1536m", "cpus": 2, "networks": [ "private" ], "environment": { "BAO_ENABLED": "1", "BAO_ADDR": "https://openbao:8200", "S3_ENDPOINT": "https://s3:9000", "S3_BUCKET": "messenger-attachments", "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:4319", "WORKER_CONCURRENCY": "2", "JOB_TIMEOUT_SECONDS": "10", "JOB_LEASE_SECONDS": "20", "MAX_PENDING_JOBS": "1000", "SERVICE_ROLE": "worker", "OTEL_SERVICE_NAME": "messenger-worker" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/worker:/run/tls:ro" ], "command": [ "python", "-m", "src.worker" ] }, "publisher": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "768m", "cpus": 1, "networks": [ "private" ], "environment": { "BAO_ENABLED": "1", "BAO_ADDR": "https://openbao:8200", "S3_ENDPOINT": "https://s3:9000", "S3_BUCKET": "messenger-attachments", "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:4319", "WORKER_CONCURRENCY": "2", "JOB_TIMEOUT_SECONDS": "10", "JOB_LEASE_SECONDS": "20", "MAX_PENDING_JOBS": "1000", "SERVICE_ROLE": "publisher", "OTEL_SERVICE_NAME": "messenger-publisher" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/publisher:/run/tls:ro" ], "command": [ "python", "-m", "src.publisher" ] }, "janitor": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "768m", "cpus": 1, "networks": [ "private" ], "environment": { "BAO_ENABLED": "1", "BAO_ADDR": "https://openbao:8200", "S3_ENDPOINT": "https://s3:9000", "S3_BUCKET": "messenger-attachments", "SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}", "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:4319", "WORKER_CONCURRENCY": "2", "JOB_TIMEOUT_SECONDS": "10", "JOB_LEASE_SECONDS": "20", "MAX_PENDING_JOBS": "1000", "SERVICE_ROLE": "janitor", "OTEL_SERVICE_NAME": "messenger-janitor" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/janitor:/run/tls:ro" ], "command": [ "python", "-m", "src.cleanup" ] }, "api1-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.5, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:api1", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/api1:/run/tls:ro", "./infra/gateways/api1.json:/config/gateway.json:ro" ], "depends_on": [ "api1" ] }, "api2-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.5, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:api2", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/api2:/run/tls:ro", "./infra/gateways/api2.json:/config/gateway.json:ro" ], "depends_on": [ "api2" ] }, "broker-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.25, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:broker", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/broker:/run/tls:ro", "./infra/gateways/broker.json:/config/gateway.json:ro" ], "depends_on": [ "broker" ] }, "otel-collector-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.5, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:otel-collector", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/otel-collector:/run/tls:ro", "./infra/gateways/otel-collector.json:/config/gateway.json:ro" ], "depends_on": [ "otel-collector" ] }, "prometheus-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.25, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:prometheus", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/prometheus:/run/tls:ro", "./infra/gateways/prometheus.json:/config/gateway.json:ro" ], "depends_on": [ "prometheus" ] }, "loki-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.25, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:loki", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/loki:/run/tls:ro", "./infra/gateways/loki.json:/config/gateway.json:ro" ], "depends_on": [ "loki" ] }, "tempo-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.25, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:tempo", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/tempo:/run/tls:ro", "./infra/gateways/tempo.json:/config/gateway.json:ro" ], "depends_on": [ "tempo" ] }, "grafana-tls": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "64m", "cpus": 0.25, "command": [ "python", "-m", "src.tls_gateway" ], "network_mode": "service:grafana", "environment": { "GATEWAY_CONFIG": "/config/gateway.json" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/grafana:/run/tls:ro", "./infra/gateways/grafana.json:/config/gateway.json:ro" ], "depends_on": [ "grafana" ] }, "postgres": { "image": "postgres:17.6-alpine3.22", "entrypoint": [ "/bin/sh", "/config/postgres-start.sh" ], "environment": { "POSTGRES_USER": "messenger", "POSTGRES_DB": "messenger", "POSTGRES_PASSWORD_FILE": "/run/secrets/postgres_password" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/postgres:/run/tls:ro", "postgres-data:/var/lib/postgresql/data", "./secrets/postgres_password:/run/secrets/postgres_password:ro", "./infra/postgres-start.sh:/config/postgres-start.sh:ro", "./infra/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro" ], "tmpfs": [ "/tmp:mode=1777" ], "networks": [ "private" ], "mem_limit": "384m", "cpus": 1, "restart": "unless-stopped", "security_opt": [ "no-new-privileges:true" ], "healthcheck": { "test": [ "CMD", "pg_isready", "-U", "messenger", "-d", "messenger" ], "interval": "3s", "timeout": "3s", "retries": 20 } }, "s3": { "image": "mtusi-minio:lab7", "build": { "context": ".", "dockerfile": "infra/Dockerfile.minio", "target": "server" }, "user": "10001:10001", "entrypoint": [ "/bin/sh", "/config/minio-start.sh" ], "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/s3:/run/tls:ro", "s3-data:/data", "./infra/minio-start.sh:/config/minio-start.sh:ro", "./secrets/minio_root_user:/run/secrets/minio_root_user:ro", "./secrets/minio_root_password:/run/secrets/minio_root_password:ro" ], "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ], "networks": [ "private" ], "mem_limit": "384m", "cpus": 1, "restart": "unless-stopped" }, "broker": { "image": "redis:7.4.5-alpine3.21", "user": "redis", "command": [ "redis-server", "/etc/redis.conf" ], "volumes": [ "broker-data:/data", "./infra/broker.conf:/etc/redis.conf:ro", "./secrets/broker.acl:/run/broker.acl:ro" ], "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "networks": [ "private" ], "mem_limit": "192m", "cpus": 0.5, "restart": "unless-stopped" }, "lb": { "image": "haproxy:3.0.11-alpine", "user": "10001:10001", "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/lb:/run/tls:ro", "./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" ], "ports": [ "127.0.0.1:${LAB7_PORT:-8443}:8443" ], "networks": [ "private", "edge" ], "mem_limit": "96m", "cpus": 0.5, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ] }, "openbao": { "image": "quay.io/openbao/openbao:2.2.2", "user": "10001:10001", "entrypoint": [ "bao", "server", "-config=/etc/bao/config.hcl" ], "environment": { "BAO_ADDR": "https://openbao:8200", "BAO_CACERT": "/run/pki/ca.crt" }, "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/openbao:/run/tls:ro", "bao-data:/bao/data", "./infra/openbao/config.hcl:/etc/bao/config.hcl:ro" ], "ports": [ "127.0.0.1:8207:8200" ], "networks": [ "private", "edge" ], "mem_limit": "192m", "cpus": 0.5, "restart": "unless-stopped", "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "read_only": true, "tmpfs": [ "/tmp:mode=1777" ] }, "otel-collector": { "image": "otel/opentelemetry-collector-contrib:0.123.0", "user": "10001:10001", "command": [ "--config=/config.yaml" ], "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/otel-collector:/run/tls:ro", "./infra/otel/collector.yaml:/config.yaml:ro" ], "networks": [ "private" ], "mem_limit": "256m", "cpus": 0.5, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ] }, "prometheus": { "image": "prom/prometheus:v3.2.1", "user": "10001:10001", "command": [ "--config.file=/config.yaml", "--web.listen-address=127.0.0.1:9090", "--storage.tsdb.path=/prometheus", "--storage.tsdb.retention.time=7d" ], "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/prometheus:/run/tls:ro", "./infra/otel/prometheus.yaml:/config.yaml:ro", "prometheus-data:/prometheus", "./infra/otel/alerts.yaml:/etc/prometheus/alerts.yaml:ro" ], "networks": [ "private" ], "mem_limit": "256m", "cpus": 0.5, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ] }, "loki": { "image": "grafana/loki:3.4.2", "user": "10001:10001", "command": [ "-config.file=/config.yaml" ], "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/loki:/run/tls:ro", "./infra/otel/loki.yaml:/config.yaml:ro", "loki-data:/loki" ], "networks": [ "private" ], "mem_limit": "384m", "cpus": 1, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ], "environment": { "GOMAXPROCS": "2", "GOMEMLIMIT": "256MiB" } }, "tempo": { "image": "grafana/tempo:2.7.2", "user": "10001:10001", "command": [ "-config.file=/config.yaml" ], "volumes": [ "./pki:/run/pki:ro", "./secrets/tls/tempo:/run/tls:ro", "./infra/otel/tempo.yaml:/config.yaml:ro", "tempo-data:/var/tempo" ], "networks": [ "private" ], "mem_limit": "512m", "cpus": 1, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ], "environment": { "GOMAXPROCS": "2", "GOMEMLIMIT": "384MiB" } }, "grafana": { "image": "grafana/grafana:11.6.0", "user": "10001:10001", "environment": { "GF_SERVER_HTTP_ADDR": "127.0.0.1", "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", "GF_PLUGINS_PREINSTALL_DISABLED": "true" }, "volumes": [ "grafana-data:/var/lib/grafana", "./secrets/grafana_password:/run/secrets/grafana_password:ro", "./secrets/grafana-runtime:/etc/grafana/provisioning/datasources:ro", "./infra/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro", "./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro" ], "ports": [ "127.0.0.1:3007:3443" ], "networks": [ "private", "edge" ], "mem_limit": "256m", "cpus": 0.5, "restart": "unless-stopped", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:mode=1777" ] }, "operator": { "image": "mtusi-messenger:lab7", "build": ".", "init": true, "restart": "no", "read_only": true, "cap_drop": [ "ALL" ], "security_opt": [ "no-new-privileges:true" ], "tmpfs": [ "/tmp:size=134217728,mode=1777" ], "mem_limit": "384m", "cpus": 1, "networks": [ "private", "edge" ], "profiles": [ "tools" ], "command": [ "python", "scripts/bootstrap.py" ], "volumes": [ "./secrets:/app/secrets", "./pki:/app/pki", "./infra:/app/infra", "./evidence:/app/evidence", "./scripts:/app/scripts:ro", "./student-tests:/app/student-tests:ro", "./src:/app/src:ro", "./migrations:/app/migrations:ro" ], "environment": { "OTEL_SDK_DISABLED": "true" }, "user": "0:0", "cap_add": [ "CHOWN", "DAC_OVERRIDE", "FOWNER" ] }, "s3-bootstrap": { "image": "mtusi-mc:lab7", "build": { "context": ".", "dockerfile": "infra/Dockerfile.minio", "target": "client" }, "entrypoint": [ "/bin/sh", "/config/bootstrap.sh" ], "profiles": [ "tools" ], "volumes": [ "./secrets:/run/secrets:ro", "./pki:/run/pki:ro", "./infra:/config:ro" ], "networks": [ "private" ], "mem_limit": "128m", "cpus": 0.5 }, "volume-init": { "image": "python:3.12.11-slim-bookworm", "user": "0:0", "profiles": [ "tools" ], "network_mode": "none", "cap_drop": [ "ALL" ], "cap_add": [ "CHOWN", "DAC_OVERRIDE", "FOWNER" ], "security_opt": [ "no-new-privileges:true" ], "volumes": [ "s3-data:/init/s3-data", "bao-data:/init/bao-data", "prometheus-data:/init/prometheus-data", "loki-data:/init/loki-data", "tempo-data:/init/tempo-data", "grafana-data:/init/grafana-data" ], "command": [ "python", "-c", "import os; [(os.chown(root,10001,10001),os.chmod(root,0o750),[(os.chown(os.path.join(root,f),10001,10001),os.chmod(os.path.join(root,f),0o640)) for f in files]) for root,dirs,files in os.walk('/init') if root!='/init']" ], "mem_limit": "64m", "cpus": 0.25 } }, "networks": { "private": { "internal": true }, "edge": {} }, "volumes": { "postgres-data": {}, "s3-data": {}, "broker-data": {}, "bao-data": {}, "prometheus-data": {}, "loki-data": {}, "tempo-data": {}, "grafana-data": {} } }