forked from mtusi2026/mtusi2026lab7
631 lines
23 KiB
YAML
631 lines
23 KiB
YAML
name: mtusi2026lab7
|
|
|
|
x-app-security: &app-security
|
|
read_only: true
|
|
security_opt: [no-new-privileges:true]
|
|
cap_drop: [ALL]
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,nodev,noexec,size=64m
|
|
|
|
x-app-environment: &app-environment
|
|
APP_ENV: lab
|
|
SSL_CERT_FILE: /run/secrets/tls_ca
|
|
BAO_ADDR: https://openbao:8200
|
|
BAO_CACERT: /run/secrets/tls_ca
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: https://telemetry-gateway:4318
|
|
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
|
OTEL_EXPORTER_OTLP_TIMEOUT: "3000"
|
|
OTEL_TRACES_SAMPLER: parentbased_always_on
|
|
CLIENT_TLS_CA_FILE: /run/secrets/tls_ca
|
|
CLIENT_TLS_CERT_FILE: /run/secrets/client_cert
|
|
CLIENT_TLS_KEY_FILE: /run/secrets/client_key
|
|
BROKER_TLS_SERVER_NAME: dependency-gateway
|
|
OTEL_TLS_SERVER_NAME: telemetry-gateway
|
|
|
|
services:
|
|
ingress:
|
|
build:
|
|
context: .
|
|
dockerfile: infrastructure/haproxy/Dockerfile
|
|
image: mtusi2026lab7-ingress
|
|
ports:
|
|
- "127.0.0.1:${HTTPS_PORT:-8443}:8443"
|
|
secrets: [tls_ca, ingress_pem, lb_client_pem]
|
|
networks: [host_access, api_ingress]
|
|
depends_on:
|
|
api:
|
|
condition: service_started
|
|
healthcheck:
|
|
test: [CMD, haproxy, -c, -f, /usr/local/etc/haproxy/haproxy.cfg]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
read_only: true
|
|
security_opt: [no-new-privileges:true]
|
|
cap_drop: [ALL]
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: mtusi2026lab7-app
|
|
environment:
|
|
<<: *app-environment
|
|
APP_HOST: 0.0.0.0
|
|
APP_PORT: "8444"
|
|
INSTANCE_ID_FILE: /tmp/instance-id
|
|
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
|
SESSION_COOKIE_SECURE: "true"
|
|
IDEMPOTENCY_TTL_SECONDS: "86400"
|
|
LOGIN_RATE_LIMIT: ${LOGIN_RATE_LIMIT:-5}
|
|
LOGIN_RATE_WINDOW_SECONDS: ${LOGIN_RATE_WINDOW_SECONDS:-60}
|
|
ARGON2_MEMORY_KIB: ${ARGON2_MEMORY_KIB:-19456}
|
|
ARGON2_ITERATIONS: ${ARGON2_ITERATIONS:-2}
|
|
ARGON2_PARALLELISM: ${ARGON2_PARALLELISM:-1}
|
|
S3_ENDPOINT: https://dependency-gateway:9000
|
|
S3_REGION: us-east-1
|
|
S3_BUCKET: messenger-attachments
|
|
JOB_MAX_ATTEMPTS: "5"
|
|
TLS_CERT_FILE: /run/secrets/api_cert
|
|
TLS_KEY_FILE: /run/secrets/api_key
|
|
TLS_CLIENT_CA_FILE: /run/secrets/tls_ca
|
|
TLS_ALLOWED_CLIENT_URIS_FILE: /run/secrets/api_client_uris
|
|
BAO_ROLE_ID_FILE: /run/secrets/bao_role_id
|
|
BAO_SECRET_ID_FILE: /run/secrets/bao_secret_id
|
|
BAO_SECRET_PATH: api
|
|
BAO_ENV_KEYS: DATABASE_URL,CACHE_URL,S3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEY,CURSOR_SIGNING_KEY
|
|
secrets:
|
|
- tls_ca
|
|
- api_cert
|
|
- api_key
|
|
- api_client_uris
|
|
- source: api_client_cert
|
|
target: client_cert
|
|
- source: api_client_key
|
|
target: client_key
|
|
- source: bao_api_role_id
|
|
target: bao_role_id
|
|
- source: bao_api_secret_id
|
|
target: bao_secret_id
|
|
networks: [api_ingress, postgres_network, dependency_secure, telemetry_secure, openbao_network]
|
|
expose: ["8444"]
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
dependency-gateway: {condition: service_healthy}
|
|
telemetry-gateway: {condition: service_healthy}
|
|
openbao: {condition: service_healthy}
|
|
healthcheck:
|
|
disable: true
|
|
restart: unless-stopped
|
|
<<: *app-security
|
|
deploy:
|
|
replicas: ${API_REPLICAS:-2}
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 256M}
|
|
|
|
postgres:
|
|
image: postgres:16.15-alpine3.24@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea
|
|
entrypoint: [/bin/sh, -ec]
|
|
command:
|
|
- |
|
|
install -d -o postgres -g postgres -m 700 /var/lib/postgresql/tls
|
|
install -o postgres -g postgres -m 600 /run/secrets/postgres_key /var/lib/postgresql/tls/server.key
|
|
install -o postgres -g postgres -m 644 /run/secrets/postgres_cert /var/lib/postgresql/tls/server.crt
|
|
install -o postgres -g postgres -m 644 /run/secrets/tls_ca /var/lib/postgresql/tls/ca.crt
|
|
exec docker-entrypoint.sh postgres \
|
|
-c ssl=on \
|
|
-c ssl_cert_file=/var/lib/postgresql/tls/server.crt \
|
|
-c ssl_key_file=/var/lib/postgresql/tls/server.key \
|
|
-c ssl_ca_file=/var/lib/postgresql/tls/ca.crt
|
|
environment:
|
|
POSTGRES_USER: lab7_admin
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_admin_password
|
|
secrets:
|
|
- postgres_admin_password
|
|
- postgres_api_password
|
|
- postgres_worker_password
|
|
- postgres_dispatcher_password
|
|
- postgres_cert
|
|
- postgres_key
|
|
- tls_ca
|
|
- postgres_roles
|
|
volumes: [postgres_data:/var/lib/postgresql/data]
|
|
networks: [postgres_network]
|
|
healthcheck:
|
|
test: [CMD-SHELL, pg_isready -U lab7_admin -d messenger]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "1.00", memory: 512M}
|
|
|
|
migrate:
|
|
image: migrate/migrate:v4.20.1@sha256:76cc2074cb6642631f34a898ced71e6aeaa6b1a4d78c4daa743275a22e0c5be7
|
|
entrypoint: [/bin/sh, -ec]
|
|
command:
|
|
- |
|
|
password=$$(cat /run/secrets/postgres_admin_password)
|
|
exec migrate -path=/migrations \
|
|
-database="postgres://lab7_admin:$${password}@postgres:5432/messenger?sslmode=verify-full&sslrootcert=/run/secrets/tls_ca" up
|
|
secrets: [postgres_admin_password, tls_ca]
|
|
volumes:
|
|
- ./migrations:/migrations:ro
|
|
networks: [postgres_network]
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
restart: "no"
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 64M}
|
|
|
|
redis:
|
|
image: redis:8.10.2-alpine3.23@sha256:3811787313eba226a2ef38658c6ccb91cd5e110edc89c37767de373120a0e5a0
|
|
command: [redis-server, /run/secrets/redis_config]
|
|
user: "1000:1000"
|
|
secrets:
|
|
- redis_config
|
|
- redis_api_password
|
|
networks: [redis_local]
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'redis-cli -u "redis://api:$$(cat /run/secrets/redis_api_password)@127.0.0.1:6379/0" ping | grep -q PONG']
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 20
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
minio:
|
|
build:
|
|
context: .
|
|
dockerfile: infrastructure/minio/Dockerfile
|
|
target: server
|
|
args: {MINIO_VERSION: RELEASE.2025-10-15T17-29-55Z}
|
|
image: mtusi2026lab7-minio:RELEASE.2025-10-15T17-29-55Z
|
|
command: [server, /data, --address, ":9000"]
|
|
environment:
|
|
MINIO_ROOT_USER_FILE: /run/secrets/minio_root_user
|
|
MINIO_ROOT_PASSWORD_FILE: /run/secrets/minio_root_password
|
|
MINIO_BROWSER: "off"
|
|
secrets: [minio_root_user, minio_root_password]
|
|
volumes: [minio_data:/data]
|
|
networks: [s3_local]
|
|
healthcheck:
|
|
test: [CMD-SHELL, wget -qO- http://127.0.0.1:9000/minio/health/live >/dev/null]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.75", memory: 512M}
|
|
|
|
minio-bootstrap:
|
|
build:
|
|
context: .
|
|
dockerfile: infrastructure/minio/Dockerfile
|
|
target: client
|
|
args: {MC_VERSION: RELEASE.2025-08-13T08-35-41Z}
|
|
image: mtusi2026lab7-mc:RELEASE.2025-08-13T08-35-41Z
|
|
entrypoint: [/bin/sh, -ec]
|
|
command:
|
|
- |
|
|
mc alias set local http://minio:9000 "$$(cat /run/secrets/minio_root_user)" "$$(cat /run/secrets/minio_root_password)" --api S3v4
|
|
mc mb --ignore-existing local/messenger-attachments
|
|
mc anonymous set none local/messenger-attachments
|
|
sed 's/__BUCKET__/messenger-attachments/g' /policies/api.json > /tmp/api.json
|
|
sed 's/__BUCKET__/messenger-attachments/g' /policies/worker.json > /tmp/worker.json
|
|
mc admin policy create local messenger-api /tmp/api.json
|
|
mc admin policy create local messenger-worker /tmp/worker.json
|
|
mc admin user add local "$$(cat /run/secrets/s3_api_access_key)" "$$(cat /run/secrets/s3_api_secret_key)"
|
|
mc admin user add local "$$(cat /run/secrets/s3_worker_access_key)" "$$(cat /run/secrets/s3_worker_secret_key)"
|
|
mc admin policy attach local messenger-api --user "$$(cat /run/secrets/s3_api_access_key)"
|
|
mc admin policy attach local messenger-worker --user "$$(cat /run/secrets/s3_worker_access_key)"
|
|
secrets:
|
|
- minio_root_user
|
|
- minio_root_password
|
|
- s3_api_access_key
|
|
- s3_api_secret_key
|
|
- s3_worker_access_key
|
|
- s3_worker_secret_key
|
|
volumes:
|
|
- ./infrastructure/minio/api-policy.template.json:/policies/api.json:ro
|
|
- ./infrastructure/minio/worker-policy.template.json:/policies/worker.json:ro
|
|
networks: [s3_local]
|
|
depends_on:
|
|
minio: {condition: service_healthy}
|
|
restart: "no"
|
|
|
|
broker:
|
|
image: rabbitmq:4.1.4-alpine
|
|
hostname: broker
|
|
entrypoint: [/bin/sh, -ec]
|
|
command:
|
|
- |
|
|
export RABBITMQ_DEFAULT_USER=dispatcher
|
|
export RABBITMQ_DEFAULT_PASS=$$(cat /run/secrets/broker_dispatcher_password)
|
|
exec docker-entrypoint.sh rabbitmq-server
|
|
secrets: [broker_dispatcher_password, broker_worker_password]
|
|
volumes: [broker_data:/var/lib/rabbitmq]
|
|
networks: [broker_local]
|
|
healthcheck:
|
|
test: [CMD, rabbitmq-diagnostics, -q, ping]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 384M}
|
|
|
|
dependency-gateway:
|
|
image: haproxy:3.2-alpine@sha256:dfba86f031bd4c9039f10f8cc5de75991d1b6766d5460f0335b980408503baad
|
|
user: "1000:1000"
|
|
volumes:
|
|
- ./infrastructure/gateways/dependency.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
secrets: [dependency_pem, tls_ca]
|
|
networks: [dependency_secure, redis_local, s3_local, broker_local]
|
|
depends_on:
|
|
redis: {condition: service_healthy}
|
|
minio: {condition: service_healthy}
|
|
broker: {condition: service_healthy}
|
|
healthcheck:
|
|
test: [CMD, haproxy, -c, -f, /usr/local/etc/haproxy/haproxy.cfg]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
cap_drop: [ALL]
|
|
read_only: true
|
|
security_opt: [no-new-privileges:true]
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
openbao:
|
|
image: openbao/openbao:2.4.4
|
|
user: "1000:1000"
|
|
command: [server, -config=/openbao/config/config.hcl]
|
|
environment:
|
|
BAO_ADDR: https://openbao:8200
|
|
BAO_CACERT: /run/secrets/tls_ca
|
|
secrets: [tls_ca, openbao_cert, openbao_key]
|
|
volumes:
|
|
- ./volumes/openbao:/openbao/data
|
|
- ./infrastructure/openbao/config.hcl:/openbao/config/config.hcl:ro
|
|
- ./infrastructure/openbao/api-policy.hcl:/policies/api-policy.hcl:ro
|
|
- ./infrastructure/openbao/worker-policy.hcl:/policies/worker-policy.hcl:ro
|
|
- ./infrastructure/openbao/dispatcher-policy.hcl:/policies/dispatcher-policy.hcl:ro
|
|
- ./secrets/openbao:/bootstrap:ro
|
|
networks: [host_access, openbao_network]
|
|
ports:
|
|
- "127.0.0.1:${OPENBAO_PORT:-18200}:8200"
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'bao status >/dev/null 2>&1; code=$$?; [ $$code -eq 0 ] || [ $$code -eq 2 ]']
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 30
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 256M}
|
|
|
|
dispatcher:
|
|
build: {context: ., dockerfile: Dockerfile}
|
|
image: mtusi2026lab7-app
|
|
entrypoint: [/app/dispatcher]
|
|
environment:
|
|
<<: *app-environment
|
|
INSTANCE_ID: dispatcher
|
|
BAO_ROLE_ID_FILE: /run/secrets/bao_role_id
|
|
BAO_SECRET_ID_FILE: /run/secrets/bao_secret_id
|
|
BAO_SECRET_PATH: dispatcher
|
|
BAO_ENV_KEYS: DATABASE_URL,BROKER_URL
|
|
secrets:
|
|
- tls_ca
|
|
- source: dispatcher_client_cert
|
|
target: client_cert
|
|
- source: dispatcher_client_key
|
|
target: client_key
|
|
- source: bao_dispatcher_role_id
|
|
target: bao_role_id
|
|
- source: bao_dispatcher_secret_id
|
|
target: bao_secret_id
|
|
networks: [postgres_network, dependency_secure, telemetry_secure, openbao_network]
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
dependency-gateway: {condition: service_healthy}
|
|
telemetry-gateway: {condition: service_healthy}
|
|
openbao: {condition: service_healthy}
|
|
restart: unless-stopped
|
|
<<: *app-security
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
worker:
|
|
build: {context: ., dockerfile: Dockerfile}
|
|
image: mtusi2026lab7-app
|
|
entrypoint: [/app/worker]
|
|
environment:
|
|
<<: *app-environment
|
|
INSTANCE_ID: worker
|
|
S3_ENDPOINT: https://dependency-gateway:9000
|
|
S3_REGION: us-east-1
|
|
S3_BUCKET: messenger-attachments
|
|
WORKER_CONCURRENCY: "1"
|
|
JOB_MAX_ATTEMPTS: "5"
|
|
JOB_TIMEOUT_SECONDS: "60"
|
|
JOB_LEASE_SECONDS: "75"
|
|
STAGING_RETENTION_SECONDS: "86400"
|
|
BAO_ROLE_ID_FILE: /run/secrets/bao_role_id
|
|
BAO_SECRET_ID_FILE: /run/secrets/bao_secret_id
|
|
BAO_SECRET_PATH: worker
|
|
BAO_ENV_KEYS: DATABASE_URL,BROKER_URL,S3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEY
|
|
GOMEMLIMIT: 448MiB
|
|
secrets:
|
|
- tls_ca
|
|
- source: worker_client_cert
|
|
target: client_cert
|
|
- source: worker_client_key
|
|
target: client_key
|
|
- source: bao_worker_role_id
|
|
target: bao_role_id
|
|
- source: bao_worker_secret_id
|
|
target: bao_secret_id
|
|
networks: [postgres_network, dependency_secure, telemetry_secure, openbao_network]
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
dependency-gateway: {condition: service_healthy}
|
|
telemetry-gateway: {condition: service_healthy}
|
|
openbao: {condition: service_healthy}
|
|
restart: unless-stopped
|
|
<<: *app-security
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "1.00", memory: 512M}
|
|
|
|
otel-collector:
|
|
image: otel/opentelemetry-collector-contrib:0.165.0
|
|
command: [--config=/etc/otelcol-contrib/config.yaml]
|
|
volumes:
|
|
- ./infrastructure/telemetry/otel-collector/config.yaml:/etc/otelcol-contrib/config.yaml:ro
|
|
secrets: [tls_ca, collector_client_cert, collector_client_key]
|
|
group_add: ["1000"]
|
|
networks: [collector_local, telemetry_secure]
|
|
depends_on:
|
|
loki: {condition: service_started}
|
|
tempo: {condition: service_started}
|
|
restart: unless-stopped
|
|
read_only: true
|
|
security_opt: [no-new-privileges:true]
|
|
cap_drop: [ALL]
|
|
tmpfs: ["/tmp:rw,nosuid,nodev,noexec,size=32m"]
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 256M}
|
|
|
|
loki:
|
|
image: grafana/loki:3.7.9
|
|
command: [-config.file=/etc/loki/config.yaml]
|
|
volumes:
|
|
- ./infrastructure/telemetry/loki/config.yaml:/etc/loki/config.yaml:ro
|
|
- loki_data:/loki
|
|
networks: [loki_local]
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 384M}
|
|
|
|
tempo:
|
|
image: grafana/tempo:2.10.5
|
|
command: [-config.file=/etc/tempo/config.yaml]
|
|
volumes:
|
|
- ./infrastructure/telemetry/tempo/config.yaml:/etc/tempo/config.yaml:ro
|
|
- tempo_data:/var/tempo
|
|
networks: [tempo_local]
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 384M}
|
|
|
|
prometheus:
|
|
image: prom/prometheus:v3.16.0
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yaml
|
|
- --storage.tsdb.path=/prometheus
|
|
- --storage.tsdb.retention.time=7d
|
|
volumes:
|
|
- ./infrastructure/telemetry/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro
|
|
- ./infrastructure/telemetry/prometheus/rules:/etc/prometheus/rules:ro
|
|
- prometheus_data:/prometheus
|
|
secrets: [tls_ca, prometheus_client_cert, prometheus_client_key]
|
|
group_add: ["1000"]
|
|
networks: [prometheus_local, telemetry_secure]
|
|
depends_on:
|
|
telemetry-gateway: {condition: service_started}
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 384M}
|
|
|
|
grafana:
|
|
image: grafana/grafana:13.3.0
|
|
user: "0:0"
|
|
environment:
|
|
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
|
GF_SECURITY_ADMIN_USER: lab7-admin
|
|
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_admin_password
|
|
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
|
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
|
|
SSL_CERT_FILE: /run/secrets/tls_ca
|
|
secrets: [tls_ca, grafana_admin_password]
|
|
volumes:
|
|
- grafana_data:/var/lib/grafana
|
|
- ./infrastructure/telemetry/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./secrets/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml:ro
|
|
- ./infrastructure/telemetry/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
networks: [grafana_local, telemetry_secure]
|
|
depends_on:
|
|
prometheus: {condition: service_started}
|
|
loki: {condition: service_started}
|
|
tempo: {condition: service_started}
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 384M}
|
|
|
|
telemetry-gateway:
|
|
image: haproxy:3.2-alpine@sha256:dfba86f031bd4c9039f10f8cc5de75991d1b6766d5460f0335b980408503baad
|
|
user: "1000:1000"
|
|
volumes:
|
|
- ./infrastructure/gateways/telemetry.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
secrets: [telemetry_pem, tls_ca]
|
|
networks: [host_access, telemetry_secure, collector_local, loki_local, tempo_local, prometheus_local, grafana_local]
|
|
ports:
|
|
- "127.0.0.1:${GRAFANA_PORT:-13000}:3000"
|
|
- "127.0.0.1:${PROMETHEUS_PORT:-19090}:9090"
|
|
- "127.0.0.1:${LOKI_PORT:-13100}:3100"
|
|
- "127.0.0.1:${TEMPO_PORT:-13200}:3200"
|
|
healthcheck:
|
|
test: [CMD, haproxy, -c, -f, /usr/local/etc/haproxy/haproxy.cfg]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
cap_drop: [ALL]
|
|
read_only: true
|
|
security_opt: [no-new-privileges:true]
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
security-test:
|
|
profiles: [tests]
|
|
build: {context: ., dockerfile: Dockerfile}
|
|
image: mtusi2026lab7-app
|
|
entrypoint: [curl]
|
|
secrets:
|
|
- source: tls_ca
|
|
target: ca.crt
|
|
- source: lb_client_cert
|
|
target: lb-client.crt
|
|
- source: lb_client_key
|
|
target: lb-client.key
|
|
- source: wrong_client_cert
|
|
target: wrong-client.crt
|
|
- source: wrong_client_key
|
|
target: wrong-client.key
|
|
- source: foreign_client_cert
|
|
target: foreign-client.crt
|
|
- source: foreign_client_key
|
|
target: foreign-client.key
|
|
- source: api_client_cert
|
|
target: api-client.crt
|
|
- source: api_client_key
|
|
target: api-client.key
|
|
- source: worker_client_cert
|
|
target: worker-client.crt
|
|
- source: worker_client_key
|
|
target: worker-client.key
|
|
- source: dispatcher_client_cert
|
|
target: dispatcher-client.crt
|
|
- source: dispatcher_client_key
|
|
target: dispatcher-client.key
|
|
networks: [api_ingress, dependency_secure, telemetry_secure]
|
|
cap_drop: [ALL]
|
|
read_only: true
|
|
security_opt: [no-new-privileges:true]
|
|
tmpfs: ["/tmp:rw,nosuid,nodev,noexec,size=16m"]
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.10", memory: 64M}
|
|
|
|
networks:
|
|
# A non-internal bridge is required for Docker to publish the explicitly
|
|
# loopback-bound operator ports. Application/dependency traffic stays on
|
|
# the isolated internal networks below.
|
|
host_access: {}
|
|
api_ingress: {internal: true}
|
|
postgres_network: {internal: true}
|
|
dependency_secure: {internal: true}
|
|
redis_local: {internal: true}
|
|
s3_local: {internal: true}
|
|
broker_local: {internal: true}
|
|
openbao_network: {internal: true}
|
|
telemetry_secure: {internal: true}
|
|
collector_local: {internal: true}
|
|
loki_local: {internal: true}
|
|
tempo_local: {internal: true}
|
|
prometheus_local: {internal: true}
|
|
grafana_local: {internal: true}
|
|
|
|
volumes:
|
|
postgres_data:
|
|
minio_data:
|
|
broker_data:
|
|
prometheus_data:
|
|
loki_data:
|
|
tempo_data:
|
|
grafana_data:
|
|
|
|
secrets:
|
|
tls_ca: {file: ./secrets/pki/ca.crt}
|
|
ingress_pem: {file: ./secrets/pki/ingress.pem}
|
|
api_cert: {file: ./secrets/pki/api.crt}
|
|
api_key: {file: ./secrets/pki/api.key}
|
|
api_client_uris: {file: ./secrets/pki/api-client-uris.txt}
|
|
api_client_cert: {file: ./secrets/pki/api-client.crt}
|
|
api_client_key: {file: ./secrets/pki/api-client.key}
|
|
worker_client_cert: {file: ./secrets/pki/worker-client.crt}
|
|
worker_client_key: {file: ./secrets/pki/worker-client.key}
|
|
dispatcher_client_cert: {file: ./secrets/pki/dispatcher-client.crt}
|
|
dispatcher_client_key: {file: ./secrets/pki/dispatcher-client.key}
|
|
lb_client_pem: {file: ./secrets/pki/lb-client.pem}
|
|
lb_client_cert: {file: ./secrets/pki/lb-client.crt}
|
|
lb_client_key: {file: ./secrets/pki/lb-client.key}
|
|
wrong_client_cert: {file: ./secrets/pki/wrong-client.crt}
|
|
wrong_client_key: {file: ./secrets/pki/wrong-client.key}
|
|
foreign_client_cert: {file: ./secrets/pki/foreign-client.crt}
|
|
foreign_client_key: {file: ./secrets/pki/foreign-client.key}
|
|
dependency_pem: {file: ./secrets/pki/dependency-gateway.pem}
|
|
telemetry_pem: {file: ./secrets/pki/telemetry-gateway.pem}
|
|
postgres_cert: {file: ./secrets/pki/postgres.crt}
|
|
postgres_key: {file: ./secrets/pki/postgres.key}
|
|
openbao_cert: {file: ./secrets/pki/openbao.crt}
|
|
openbao_key: {file: ./secrets/pki/openbao.key}
|
|
collector_client_cert: {file: ./secrets/pki/collector-client.crt}
|
|
collector_client_key: {file: ./secrets/pki/collector-client.key}
|
|
prometheus_client_cert: {file: ./secrets/pki/prometheus-client.crt}
|
|
prometheus_client_key: {file: ./secrets/pki/prometheus-client.key}
|
|
postgres_admin_password: {file: ./secrets/postgres_admin_password.txt}
|
|
postgres_api_password: {file: ./secrets/postgres_api_password.txt}
|
|
postgres_worker_password: {file: ./secrets/postgres_worker_password.txt}
|
|
postgres_dispatcher_password: {file: ./secrets/postgres_dispatcher_password.txt}
|
|
postgres_roles: {file: ./secrets/postgres-roles.sql}
|
|
redis_config: {file: ./secrets/redis.conf}
|
|
redis_api_password: {file: ./secrets/redis_api_password.txt}
|
|
minio_root_user: {file: ./secrets/minio_root_user.txt}
|
|
minio_root_password: {file: ./secrets/minio_root_password.txt}
|
|
s3_api_access_key: {file: ./secrets/s3_api_access_key.txt}
|
|
s3_api_secret_key: {file: ./secrets/s3_api_secret_key.txt}
|
|
s3_worker_access_key: {file: ./secrets/s3_worker_access_key.txt}
|
|
s3_worker_secret_key: {file: ./secrets/s3_worker_secret_key.txt}
|
|
broker_dispatcher_password: {file: ./secrets/broker_dispatcher_password.txt}
|
|
broker_worker_password: {file: ./secrets/broker_worker_password.txt}
|
|
grafana_admin_password: {file: ./secrets/grafana_admin_password.txt}
|
|
bao_api_role_id: {file: ./secrets/openbao/api_role_id.txt}
|
|
bao_api_secret_id: {file: ./secrets/openbao/api_secret_id.txt}
|
|
bao_worker_role_id: {file: ./secrets/openbao/worker_role_id.txt}
|
|
bao_worker_secret_id: {file: ./secrets/openbao/worker_secret_id.txt}
|
|
bao_dispatcher_role_id: {file: ./secrets/openbao/dispatcher_role_id.txt}
|
|
bao_dispatcher_secret_id: {file: ./secrets/openbao/dispatcher_secret_id.txt}
|