forked from mtusi2026/mtusi2026lab7
531 lines
17 KiB
YAML
531 lines
17 KiB
YAML
services:
|
|
openbao:
|
|
image: quay.io/openbao/openbao:2.0.1
|
|
entrypoint: ["bao"]
|
|
command: ["server", "-config=/openbao/config/openbao.hcl"]
|
|
cap_add: ["IPC_LOCK"]
|
|
volumes:
|
|
- ./infra/openbao/openbao.hcl:/openbao/config/openbao.hcl:ro
|
|
- ./infra/openbao/policy-api.hcl:/openbao/policies/policy-api.hcl:ro
|
|
- ./infra/openbao/policy-worker.hcl:/openbao/policies/policy-worker.hcl:ro
|
|
- ./infra/certs/openbao.crt:/openbao/certs/openbao.crt:ro
|
|
- ./infra/certs/openbao.key:/openbao/certs/openbao.key:ro
|
|
- ./infra/certs/ca.crt:/openbao/certs/ca.crt:ro
|
|
- baodata:/openbao/file
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.50'
|
|
memory: 512M
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "bao status -tls-skip-verify >/dev/null 2>&1 || test $$? -eq 2"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
postgres:
|
|
image: postgres:15.5-alpine3.19
|
|
user: "70:70"
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
environment:
|
|
POSTGRES_DB: messenger
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
command:
|
|
- |
|
|
set -e
|
|
cp /etc/pg/certs-src/postgres.crt /tmp/postgres.crt
|
|
cp /etc/pg/certs-src/postgres.key /tmp/postgres.key
|
|
cp /etc/pg/certs-src/ca.crt /tmp/ca.crt
|
|
chmod 600 /tmp/postgres.key
|
|
chmod 644 /tmp/postgres.crt /tmp/ca.crt
|
|
exec docker-entrypoint.sh postgres \
|
|
-c ssl=on \
|
|
-c ssl_cert_file=/tmp/postgres.crt \
|
|
-c ssl_key_file=/tmp/postgres.key \
|
|
-c ssl_ca_file=/tmp/ca.crt
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./infra/certs:/etc/pg/certs-src:ro
|
|
- ./infra/postgres/init-roles.sql:/docker-entrypoint-initdb.d/01-init-roles.sql:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.50'
|
|
memory: 512M
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d messenger"]
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
redis:
|
|
image: redis:7.2.4-alpine
|
|
user: "999:1000"
|
|
cap_add: ["CHOWN", "SETGID", "SETUID"]
|
|
command: >
|
|
redis-server
|
|
--appendonly yes
|
|
--appendfsync everysec
|
|
--tls-port 6379
|
|
--port 0
|
|
--tls-cert-file /etc/redis/certs/redis.crt
|
|
--tls-key-file /etc/redis/certs/redis.key
|
|
--tls-ca-cert-file /etc/redis/certs/ca.crt
|
|
--tls-auth-clients yes
|
|
--aclfile /etc/redis/users.acl
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- redisdata:/data
|
|
- ./infra/certs/redis.crt:/etc/redis/certs/redis.crt:ro
|
|
- ./infra/certs/redis.key:/etc/redis/certs/redis.key:ro
|
|
- ./infra/certs/ca.crt:/etc/redis/certs/ca.crt:ro
|
|
- ./infra/redis/users.acl:/etc/redis/users.acl:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
healthcheck:
|
|
test:
|
|
- "CMD"
|
|
- "redis-cli"
|
|
- "--tls"
|
|
- "--cacert"
|
|
- "/etc/redis/certs/ca.crt"
|
|
- "--cert"
|
|
- "/etc/redis/certs/redis.crt"
|
|
- "--key"
|
|
- "/etc/redis/certs/redis.key"
|
|
- "--user"
|
|
- "messenger-client"
|
|
- "-p"
|
|
- "6379"
|
|
- "ping"
|
|
interval: 3s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
migrate:
|
|
image: postgres:15.5-alpine3.19
|
|
environment:
|
|
PGPASSWORD: ${POSTGRES_PASSWORD}
|
|
PGSSLMODE: verify-full
|
|
PGSSLROOTCERT: /certs/ca.crt
|
|
volumes:
|
|
- ./migrations:/migrations:ro
|
|
- ./infra/certs/ca.crt:/certs/ca.crt:ro
|
|
command: >
|
|
sh -c "until pg_isready -h postgres -U postgres; do sleep 1; done;
|
|
psql -h postgres -U postgres -d messenger -f /migrations/init.sql"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
|
|
s3:
|
|
image: chrislusf/seaweedfs:3.67
|
|
command:
|
|
- "server"
|
|
- "-s3"
|
|
- "-dir=/data"
|
|
- "-s3.port=8333"
|
|
- "-s3.cert.file=/etc/s3/certs/s3.crt"
|
|
- "-s3.key.file=/etc/s3/certs/s3.key"
|
|
environment:
|
|
- AWS_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID:-appuser}
|
|
- AWS_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY:-appsecretpassword}
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- s3data:/data
|
|
- ./infra/certs/s3.crt:/etc/s3/certs/s3.crt:ro
|
|
- ./infra/certs/s3.key:/etc/s3/certs/s3.key:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.50'
|
|
memory: 512M
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget --no-check-certificate -q -O /dev/null https://127.0.0.1:8333/ || test $$? -eq 8 || exit 1"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
s3-init:
|
|
image: python:3.11.7-slim-bookworm
|
|
volumes:
|
|
- ./scripts:/scripts:ro
|
|
- ./requirements.txt:/requirements.txt:ro
|
|
- ./infra/certs/ca.crt:/certs/ca.crt:ro
|
|
environment:
|
|
- S3_ENDPOINT=https://s3:8333
|
|
- S3_BUCKET=messenger-attachments
|
|
- S3_ROOT_ACCESS_KEY=${S3_ACCESS_KEY_ID:-appuser}
|
|
- S3_ROOT_SECRET_KEY=${S3_SECRET_ACCESS_KEY:-appsecretpassword}
|
|
- AWS_CA_BUNDLE=/certs/ca.crt
|
|
- S3_API_ACCESS_KEY_ID=${S3_API_ACCESS_KEY_ID:-messenger_api_s3}
|
|
- S3_API_SECRET_ACCESS_KEY=${S3_API_SECRET_ACCESS_KEY:-messenger_api_secret}
|
|
- S3_WORKER_ACCESS_KEY_ID=${S3_WORKER_ACCESS_KEY_ID:-messenger_worker_s3}
|
|
- S3_WORKER_SECRET_ACCESS_KEY=${S3_WORKER_SECRET_ACCESS_KEY:-messenger_worker_secret}
|
|
command: >
|
|
sh -c "pip install --no-cache-dir -r /requirements.txt &&
|
|
python /scripts/bootstrap_s3.py"
|
|
depends_on:
|
|
s3:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
|
|
prometheus:
|
|
image: prom/prometheus:v2.51.0
|
|
command:
|
|
- "--config.file=/etc/prometheus/prometheus.yml"
|
|
- "--storage.tsdb.path=/prometheus"
|
|
- "--storage.tsdb.retention.time=7d"
|
|
- "--web.enable-remote-write-receiver"
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- ./infra/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
- ./infra/prometheus/alerts.yml:/etc/prometheus/alerts.yml:ro
|
|
- promdata:/prometheus
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
|
|
loki:
|
|
image: grafana/loki:3.0.0
|
|
command: ["-config.file=/etc/loki/local-config.yaml"]
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- ./infra/loki/loki-config.yaml:/etc/loki/local-config.yaml:ro
|
|
- lokidata:/loki
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
|
|
tempo:
|
|
image: grafana/tempo:2.4.1
|
|
command: ["-config.file=/etc/tempo.yaml"]
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- ./infra/tempo/tempo-config.yaml:/etc/tempo.yaml:ro
|
|
- tempodata:/var/tempo
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
|
|
otel-collector:
|
|
image: otel/opentelemetry-collector-contrib:0.97.0
|
|
command: ["--config=/etc/otelcol-contrib/collector.yaml"]
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,noexec,nosuid,size=64m
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- ./infra/otel/collector.yaml:/etc/otelcol-contrib/collector.yaml:ro
|
|
- ./infra/certs/otel-collector.crt:/etc/otelcol-contrib/certs/otel-collector.crt:ro
|
|
- ./infra/certs/otel-collector.key:/etc/otelcol-contrib/certs/otel-collector.key:ro
|
|
- ./infra/certs/ca.crt:/etc/otelcol-contrib/certs/ca.crt:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 320M
|
|
depends_on:
|
|
- prometheus
|
|
- loki
|
|
- tempo
|
|
|
|
grafana:
|
|
image: grafana/grafana:10.4.2
|
|
ports:
|
|
- "127.0.0.1:3000:3000"
|
|
environment:
|
|
- GF_SECURITY_ADMIN_USER=${GF_ADMIN_USER:-admin}
|
|
- GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASSWORD:-admin}
|
|
- GF_AUTH_ANONYMOUS_ENABLED=false
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./infra/grafana/dashboard:/var/lib/grafana/dashboards:ro
|
|
- grafanadata:/var/lib/grafana
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
depends_on:
|
|
- prometheus
|
|
- loki
|
|
- tempo
|
|
|
|
api-1:
|
|
build: .
|
|
user: "10001:10001"
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
command:
|
|
- "uvicorn"
|
|
- "app:app"
|
|
- "--host"
|
|
- "0.0.0.0"
|
|
- "--port"
|
|
- "8443"
|
|
- "--ssl-certfile"
|
|
- "/certs/api-1.crt"
|
|
- "--ssl-keyfile"
|
|
- "/certs/api-1.key"
|
|
- "--ssl-ca-certs"
|
|
- "/certs/ca.crt"
|
|
- "--ssl-cert-reqs"
|
|
- "2"
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,noexec,nosuid,size=64m
|
|
environment:
|
|
- DATABASE_URL=postgresql://messenger_api:messenger_api_pass@postgres:5432/messenger
|
|
- REDIS_URL=rediss://messenger-client@redis:6379/0?ssl_cert_reqs=required&ssl_ca_certs=/certs/ca.crt&ssl_certfile=/certs/api-1.crt&ssl_keyfile=/certs/api-1.key
|
|
- SESSION_TTL_SECONDS=3600
|
|
- INSTANCE_ID=api-replica-1
|
|
- ALLOWED_LB_CLIENT_CN=edge-lb
|
|
- ENFORCE_MTLS_CLIENT=true
|
|
- LOGIN_GLOBAL_RATE_LIMIT_MAX=30
|
|
- LOGIN_GLOBAL_RATE_LIMIT_WINDOW_SEC=60
|
|
- SECRET_HMAC_KEY=${SECRET_HMAC_KEY}
|
|
- S3_ENDPOINT=https://s3:8333
|
|
- S3_BUCKET=messenger-attachments
|
|
- AWS_CA_BUNDLE=/certs/ca.crt
|
|
- AWS_ACCESS_KEY_ID=${S3_API_ACCESS_KEY_ID:-messenger_api_s3}
|
|
- AWS_SECRET_ACCESS_KEY=${S3_API_SECRET_ACCESS_KEY:-messenger_api_secret}
|
|
- S3_KEY_PREFIX=api/
|
|
- BAO_ADDR=https://openbao:8200
|
|
- BAO_CACERT=/certs/ca.crt
|
|
- ARGON2_MEMORY_KIB=19456
|
|
- ARGON2_ITERATIONS=2
|
|
- ARGON2_PARALLELISM=1
|
|
- OTEL_SERVICE_NAME=messenger-api
|
|
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4318
|
|
- OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
|
- OTEL_EXPORTER_OTLP_CERTIFICATE=/certs/ca.crt
|
|
- OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE=/certs/api-1.crt
|
|
- OTEL_EXPORTER_OTLP_CLIENT_KEY=/certs/api-1.key
|
|
- OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
|
|
env_file:
|
|
- ./infra/certs/api-approle.env
|
|
volumes:
|
|
- ./infra/certs/api-1.crt:/certs/api-1.crt:ro
|
|
- ./infra/certs/api-1.key:/certs/api-1.key:ro
|
|
- ./infra/certs/ca.crt:/certs/ca.crt:ro
|
|
- ./infra/certs/lb-ca.crt:/certs/lb-ca.crt:ro
|
|
- ./infra/certs/edge-lb.crt:/certs/edge-lb.crt:ro
|
|
- ./infra/certs/edge-lb.key:/certs/edge-lb.key:ro
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import ssl, urllib.request; ctx = ssl.create_default_context(cafile='/certs/ca.crt'); ctx.load_cert_chain('/certs/edge-lb.crt', '/certs/edge-lb.key'); urllib.request.urlopen('https://api-1:8443/health/ready', context=ctx, timeout=3)"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 3
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
s3-init:
|
|
condition: service_completed_successfully
|
|
openbao:
|
|
condition: service_healthy
|
|
|
|
api-2:
|
|
build: .
|
|
user: "10001:10001"
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
command:
|
|
- "uvicorn"
|
|
- "app:app"
|
|
- "--host"
|
|
- "0.0.0.0"
|
|
- "--port"
|
|
- "8443"
|
|
- "--ssl-certfile"
|
|
- "/certs/api-2.crt"
|
|
- "--ssl-keyfile"
|
|
- "/certs/api-2.key"
|
|
- "--ssl-ca-certs"
|
|
- "/certs/ca.crt"
|
|
- "--ssl-cert-reqs"
|
|
- "2"
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,noexec,nosuid,size=64m
|
|
environment:
|
|
- DATABASE_URL=postgresql://messenger_api:messenger_api_pass@postgres:5432/messenger
|
|
- REDIS_URL=rediss://messenger-client@redis:6379/0?ssl_cert_reqs=required&ssl_ca_certs=/certs/ca.crt&ssl_certfile=/certs/api-2.crt&ssl_keyfile=/certs/api-2.key
|
|
- SESSION_TTL_SECONDS=3600
|
|
- INSTANCE_ID=api-replica-2
|
|
- ALLOWED_LB_CLIENT_CN=edge-lb
|
|
- ENFORCE_MTLS_CLIENT=true
|
|
- LOGIN_GLOBAL_RATE_LIMIT_MAX=30
|
|
- LOGIN_GLOBAL_RATE_LIMIT_WINDOW_SEC=60
|
|
- SECRET_HMAC_KEY=${SECRET_HMAC_KEY}
|
|
- S3_ENDPOINT=https://s3:8333
|
|
- S3_BUCKET=messenger-attachments
|
|
- AWS_CA_BUNDLE=/certs/ca.crt
|
|
- AWS_ACCESS_KEY_ID=${S3_API_ACCESS_KEY_ID:-messenger_api_s3}
|
|
- AWS_SECRET_ACCESS_KEY=${S3_API_SECRET_ACCESS_KEY:-messenger_api_secret}
|
|
- S3_KEY_PREFIX=api/
|
|
- BAO_ADDR=https://openbao:8200
|
|
- BAO_CACERT=/certs/ca.crt
|
|
- ARGON2_MEMORY_KIB=19456
|
|
- ARGON2_ITERATIONS=2
|
|
- ARGON2_PARALLELISM=1
|
|
- OTEL_SERVICE_NAME=messenger-api
|
|
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4318
|
|
- OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
|
- OTEL_EXPORTER_OTLP_CERTIFICATE=/certs/ca.crt
|
|
- OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE=/certs/api-2.crt
|
|
- OTEL_EXPORTER_OTLP_CLIENT_KEY=/certs/api-2.key
|
|
- OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
|
|
env_file:
|
|
- ./infra/certs/api-approle.env
|
|
volumes:
|
|
- ./infra/certs/api-2.crt:/certs/api-2.crt:ro
|
|
- ./infra/certs/api-2.key:/certs/api-2.key:ro
|
|
- ./infra/certs/ca.crt:/certs/ca.crt:ro
|
|
- ./infra/certs/lb-ca.crt:/certs/lb-ca.crt:ro
|
|
- ./infra/certs/edge-lb.crt:/certs/edge-lb.crt:ro
|
|
- ./infra/certs/edge-lb.key:/certs/edge-lb.key:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.50'
|
|
memory: 256M
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import ssl, urllib.request; ctx = ssl.create_default_context(cafile='/certs/ca.crt'); ctx.load_cert_chain('/certs/edge-lb.crt', '/certs/edge-lb.key'); urllib.request.urlopen('https://api-2:8443/health/ready', context=ctx, timeout=3)"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 3
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
s3-init:
|
|
condition: service_completed_successfully
|
|
openbao:
|
|
condition: service_healthy
|
|
|
|
worker:
|
|
build: .
|
|
user: "10001:10001"
|
|
cap_drop: ["ALL"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
command: ["python", "worker.py"]
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp:rw,noexec,nosuid,size=128m
|
|
environment:
|
|
- DATABASE_URL=postgresql://messenger_worker:messenger_worker_pass@postgres:5432/messenger
|
|
- REDIS_URL=rediss://messenger-client@redis:6379/0?ssl_cert_reqs=required&ssl_ca_certs=/certs/ca.crt&ssl_certfile=/certs/worker.crt&ssl_keyfile=/certs/worker.key
|
|
- S3_ENDPOINT=https://s3:8333
|
|
- S3_BUCKET=messenger-attachments
|
|
- AWS_CA_BUNDLE=/certs/ca.crt
|
|
- AWS_ACCESS_KEY_ID=${S3_WORKER_ACCESS_KEY_ID:-messenger_worker_s3}
|
|
- AWS_SECRET_ACCESS_KEY=${S3_WORKER_SECRET_ACCESS_KEY:-messenger_worker_secret}
|
|
- S3_KEY_PREFIX=worker/
|
|
- BAO_ADDR=https://openbao:8200
|
|
- BAO_CACERT=/certs/ca.crt
|
|
- BROKER_STREAM=attachment_jobs
|
|
- BROKER_GROUP=attachment_workers
|
|
- JOB_MAX_ATTEMPTS=5
|
|
- JOB_TIMEOUT_SECONDS=20
|
|
- WORKER_CONCURRENCY=2
|
|
- MAX_IMAGE_PIXELS=40000000
|
|
- OTEL_SERVICE_NAME=messenger-worker
|
|
- OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4318
|
|
- OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
|
- OTEL_EXPORTER_OTLP_CERTIFICATE=/certs/ca.crt
|
|
- OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE=/certs/worker.crt
|
|
- OTEL_EXPORTER_OTLP_CLIENT_KEY=/certs/worker.key
|
|
- OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
|
|
env_file:
|
|
- ./infra/certs/worker-approle.env
|
|
volumes:
|
|
- ./infra/certs/ca.crt:/certs/ca.crt:ro
|
|
- ./infra/certs/worker.crt:/certs/worker.crt:ro
|
|
- ./infra/certs/worker.key:/certs/worker.key:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "python -c \"import os, pathlib; assert any('worker.py' in pathlib.Path('/proc', p, 'cmdline').read_bytes().replace(b'\\x00', b' ').decode('utf-8', 'ignore') for p in os.listdir('/proc') if p.isdigit())\""]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 3
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.50'
|
|
memory: 256M
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
s3-init:
|
|
condition: service_completed_successfully
|
|
openbao:
|
|
condition: service_healthy
|
|
|
|
nginx:
|
|
image: nginx:1.25.4-alpine
|
|
ports:
|
|
- "8443:8443"
|
|
read_only: true
|
|
tmpfs:
|
|
- /var/cache/nginx:rw,noexec,nosuid,size=64m
|
|
- /var/run:rw,noexec,nosuid,size=16m
|
|
- /tmp:rw,noexec,nosuid,size=16m
|
|
cap_drop: ["ALL"]
|
|
cap_add: ["CHOWN", "SETGID", "SETUID", "NET_BIND_SERVICE"]
|
|
security_opt: ["no-new-privileges:true"]
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./infra/certs/edge-lb.crt:/etc/nginx/certs/edge-lb.crt:ro
|
|
- ./infra/certs/edge-lb.key:/etc/nginx/certs/edge-lb.key:ro
|
|
- ./infra/certs/ca.crt:/etc/nginx/certs/ca.crt:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.25'
|
|
memory: 128M
|
|
depends_on:
|
|
- api-1
|
|
- api-2
|
|
|
|
volumes:
|
|
pgdata:
|
|
redisdata:
|
|
s3data:
|
|
promdata:
|
|
lokidata:
|
|
tempodata:
|
|
grafanadata:
|
|
baodata: |