This commit is contained in:
2026-11-06 18:45:08 +03:00
parent 545d083049
commit 482e7ff477
17 changed files with 958 additions and 42 deletions
+53 -1
View File
@@ -1,6 +1,5 @@
x-api: &api
image: mtusi2026lab5-api:local
build: .
dns_opt:
- timeout:1
- attempts:1
@@ -23,14 +22,66 @@ x-api: &api
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}
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}
networks: [backend]
cpus: 1.0
mem_limit: 512m
stop_grace_period: 10s
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
command: [python, -m, src.jobs, dispatch]
healthcheck:
disable: true
depends_on:
migrate:
condition: service_completed_successfully
broker:
condition: service_healthy
restart: unless-stopped
mem_limit: 128m
worker:
<<: *api
command: [python, -m, src.worker]
init: true
healthcheck:
disable: true
depends_on:
migrate:
condition: service_completed_successfully
broker:
condition: service_healthy
s3-init:
condition: service_completed_successfully
restart: unless-stopped
cpus: 2.0
mem_limit: 2g
pids_limit: 64
api:
<<: *api
build: .
deploy:
replicas: 2
depends_on:
@@ -170,6 +221,7 @@ networks:
backend:
internal: true
volumes:
broker_data:
postgres_data:
redis_data:
s3_data: