Grade 4
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-11-27 21:55:47 +03:00
parent f6882a77b4
commit b6c71fd96a
67 changed files with 3770 additions and 595 deletions
+635 -263
View File
@@ -1,313 +1,685 @@
x-api: &api
image: mtusi2026lab7-api:local
pull_policy: never
dns_opt:
- timeout:1
- attempts:1
environment: &app-env
APP_HOST: 0.0.0.0
APP_PORT: 8080
POSTGRES_HOST: postgres
POSTGRES_DB: ${POSTGRES_DB:-messenger}
POSTGRES_USER: ${POSTGRES_USER:-messenger}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
REDIS_URL: redis://redis:6379/0
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
CACHE_TTL_SECONDS: ${CACHE_TTL_SECONDS:-30}
MAX_REQUEST_BYTES: ${MAX_REQUEST_BYTES:-65536}
MAX_INFLIGHT: ${MAX_INFLIGHT:-32}
S3_ENDPOINT: http://s3:9000
S3_REGION: us-east-1
S3_BUCKET: messenger-attachments
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:?Set S3_ACCESS_KEY_ID in .env}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:?Set S3_SECRET_ACCESS_KEY in .env}
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760}
MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000}
MAX_PENDING_ATTACHMENTS: ${MAX_PENDING_ATTACHMENTS:-64}
BROKER_URL: redis://broker:6379/0
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-2}
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-60}
JOB_MEMORY_MB: ${JOB_MEMORY_MB:-768}
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-86400}
OTEL_SERVICE_NAME: messenger-api
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
OTEL_SDK_DISABLED: ${OTEL_SDK_DISABLED:-false}
networks: [backend]
cpus: 1.0
mem_limit: 512m
stop_grace_period: 10s
name: mtusi2026lab7
services:
broker:
image: redis:7.4.2-bookworm
command: [redis-server, --appendonly, 'yes', --appendfsync, always, --maxmemory, 128mb, --maxmemory-policy, noeviction]
volumes:
- broker_data:/data
networks: [backend]
healthcheck:
test: [CMD, redis-cli, ping]
interval: 2s
timeout: 2s
retries: 30
cpus: 0.5
mem_limit: 256m
dispatcher:
<<: *api
environment:
<<: *app-env
OTEL_SERVICE_NAME: messenger-dispatcher
command: [python, -m, src.jobs, dispatch]
healthcheck:
disable: true
depends_on:
migrate:
condition: service_completed_successfully
broker:
condition: service_healthy
api1:
image: mtusi2026lab7-api:local
networks:
- backend
cpus: 1.0
mem_limit: 384m
read_only: true
cap_drop: &drop_all_capabilities
- ALL
security_opt: &no_new_privileges
- no-new-privileges:true
tmpfs: &runtime_tmpfs
- /tmp:rw,noexec,nosuid,size=64m
restart: unless-stopped
mem_limit: 128m
worker:
<<: *api
build: .
pull_policy: never
user: 1000:1000
entrypoint:
- python
- -m
- src.secure_run
command:
- python
- -m
- src
environment:
<<: *app-env
OTEL_SERVICE_NAME: messenger-worker
command: [python, -m, src.worker]
SERVICE_ROLE: api
APP_HOST: 127.0.0.1
APP_PORT: '8080'
OTEL_SERVICE_NAME: messenger-api
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:44318
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/identity/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/identity/tls.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/identity/tls.key
WORKER_CONCURRENCY: '2'
JOB_MEMORY_MB: '768'
JOB_TIMEOUT_SECONDS: '60'
volumes:
- ./secrets/api:/run/identity:ro
init: true
healthcheck:
disable: true
depends_on:
migrate:
condition: service_completed_successfully
broker:
condition: service_healthy
s3-init:
condition: service_completed_successfully
pids_limit: 64
stop_grace_period: 15s
api1-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/api1:/run/identity:ro
- ./infra/tls/api1.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:api1
depends_on:
- api1
api2:
image: mtusi2026lab7-api:local
networks:
- backend
cpus: 1.0
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
build: .
pull_policy: never
user: 1000:1000
entrypoint:
- python
- -m
- src.secure_run
command:
- python
- -m
- src
environment:
SERVICE_ROLE: api
APP_HOST: 127.0.0.1
APP_PORT: '8080'
OTEL_SERVICE_NAME: messenger-api
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:44318
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/identity/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/identity/tls.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/identity/tls.key
WORKER_CONCURRENCY: '2'
JOB_MEMORY_MB: '768'
JOB_TIMEOUT_SECONDS: '60'
volumes:
- ./secrets/api:/run/identity:ro
init: true
healthcheck:
disable: true
pids_limit: 64
stop_grace_period: 15s
api2-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/api2:/run/identity:ro
- ./infra/tls/api2.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:api2
depends_on:
- api2
worker:
image: mtusi2026lab7-api:local
networks:
- backend
cpus: 2.0
mem_limit: 2g
pids_limit: 64
api:
<<: *api
build: .
deploy:
replicas: 2
depends_on:
migrate:
condition: service_completed_successfully
redis:
condition: service_healthy
s3-init:
condition: service_completed_successfully
healthcheck:
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=1).read()"]
interval: 2s
timeout: 2s
start_period: 5s
retries: 2
migrate:
<<: *api
environment:
<<: *app-env
OTEL_SDK_DISABLED: 'true'
command: [python, -m, src.database]
healthcheck:
disable: true
restart: 'no'
depends_on:
postgres:
condition: service_healthy
s3:
# RELEASE.2025-09-07T16-13-09Z, pinned by immutable image digest.
image: minio/minio@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e
command: [server, /data, --console-address, '127.0.0.1:9001']
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?Set MINIO_ROOT_USER in .env}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?Set MINIO_ROOT_PASSWORD in .env}
MINIO_BROWSER: 'off'
volumes:
- s3_data:/data
networks: [backend]
healthcheck:
test: [CMD, curl, -f, http://127.0.0.1:9000/minio/health/live]
interval: 2s
timeout: 2s
retries: 30
cpus: 1.0
mem_limit: 512m
s3-init:
# The pinned server image also contains mc; no second image is needed.
image: minio/minio@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e
entrypoint: [sh, /bootstrap.sh]
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?Set MINIO_ROOT_USER in .env}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?Set MINIO_ROOT_PASSWORD in .env}
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:?Set S3_ACCESS_KEY_ID in .env}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:?Set S3_SECRET_ACCESS_KEY in .env}
volumes:
- ./infra/s3-bootstrap.sh:/bootstrap.sh:ro
- ./infra/s3-policy.json:/policy.json:ro
depends_on:
s3:
condition: service_healthy
networks: [backend]
restart: 'no'
cpus: 0.25
mem_limit: 128m
cleanup:
<<: *api
environment:
<<: *app-env
OTEL_SDK_DISABLED: 'true'
command: [python, -m, src.cleanup]
healthcheck:
disable: true
depends_on:
migrate:
condition: service_completed_successfully
s3-init:
condition: service_completed_successfully
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
cpus: 0.25
mem_limit: 128m
nginx:
image: nginx:1.28.0-alpine
entrypoint: [sh, /etc/nginx/readiness.sh]
dns_opt:
- timeout:1
- attempts:1
ports:
- '127.0.0.1:${APP_PORT:-8080}:8080'
build: .
pull_policy: never
user: 1000:1000
entrypoint:
- python
- -m
- src.secure_run
command:
- python
- -m
- src.worker
environment:
SERVICE_ROLE: worker
APP_HOST: 127.0.0.1
APP_PORT: '8080'
OTEL_SERVICE_NAME: messenger-worker
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:44318
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/identity/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/identity/tls.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/identity/tls.key
WORKER_CONCURRENCY: '2'
JOB_MEMORY_MB: '768'
JOB_TIMEOUT_SECONDS: '60'
volumes:
- ./infra/nginx.conf:/etc/nginx/nginx.conf:ro
- ./infra/readiness.sh:/etc/nginx/readiness.sh:ro
networks: [edge, backend]
depends_on:
api:
condition: service_healthy
- ./secrets/worker:/run/identity:ro
init: true
healthcheck:
test: [CMD-SHELL, 'wget -q -O /dev/null http://127.0.0.1:8080/health/ready']
interval: 2s
timeout: 2s
retries: 3
disable: true
pids_limit: 64
stop_grace_period: 15s
dispatcher:
image: mtusi2026lab7-api:local
networks:
- backend
cpus: 1.0
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
build: .
pull_policy: never
user: 1000:1000
entrypoint:
- python
- -m
- src.secure_run
command:
- python
- -m
- src.jobs
- dispatch
environment:
SERVICE_ROLE: dispatcher
APP_HOST: 127.0.0.1
APP_PORT: '8080'
OTEL_SERVICE_NAME: messenger-dispatcher
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:44318
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/identity/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/identity/tls.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/identity/tls.key
WORKER_CONCURRENCY: '2'
JOB_MEMORY_MB: '768'
JOB_TIMEOUT_SECONDS: '60'
volumes:
- ./secrets/dispatcher:/run/identity:ro
init: true
healthcheck:
disable: true
pids_limit: 64
stop_grace_period: 15s
cleanup:
image: mtusi2026lab7-api:local
networks:
- backend
cpus: 1.0
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
build: .
pull_policy: never
user: 1000:1000
entrypoint:
- python
- -m
- src.secure_run
command:
- python
- -m
- src.cleanup
environment:
SERVICE_ROLE: cleanup
APP_HOST: 127.0.0.1
APP_PORT: '8080'
OTEL_SERVICE_NAME: messenger-cleanup
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:44318
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/identity/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/identity/tls.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/identity/tls.key
WORKER_CONCURRENCY: '2'
JOB_MEMORY_MB: '768'
JOB_TIMEOUT_SECONDS: '60'
OTEL_SDK_DISABLED: 'true'
volumes:
- ./secrets/cleanup:/run/identity:ro
init: true
healthcheck:
disable: true
pids_limit: 64
stop_grace_period: 15s
lb:
image: haproxy:3.0.12-alpine
networks:
- edge
- backend
cpus: 0.5
mem_limit: 128m
stop_grace_period: 10s
mem_limit: 96m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
ports:
- 127.0.0.1:8443:8443
volumes:
- ./secrets/lb:/run/identity:ro
- ./infra/tls/lb.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
postgres:
image: postgres:17.4-bookworm
environment:
POSTGRES_DB: ${POSTGRES_DB:-messenger}
POSTGRES_USER: ${POSTGRES_USER:-messenger}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
volumes:
- postgres_data:/var/lib/postgresql/data
networks: [backend]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 2s
timeout: 2s
retries: 30
networks:
- backend
cpus: 1.0
mem_limit: 512m
read_only: true
cap_drop:
- ALL
security_opt: *no_new_privileges
tmpfs:
- /tmp:rw,nosuid,size=16m
- /var/run/postgresql:rw,nosuid,size=16m
restart: unless-stopped
cap_add:
- CHOWN
- DAC_OVERRIDE
- FOWNER
- SETGID
- SETUID
environment:
POSTGRES_DB: messenger
POSTGRES_PASSWORD_FILE: /run/admin/postgres-password
volumes:
- type: volume
source: postgres_data
target: /var/lib/postgresql/data
volume:
nocopy: true
- ./secrets/postgres:/run/identity:ro
- ./secrets/postgres-admin:/run/admin:ro
- ./infra/postgres/pg_hba.conf:/etc/pg_hba.conf:ro
- ./infra/postgres/start.sh:/start.sh:ro
entrypoint:
- sh
- /start.sh
redis:
image: redis:7.4.2-bookworm
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "always", "--maxmemory", "128mb", "--maxmemory-policy", "noeviction"]
volumes:
- redis_data:/data
networks: [backend]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 2s
retries: 30
networks:
- backend
cpus: 0.5
mem_limit: 256m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 999:999
command:
- redis-server
- /run/config/redis.conf
volumes:
- type: volume
source: redis_data
target: /data
volume:
nocopy: true
- ./secrets/redis-config:/run/config:ro
redis-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/redis:/run/identity:ro
- ./infra/tls/redis.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:redis
depends_on:
- redis
broker:
image: redis:7.4.2-bookworm
networks:
- backend
cpus: 0.5
mem_limit: 256m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 999:999
command:
- redis-server
- /run/config/redis.conf
volumes:
- type: volume
source: broker_data
target: /data
volume:
nocopy: true
- ./secrets/broker-config:/run/config:ro
broker-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/broker:/run/identity:ro
- ./infra/tls/broker.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:broker
depends_on:
- broker
s3:
image: minio/minio@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e
networks:
- backend
cpus: 1.0
mem_limit: 512m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 1000:1000
entrypoint:
- sh
- -c
command:
- export MINIO_ROOT_USER=$$(cat /run/admin/user); export MINIO_ROOT_PASSWORD=$$(cat
/run/admin/password); exec minio server /data --address 127.0.0.1:9000 --console-address
127.0.0.1:9001
environment:
MINIO_BROWSER: 'off'
volumes:
- type: volume
source: s3_data
target: /data
volume:
nocopy: true
- ./secrets/s3-admin:/run/admin:ro
s3-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/s3:/run/identity:ro
- ./infra/tls/s3.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:s3
depends_on:
- s3
openbao:
image: openbao/openbao:2.4.4
networks:
- edge
- backend
cpus: 0.5
mem_limit: 256m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 100:1000
entrypoint:
- bao
command:
- server
- -config=/etc/bao/config.hcl
volumes:
- type: volume
source: bao_data
target: /bao/data
volume:
nocopy: true
- ./secrets/openbao:/run/identity:ro
- ./infra/openbao/config.hcl:/etc/bao/config.hcl:ro
ports:
- 127.0.0.1:8200:8200
otel-collector:
image: otel/opentelemetry-collector-contrib:0.136.0
command: [--config=/etc/otel/collector.yaml]
volumes:
- ./infra/otel/collector.yaml:/etc/otel/collector.yaml:ro
networks: [backend]
mem_limit: 256m
networks:
- backend
cpus: 0.5
mem_limit: 256m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 1000:1000
command:
- --config=/etc/otel/config.yaml
volumes:
- ./secrets/otel-collector:/run/identity:ro
- ./infra/otel/collector.yaml:/etc/otel/config.yaml:ro
otel-collector-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/otel-collector:/run/identity:ro
- ./infra/tls/otel-collector.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:otel-collector
depends_on:
- otel-collector
prometheus:
image: prom/prometheus:v3.6.0
command: [--config.file=/etc/prometheus/prometheus.yaml, --storage.tsdb.retention.time=3d]
volumes:
- ./infra/otel/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro
- ./infra/otel/alerts.yaml:/etc/prometheus/alerts.yaml:ro
- prometheus_data:/prometheus
ports: ['127.0.0.1:9090:9090']
networks: [edge, backend]
mem_limit: 512m
networks:
- backend
cpus: 0.5
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65534:65534
command:
- --config.file=/etc/prometheus/prometheus.yaml
- --storage.tsdb.retention.time=3d
- --web.listen-address=127.0.0.1:9090
volumes:
- type: volume
source: prometheus_data
target: /prometheus
volume:
nocopy: true
- ./secrets/prometheus:/run/identity:ro
- ./infra/otel/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro
- ./infra/otel/alerts.yaml:/etc/prometheus/alerts.yaml:ro
prometheus-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/prometheus:/run/identity:ro
- ./infra/tls/prometheus.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:prometheus
depends_on:
- prometheus
loki:
image: grafana/loki:3.5.7
command: [-config.file=/etc/loki/local.yaml]
volumes:
- ./infra/otel/loki.yaml:/etc/loki/local.yaml:ro
- loki_data:/loki
ports: ['127.0.0.1:3100:3100']
networks: [edge, backend]
mem_limit: 384m
networks:
- backend
cpus: 0.5
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 1000:1000
command:
- -config.file=/etc/config.yaml
volumes:
- type: volume
source: loki_data
target: /loki
volume:
nocopy: true
- ./infra/otel/loki.yaml:/etc/config.yaml:ro
loki-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/loki:/run/identity:ro
- ./infra/tls/loki.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:loki
depends_on:
- loki
tempo:
image: grafana/tempo:2.9.0
command: [-config.file=/etc/tempo.yaml]
volumes:
- ./infra/otel/tempo.yaml:/etc/tempo.yaml:ro
- tempo_data:/var/tempo
ports: ['127.0.0.1:3200:3200']
networks: [edge, backend]
mem_limit: 384m
networks:
- backend
cpus: 0.5
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 1000:1000
command:
- -config.file=/etc/config.yaml
volumes:
- type: volume
source: tempo_data
target: /var/tempo
volume:
nocopy: true
- ./infra/otel/tempo.yaml:/etc/config.yaml:ro
tempo-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/tempo:/run/identity:ro
- ./infra/tls/tempo.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:tempo
depends_on:
- tempo
grafana:
image: grafana/grafana:12.2.0
networks:
- edge
- backend
cpus: 0.5
mem_limit: 384m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 472:472
environment:
GF_SERVER_HTTP_ADDR: 127.0.0.1
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:?Set GRAFANA_ADMIN_PASSWORD in .env}
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/admin/password
GF_USERS_ALLOW_SIGN_UP: 'false'
GF_AUTH_ANONYMOUS_ENABLED: 'false'
GF_ANALYTICS_REPORTING_ENABLED: 'false'
GF_ANALYTICS_CHECK_FOR_UPDATES: 'false'
GF_PLUGINS_PREINSTALL_DISABLED: 'true'
volumes:
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
ports: ['127.0.0.1:3000:3000']
networks: [edge, backend]
mem_limit: 384m
cpus: 0.5
- type: volume
source: grafana_data
target: /var/lib/grafana
volume:
nocopy: true
- ./secrets/grafana-admin:/run/admin:ro
- ./secrets/grafana-datasources:/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:3443:3443
grafana-tls:
image: haproxy:3.0.12-alpine
cpus: 0.25
mem_limit: 64m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: unless-stopped
user: 65532:65532
volumes:
- ./secrets/grafana:/run/identity:ro
- ./infra/tls/grafana.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
network_mode: service:grafana
depends_on:
- grafana
audit:
image: mtusi2026lab7-api:local
networks:
- backend
cpus: 0.5
mem_limit: 256m
read_only: true
cap_drop: *drop_all_capabilities
security_opt: *no_new_privileges
tmpfs: *runtime_tmpfs
restart: 'no'
profiles:
- tools
user: 1000:1000
entrypoint:
- python
command:
- /audit/internal.py
volumes:
- ./student-tests:/audit:ro
- ./secrets:/audit-secrets:ro
- ./evidence:/evidence
- ./tests:/tests:ro
- ./contracts:/contracts:ro
- ./lab.json:/lab.json:ro
healthcheck:
disable: true
networks:
edge:
backend:
internal: true
edge: {}
volumes:
broker_data:
postgres_data:
redis_data:
s3_data:
prometheus_data:
loki_data:
tempo_data:
grafana_data:
postgres_data: {}
redis_data: {}
broker_data: {}
s3_data: {}
bao_data: {}
prometheus_data: {}
loki_data: {}
tempo_data: {}
grafana_data: {}