forked from mtusi2026/mtusi2026lab7
868 lines
28 KiB
YAML
868 lines
28 KiB
YAML
# Secure lab7 cutover. The default project name retains the lab6 data volumes.
|
|
# Fresh verification overrides COMPOSE_PROJECT_NAME and LAB7_SECRETS_DIR.
|
|
name: mtusi-messenger-lab6
|
|
|
|
x-log: &log
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
x-hardened: &hardened
|
|
cap_drop: [ALL]
|
|
security_opt: [no-new-privileges:true]
|
|
read_only: true
|
|
group_add: ["10001"]
|
|
tmpfs:
|
|
- /tmp:rw,noexec,nosuid,size=128m,mode=1777
|
|
logging: *log
|
|
stop_grace_period: 40s
|
|
restart: unless-stopped
|
|
|
|
x-app: &app
|
|
<<: *hardened
|
|
image: mtusi-messenger:lab7
|
|
user: "10001:10001"
|
|
|
|
x-tls-environment: &tls-environment
|
|
TLS_CA_FILE: /run/identity/current/ca.crt
|
|
TLS_CERT_FILE: /run/identity/current/tls.crt
|
|
TLS_KEY_FILE: /run/identity/current/tls.key
|
|
TLS_CRL_FILE: /run/identity/current/ca.crl
|
|
TLS_VERSION_FILE: /run/identity/current-version
|
|
|
|
x-app-environment: &app-environment
|
|
<<: *tls-environment
|
|
APP_CONFIG: /etc/messenger/dev/config.yaml
|
|
BAO_ADDR: https://openbao:8200
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_PORT: "5432"
|
|
POSTGRES_DATABASE: messenger
|
|
POSTGRES_SSL_MODE: verify-full
|
|
POSTGRES_MAX_CONNS: "${POSTGRES_MAX_CONNS:-10}"
|
|
POSTGRES_MAX_CONN_LIFETIME: 30s
|
|
POSTGRES_MAX_CONN_IDLE_TIME: 10s
|
|
POSTGRES_CONNECT_TIMEOUT: 5s
|
|
POSTGRES_QUERY_TIMEOUT: 5s
|
|
S3_ENDPOINT: https://seaweedfs:8333
|
|
S3_PUBLIC_ENDPOINT: "https://localhost:${S3_PORT:-8333}"
|
|
S3_REGION: us-east-1
|
|
S3_BUCKET: "${S3_BUCKET:-messenger-attachments}"
|
|
S3_USE_PATH_STYLE: "true"
|
|
S3_TIMEOUT: 30s
|
|
S3_PRESIGN_TTL: "${S3_PRESIGN_TTL:-5m}"
|
|
S3_SWEEP_INTERVAL: "${S3_SWEEP_INTERVAL:-1m}"
|
|
S3_SWEEP_GRACE: "${S3_SWEEP_GRACE:-10m}"
|
|
MAX_UPLOAD_BYTES: "${MAX_UPLOAD_BYTES:-10485760}"
|
|
MAX_IMAGE_PIXELS: "${MAX_IMAGE_PIXELS:-40000000}"
|
|
SESSION_TTL_SECONDS: "${SESSION_TTL_SECONDS:-3600}"
|
|
IDEMPOTENCY_TTL_SECONDS: "${IDEMPOTENCY_TTL_SECONDS:-86400}"
|
|
BROKER_URL: amqps://broker:5671/messenger
|
|
BROKER_EXCHANGE: attachments.jobs
|
|
BROKER_QUEUE: attachment.process.v1
|
|
BROKER_CONNECT_TIMEOUT: 5s
|
|
BROKER_CONFIRM_TIMEOUT: 5s
|
|
BROKER_HEARTBEAT: 10s
|
|
PROCESSING_PIPELINE_VERSION: "${PROCESSING_PIPELINE_VERSION:-1}"
|
|
PROCESSING_MAX_ATTEMPTS: "${PROCESSING_MAX_ATTEMPTS:-5}"
|
|
PROCESSING_JOB_TIMEOUT: "${PROCESSING_JOB_TIMEOUT:-60s}"
|
|
PROCESSING_LEASE_TTL: "${PROCESSING_LEASE_TTL:-90s}"
|
|
PROCESSING_HEARTBEAT: "${PROCESSING_HEARTBEAT:-15s}"
|
|
PROCESSING_RETRY_BASE: "${PROCESSING_RETRY_BASE:-2s}"
|
|
PROCESSING_RETRY_CAP: "${PROCESSING_RETRY_CAP:-60s}"
|
|
STAGING_ORPHAN_GRACE: "${STAGING_ORPHAN_GRACE:-1h}"
|
|
STAGING_FAILED_RETENTION: "${STAGING_FAILED_RETENTION:-168h}"
|
|
ADMISSION_MAX_PENDING_PER_USER: "${ADMISSION_MAX_PENDING_PER_USER:-20}"
|
|
ADMISSION_MAX_PENDING: "${ADMISSION_MAX_PENDING:-200}"
|
|
ADMISSION_MAX_STAGED_BYTES: "${ADMISSION_MAX_STAGED_BYTES:-2147483648}"
|
|
ADMISSION_MAX_CONCURRENT_UPLOADS: "${ADMISSION_MAX_CONCURRENT_UPLOADS:-8}"
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
|
|
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
|
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=lab
|
|
OTEL_METRIC_EXPORT_INTERVAL: "${OTEL_METRIC_EXPORT_INTERVAL:-5000}"
|
|
OTEL_TRACES_SAMPLER: "${OTEL_TRACES_SAMPLER:-always_on}"
|
|
TELEMETRY_ENABLED: "${TELEMETRY_ENABLED:-1}"
|
|
LOG_LEVEL: info
|
|
LOG_FORMAT: json
|
|
|
|
x-gateway: &gateway
|
|
<<: *hardened
|
|
image: haproxy:3.2-alpine@sha256:96ec3c75a9264ba94e733eeacb44051ed6e7b79bb77a73c2c36f236b6423f1f0
|
|
user: "10001:10001"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "0.10"
|
|
memory: 64M
|
|
|
|
services:
|
|
# This operator-only job prepares private data volume ownership. It has no
|
|
# network, no socket, and only the capabilities required for existing volumes.
|
|
volume-init:
|
|
image: alpine:3.22@sha256:49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f
|
|
user: "0:0"
|
|
network_mode: none
|
|
cap_drop: [ALL]
|
|
cap_add: [CHOWN, DAC_OVERRIDE]
|
|
security_opt: [no-new-privileges:true]
|
|
read_only: true
|
|
restart: "no"
|
|
logging: *log
|
|
command:
|
|
- sh
|
|
- -ec
|
|
- |
|
|
chown -R 70:70 /state/postgres
|
|
chown -R 999:1000 /state/redis
|
|
chown -R 10001:10001 /state/s3 /state/loki /state/tempo
|
|
chown -R 100:101 /state/rabbit
|
|
chown -R 65534:65534 /state/prometheus
|
|
chown -R 472:472 /state/grafana
|
|
chown -R 100:1000 /state/bao /state/audit
|
|
volumes:
|
|
- postgres18-data:/state/postgres
|
|
- redis7-data:/state/redis
|
|
- seaweedfs-data:/state/s3
|
|
- rabbitmq-data:/state/rabbit
|
|
- prometheus-data:/state/prometheus
|
|
- loki-data:/state/loki
|
|
- tempo-data:/state/tempo
|
|
- grafana-data:/state/grafana
|
|
- openbao-raft-data:/state/bao
|
|
- openbao-audit:/state/audit
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 64M}
|
|
|
|
openbao:
|
|
<<: *hardened
|
|
image: openbao/openbao:2.7.2@sha256:5046911075e137e154ce49ab051502f4ec7cf367d484ae4a4dce665d9b90561f
|
|
user: "100:1000"
|
|
networks: [default, edge]
|
|
command: [server, -config=/etc/openbao/server.hcl]
|
|
environment:
|
|
SKIP_CHOWN: "true"
|
|
SKIP_SETCAP: "true"
|
|
volumes:
|
|
- openbao-raft-data:/openbao/file
|
|
- openbao-audit:/openbao/audit
|
|
- type: bind
|
|
source: ./infra/openbao/server.hcl
|
|
target: /etc/openbao/server.hcl
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/openbao
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${BAO_PORT:-8200}:8200"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck: {disable: true}
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 256M}
|
|
|
|
postgres:
|
|
<<: *hardened
|
|
image: postgres:18-alpine@sha256:123b17998ccaf47e53b502e8c6a1e79afd8f579c6f3eec83c563da026f957395
|
|
user: "70:70"
|
|
entrypoint: [/bin/sh, /security/entrypoint.sh]
|
|
environment:
|
|
POSTGRES_USER: lab_operator
|
|
POSTGRES_PASSWORD_FILE: /run/backend/operator-password
|
|
POSTGRES_DB: messenger
|
|
volumes:
|
|
- postgres18-data:/var/lib/postgresql
|
|
- type: bind
|
|
source: ./infra/postgres/entrypoint.sh
|
|
target: /security/entrypoint.sh
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ./infra/postgres/pg_hba.conf
|
|
target: /etc/postgresql/pg_hba.conf
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/postgres
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/backends/postgres
|
|
target: /run/backend
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
tmpfs:
|
|
- /tmp:rw,noexec,nosuid,size=64m,mode=1777
|
|
- /var/run/postgresql:rw,noexec,nosuid,size=8m,uid=70,gid=70,mode=0750
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: [CMD, pg_isready, -U, lab_operator, -d, messenger]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 10s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${POSTGRES_CPU_LIMIT:-0.50}"
|
|
memory: ${POSTGRES_MEM_LIMIT:-320M}
|
|
|
|
redis:
|
|
<<: *hardened
|
|
image: redis:7.4-alpine@sha256:c5d34a98396a4775e223c74e929162c35c5a2182901ba26b50ade939941ce14b
|
|
user: "999:1000"
|
|
command: [redis-server, /etc/redis/redis.conf]
|
|
volumes:
|
|
- redis7-data:/data
|
|
- type: bind
|
|
source: ./infra/redis/redis.conf
|
|
target: /etc/redis/redis.conf
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/redis
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/backends/redis
|
|
target: /run/backend
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'REDISCLI_AUTH=$$(cat /run/backend/health-password) redis-cli --tls --cacert /run/identity/current/ca.crt --user health ping']
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
# Namespace owner: all master/filer/volume transports are loopback-only.
|
|
seaweedfs:
|
|
<<: *hardened
|
|
image: chrislusf/seaweedfs:4.51@sha256:f7a49e3f3972ebed5be2ed4befa4a0c68eb7bdddba6e692d42729ceb545134b8
|
|
user: "10001:10001"
|
|
networks: [default, edge]
|
|
command: [server, -filer, -ip=127.0.0.1, -ip.bind=127.0.0.1, -dir=/data, -master.volumeSizeLimitMB=64, -filer.exposeDirectoryData=false]
|
|
environment: {GOGC: "50", GOMEMLIMIT: 512MiB}
|
|
volumes:
|
|
- seaweedfs-data:/data
|
|
- type: bind
|
|
source: ./infra/s3/security.toml
|
|
target: /etc/seaweedfs/security.toml
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/s3
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${S3_PORT:-8333}:8333"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'wget -q -O /dev/null http://127.0.0.1:8888/healthz']
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 24
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "1.00", memory: 640M}
|
|
|
|
# Native HTTPS S3 and its auxiliary mTLS gRPC share the closed storage namespace.
|
|
s3:
|
|
<<: *hardened
|
|
image: chrislusf/seaweedfs:4.51@sha256:f7a49e3f3972ebed5be2ed4befa4a0c68eb7bdddba6e692d42729ceb545134b8
|
|
user: "10001:10001"
|
|
network_mode: service:seaweedfs
|
|
command: [s3, -filer=127.0.0.1:8888.18888, -ip.bind=0.0.0.0, -port=8333, -port.iceberg=0, -port.lance=0, -config=/run/backend/s3.json, -cert.file=/run/identity/current/tls.crt, -key.file=/run/identity/current/tls.key, -cacert.file=/run/identity/current/ca.crt]
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/s3/security.toml
|
|
target: /etc/seaweedfs/security.toml
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/s3
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/backends/s3
|
|
target: /run/backend
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
seaweedfs: {condition: service_healthy}
|
|
healthcheck: {disable: true}
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 256M}
|
|
|
|
broker:
|
|
<<: *hardened
|
|
image: rabbitmq:4.3.7-management-alpine@sha256:1528a88eebf2bc4d0ab7e9d5d9bc542e9bdf5e1b105e65848fcf8de5c2186528
|
|
user: "100:101"
|
|
hostname: broker
|
|
extra_hosts: ["broker:127.0.0.1"]
|
|
environment:
|
|
RABBITMQ_NODENAME: rabbit@broker
|
|
ERL_EPMD_ADDRESS: 127.0.0.1
|
|
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: '-kernel inet_dist_use_interface {127,0,0,1}'
|
|
networks: [default, observability, edge]
|
|
volumes:
|
|
- rabbitmq-data:/var/lib/rabbitmq
|
|
- type: bind
|
|
source: ./infra/rabbitmq/rabbitmq.conf
|
|
target: /etc/rabbitmq/rabbitmq.conf
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ./infra/rabbitmq/enabled_plugins
|
|
target: /etc/rabbitmq/enabled_plugins
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/broker
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/backends/broker
|
|
target: /run/backend
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${BROKER_MANAGEMENT_PORT:-15671}:15671"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: [CMD, rabbitmq-diagnostics, -q, ping]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${BROKER_CPU_LIMIT:-0.50}"
|
|
memory: ${BROKER_MEM_LIMIT:-384M}
|
|
|
|
broker-admin-tls:
|
|
<<: *gateway
|
|
network_mode: service:broker
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/rabbitmq/admin-tls.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/broker
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
broker: {condition: service_started}
|
|
healthcheck: {disable: true}
|
|
|
|
migrate:
|
|
<<: *app
|
|
entrypoint: [/usr/local/bin/migrate]
|
|
command: [up]
|
|
environment:
|
|
<<: *tls-environment
|
|
APP_CONFIG: /etc/messenger/dev/config.yaml
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_PORT: "5432"
|
|
POSTGRES_DATABASE: messenger
|
|
POSTGRES_USER: lab_operator
|
|
POSTGRES_PASSWORD_FILE: /run/bootstrap/postgres-password
|
|
POSTGRES_SSL_MODE: verify-full
|
|
volumes:
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/operator
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/bootstrap/migrate
|
|
target: /run/bootstrap
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
profiles: [operator]
|
|
healthcheck: {disable: true}
|
|
restart: "no"
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.50", memory: 256M}
|
|
|
|
s3-init:
|
|
<<: *app
|
|
entrypoint: [/usr/local/bin/s3init]
|
|
environment:
|
|
<<: *tls-environment
|
|
S3_ENDPOINT: https://seaweedfs:8333
|
|
S3_REGION: us-east-1
|
|
S3_BUCKET: "${S3_BUCKET:-messenger-attachments}"
|
|
S3_ACCESS_KEY_ID_FILE: /run/bootstrap/s3-admin-access-key
|
|
S3_SECRET_ACCESS_KEY_FILE: /run/bootstrap/s3-admin-secret-key
|
|
volumes:
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/operator
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/bootstrap/s3
|
|
target: /run/bootstrap
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
s3: {condition: service_started}
|
|
profiles: [operator]
|
|
healthcheck: {disable: true}
|
|
restart: "no"
|
|
deploy:
|
|
resources:
|
|
limits: {cpus: "0.25", memory: 128M}
|
|
|
|
jobctl:
|
|
extends: {service: migrate}
|
|
entrypoint: [/usr/local/bin/jobctl]
|
|
command: [failed]
|
|
|
|
api:
|
|
<<: *app
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args: {VERSION: "${VERSION:-dev}"}
|
|
environment:
|
|
<<: *app-environment
|
|
BAO_ROLE: api
|
|
BAO_KV_PATH: secret/data/api
|
|
OTEL_SERVICE_NAME: messenger-api
|
|
POSTGRES_USER: messenger_api
|
|
REDIS_ENABLED: "true"
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: "6379"
|
|
REDIS_USERNAME: cache
|
|
REDIS_DB: "0"
|
|
CACHE_ENABLED: "true"
|
|
SERVER_HOST: 0.0.0.0
|
|
SERVER_PORT: "8080"
|
|
SERVER_MAX_BODY_BYTES: "${SERVER_MAX_BODY_BYTES:-262144}"
|
|
SERVER_READ_HEADER_TIMEOUT: 10s
|
|
SERVER_READ_TIMEOUT: 60s
|
|
SERVER_SHUTDOWN_TIMEOUT: 30s
|
|
GOMEMLIMIT: 192MiB
|
|
networks:
|
|
default: {aliases: [api-replica]}
|
|
volumes:
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/api
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
redis: {condition: service_healthy}
|
|
openbao: {condition: service_started}
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:8084/health/ready]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 5s
|
|
deploy:
|
|
replicas: ${API_REPLICAS:-2}
|
|
resources:
|
|
limits:
|
|
cpus: "${API_CPU_LIMIT:-0.50}"
|
|
memory: ${API_MEM_LIMIT:-256M}
|
|
|
|
worker:
|
|
<<: *app
|
|
entrypoint: [/usr/local/bin/worker]
|
|
environment:
|
|
<<: *app-environment
|
|
BAO_ROLE: worker
|
|
BAO_KV_PATH: secret/data/worker
|
|
OTEL_SERVICE_NAME: messenger-worker
|
|
POSTGRES_USER: messenger_worker
|
|
POSTGRES_MAX_CONNS: "4"
|
|
REDIS_ENABLED: "false"
|
|
CACHE_ENABLED: "false"
|
|
WORKER_CONCURRENCY: "${WORKER_CONCURRENCY:-1}"
|
|
WORKER_PREFETCH: "${WORKER_PREFETCH:-1}"
|
|
WORKER_SHUTDOWN_TIMEOUT: 30s
|
|
WORKER_HEALTH_ADDR: 127.0.0.1:8081
|
|
GOMEMLIMIT: 768MiB
|
|
FAULTS_ENABLED: "${FAULTS_ENABLED:-0}"
|
|
FAULT_TARGET_JOB: "${FAULT_TARGET_JOB:-}"
|
|
FAULT_WORKER_AFTER_CLAIM: "${FAULT_WORKER_AFTER_CLAIM:-}"
|
|
FAULT_WORKER_AFTER_FIRST_VARIANT: "${FAULT_WORKER_AFTER_FIRST_VARIANT:-}"
|
|
FAULT_WORKER_AFTER_PUT: "${FAULT_WORKER_AFTER_PUT:-}"
|
|
FAULT_WORKER_AFTER_COMMIT: "${FAULT_WORKER_AFTER_COMMIT:-}"
|
|
FAULT_WORKER_FAIL: "${FAULT_WORKER_FAIL:-}"
|
|
FAULT_WORKER_SLEEP_AFTER_CLAIM: "${FAULT_WORKER_SLEEP_AFTER_CLAIM:-}"
|
|
volumes:
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/worker
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
broker: {condition: service_healthy}
|
|
openbao: {condition: service_started}
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:8081/health/ready]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 10s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${WORKER_CPU_LIMIT:-1.00}"
|
|
memory: ${WORKER_MEM_LIMIT:-1G}
|
|
|
|
relay:
|
|
<<: *app
|
|
entrypoint: [/usr/local/bin/relay]
|
|
environment:
|
|
<<: *app-environment
|
|
BAO_ROLE: relay
|
|
BAO_KV_PATH: secret/data/relay
|
|
OTEL_SERVICE_NAME: messenger-relay
|
|
POSTGRES_USER: messenger_relay
|
|
POSTGRES_MAX_CONNS: "3"
|
|
REDIS_ENABLED: "false"
|
|
CACHE_ENABLED: "false"
|
|
RELAY_HEALTH_ADDR: 127.0.0.1:8082
|
|
OUTBOX_POLL_INTERVAL: "${OUTBOX_POLL_INTERVAL:-1s}"
|
|
OUTBOX_CLAIM_TTL: "${OUTBOX_CLAIM_TTL:-30s}"
|
|
OUTBOX_BATCH: "${OUTBOX_BATCH:-20}"
|
|
OUTBOX_REAPER_INTERVAL: "${OUTBOX_REAPER_INTERVAL:-15s}"
|
|
OUTBOX_RECONCILE_AFTER: "${OUTBOX_RECONCILE_AFTER:-5m}"
|
|
OUTBOX_RETENTION: "${OUTBOX_RETENTION:-168h}"
|
|
GOMEMLIMIT: 96MiB
|
|
FAULTS_ENABLED: "${FAULTS_ENABLED:-0}"
|
|
FAULT_TARGET_JOB: "${FAULT_TARGET_JOB:-}"
|
|
FAULT_OUTBOX_AFTER_COMMIT: "${FAULT_OUTBOX_AFTER_COMMIT:-}"
|
|
volumes:
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/relay
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
postgres: {condition: service_healthy}
|
|
broker: {condition: service_healthy}
|
|
openbao: {condition: service_started}
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:8082/health/ready]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${RELAY_CPU_LIMIT:-0.25}"
|
|
memory: ${RELAY_MEM_LIMIT:-128M}
|
|
|
|
lb:
|
|
<<: *gateway
|
|
networks: [default, observability, edge]
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/lb/haproxy.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/lb
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports:
|
|
- "127.0.0.1:${PUBLIC_PORT:-8443}:8443"
|
|
- "127.0.0.1:${LB_STATS_PORT:-8404}:8404"
|
|
depends_on:
|
|
api: {condition: service_healthy}
|
|
healthcheck: {disable: true}
|
|
|
|
otel-collector:
|
|
<<: *hardened
|
|
image: otel/opentelemetry-collector-contrib:0.164.0@sha256:340c9ca6a36617084c6661bdc4f0fe92b7cda5a805d61673ec8db375fddc522b
|
|
user: "10001:10001"
|
|
command: [--config=/etc/otel/collector.yaml]
|
|
environment: {GOMEMLIMIT: 140MiB}
|
|
networks:
|
|
default: {aliases: [collector]}
|
|
observability: {aliases: [collector]}
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/otel/collector.yaml
|
|
target: /etc/otel/collector.yaml
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/collector
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
healthcheck: {disable: true}
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${OTEL_COLLECTOR_CPU_LIMIT:-0.25}"
|
|
memory: ${OTEL_COLLECTOR_MEM_LIMIT:-192M}
|
|
|
|
collector-tls:
|
|
<<: *gateway
|
|
network_mode: service:otel-collector
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/telemetry-gateway/collector.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/collector
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
otel-collector: {condition: service_started}
|
|
healthcheck: {disable: true}
|
|
|
|
prometheus:
|
|
<<: *hardened
|
|
image: prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2
|
|
user: "65534:65534"
|
|
command: [--config.file=/etc/prometheus/prometheus.yml, --web.listen-address=127.0.0.1:19090, --storage.tsdb.path=/prometheus, --storage.tsdb.retention.time=10d, --storage.tsdb.retention.size=2GB]
|
|
networks: [observability, edge]
|
|
environment: {GOMEMLIMIT: 256MiB}
|
|
volumes:
|
|
- prometheus-data:/prometheus
|
|
- type: bind
|
|
source: ./infra/prometheus
|
|
target: /etc/prometheus
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/prometheus
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${PROMETHEUS_PORT:-9090}:9090"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:19090/-/ready]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${PROMETHEUS_CPU_LIMIT:-0.50}"
|
|
memory: ${PROMETHEUS_MEM_LIMIT:-320M}
|
|
|
|
prometheus-tls:
|
|
<<: *gateway
|
|
network_mode: service:prometheus
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/telemetry-gateway/prometheus.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/prometheus
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
prometheus: {condition: service_started}
|
|
healthcheck: {disable: true}
|
|
|
|
loki:
|
|
<<: *hardened
|
|
image: grafana/loki:3.6.4@sha256:be31579ac047e9f78b81e48f3b69d3af709e7299b431d5aa78bcda43382f9511
|
|
user: "10001:10001"
|
|
command: [-config.file=/etc/loki/loki.yaml]
|
|
networks: [observability, edge]
|
|
environment: {GOMEMLIMIT: 256MiB}
|
|
volumes:
|
|
- loki-data:/loki
|
|
- type: bind
|
|
source: ./infra/loki/loki.yaml
|
|
target: /etc/loki/loki.yaml
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${LOKI_PORT:-3100}:3100"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck: {disable: true}
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${LOKI_CPU_LIMIT:-0.50}"
|
|
memory: ${LOKI_MEM_LIMIT:-320M}
|
|
|
|
loki-tls:
|
|
<<: *gateway
|
|
network_mode: service:loki
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/telemetry-gateway/loki.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/loki
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
loki: {condition: service_started}
|
|
healthcheck: {disable: true}
|
|
|
|
tempo:
|
|
<<: *hardened
|
|
image: grafana/tempo:2.10.10@sha256:12b0820f13ffa10ce956b6e9acc3b03f3cffded99109be6cc09d106fe56e5d38
|
|
user: "10001:10001"
|
|
command: [-config.file=/etc/tempo/tempo.yaml]
|
|
networks: [observability, edge]
|
|
environment: {GOMEMLIMIT: 640MiB}
|
|
volumes:
|
|
- tempo-data:/var/tempo
|
|
- type: bind
|
|
source: ./infra/tempo/tempo.yaml
|
|
target: /etc/tempo/tempo.yaml
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${TEMPO_PORT:-3200}:3200"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck: {disable: true}
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${TEMPO_CPU_LIMIT:-0.25}"
|
|
memory: ${TEMPO_MEM_LIMIT:-768M}
|
|
|
|
tempo-tls:
|
|
<<: *gateway
|
|
network_mode: service:tempo
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/telemetry-gateway/tempo.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/tempo
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
tempo: {condition: service_started}
|
|
healthcheck: {disable: true}
|
|
|
|
grafana:
|
|
<<: *hardened
|
|
image: grafana/grafana:13.2.5@sha256:9f7aa1e1e3246aade5792d35a738049f7f32f89cd51d1956cf426a4e86268a84
|
|
user: "472:472"
|
|
networks: [observability, edge]
|
|
environment:
|
|
GF_SERVER_HTTP_ADDR: 127.0.0.1
|
|
GF_SERVER_HTTP_PORT: "13000"
|
|
GF_SERVER_PROTOCOL: http
|
|
GF_SERVER_ROOT_URL: "https://localhost:${GRAFANA_PORT:-3000}/"
|
|
GF_SECURITY_ADMIN_PASSWORD__FILE: /etc/grafana/provisioning/admin-password
|
|
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
|
GF_AUTH_PROXY_ENABLED: "false"
|
|
GF_USERS_ALLOW_SIGN_UP: "false"
|
|
volumes:
|
|
- grafana-data:/var/lib/grafana
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/backends/grafana
|
|
target: /etc/grafana/provisioning
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ./infra/grafana/dashboards
|
|
target: /var/lib/grafana/dashboards
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/grafana
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
ports: ["127.0.0.1:${GRAFANA_PORT:-3000}:3000"]
|
|
depends_on:
|
|
volume-init: {condition: service_completed_successfully}
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:13000/api/health]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "${GRAFANA_CPU_LIMIT:-0.25}"
|
|
memory: ${GRAFANA_MEM_LIMIT:-512M}
|
|
|
|
grafana-tls:
|
|
<<: *gateway
|
|
network_mode: service:grafana
|
|
volumes:
|
|
- type: bind
|
|
source: ./infra/telemetry-gateway/grafana.cfg
|
|
target: /usr/local/etc/haproxy/haproxy.cfg
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
- type: bind
|
|
source: ${LAB7_SECRETS_DIR:-./secrets/lab7}/pki/grafana
|
|
target: /run/identity
|
|
read_only: true
|
|
bind: {create_host_path: false}
|
|
depends_on:
|
|
grafana: {condition: service_started}
|
|
healthcheck: {disable: true}
|
|
|
|
networks:
|
|
default: {internal: true}
|
|
observability: {internal: true}
|
|
# Docker Desktop does not publish ports for internal-only namespaces.
|
|
# Only CA-verified TLS owners join edge; API replicas still have no host ports.
|
|
edge:
|
|
|
|
volumes:
|
|
postgres18-data:
|
|
redis7-data:
|
|
seaweedfs-data:
|
|
rabbitmq-data:
|
|
prometheus-data:
|
|
loki-data:
|
|
tempo-data:
|
|
grafana-data:
|
|
openbao-raft-data:
|
|
openbao-audit:
|