This commit is contained in:
2026-11-22 17:59:11 +03:00
parent 7e1780be67
commit 813fc03da5
18 changed files with 1859 additions and 265 deletions
+11 -4
View File
@@ -1,6 +1,8 @@
# Client -> lb (HAProxy) -> api x API_REPLICAS -> postgres + minio + rabbitmq.
# HTTP upload still receives the whole body. POST returns 202 only after the original is in
# staging and RabbitMQ confirms the job. The worker copies the original and writes the thumbnail.
# HTTP upload still receives the whole body. POST returns 202 after staging and the job row
# commit. The outbox relay confirms the job to RabbitMQ; a crash between those two is the
# same row, republished later. The worker writes the original, a 256 JPEG thumbnail, a
# 128 JPEG crop and a WebP fit inside 1280. Worker memory limit below is the decode cap.
# Only the LB publishes a port. Networks: edge = lb<->api, data = api/worker/stores (no LB, no internet).
# Passwords come from .env (not committed) as Compose secret files, never as container env vars.
name: messenger-lab5
@@ -33,7 +35,7 @@ services:
networks:
- data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
test: ["CMD-SHELL", 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"']
interval: 2s
timeout: 5s
retries: 30
@@ -260,9 +262,14 @@ services:
BROKER_URL_FILE: /run/secrets/broker_url
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-60}
JOB_RETRY_BASE_SECONDS: ${JOB_RETRY_BASE_SECONDS:-0.5}
JOB_RETRY_CAP_SECONDS: ${JOB_RETRY_CAP_SECONDS:-30}
JOB_LEASE_SECONDS: ${JOB_LEASE_SECONDS:-90}
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-86400}
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-1}
DB_POOL_MIN: "1"
DB_POOL_MAX: "4"
# Two in-flight jobs hold a connection each, plus a lease heartbeat and the outbox relay.
DB_POOL_MAX: "8"
secrets:
- source: postgres_password
uid: "10001"