This commit is contained in:
2026-10-30 20:08:17 +03:00
parent 4c7a796795
commit 959eee7f9d
25 changed files with 562 additions and 46 deletions
+63
View File
@@ -16,6 +16,13 @@ x-api: &api
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}
networks: [backend]
cpus: 1.0
mem_limit: 512m
@@ -31,6 +38,8 @@ services:
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
@@ -48,6 +57,59 @@ services:
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
command: [python, -m, src.cleanup]
healthcheck:
disable: true
depends_on:
migrate:
condition: service_completed_successfully
s3-init:
condition: service_completed_successfully
restart: unless-stopped
cpus: 0.25
mem_limit: 128m
nginx:
image: nginx:1.28.0-alpine
entrypoint: [sh, /etc/nginx/readiness.sh]
@@ -110,3 +172,4 @@ networks:
volumes:
postgres_data:
redis_data:
s3_data: