Completed for a grade of three
This commit is contained in:
+55
-2
@@ -55,10 +55,49 @@ services:
|
||||
memory: 128m
|
||||
restart: unless-stopped
|
||||
|
||||
s3:
|
||||
# MinIO RELEASE.2025-09-07T16-13-09Z, pinned multi-platform image.
|
||||
image: quay.io/minio/minio@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e
|
||||
command: ["server", "/data", "--console-address", ":9001"]
|
||||
environment:
|
||||
MINIO_ROOT_USER_FILE: /run/secrets/s3_access_key_id
|
||||
MINIO_ROOT_PASSWORD_FILE: /run/secrets/s3_secret_access_key
|
||||
secrets:
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
volumes:
|
||||
- s3-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "1.0"
|
||||
memory: 512m
|
||||
restart: unless-stopped
|
||||
|
||||
s3-init:
|
||||
# mc RELEASE.2025-08-13T08-35-41Z
|
||||
image: quay.io/minio/mc@sha256:a7fe349ef4bd8521fb8497f55c6042871b2ae640607cf99d9bede5e9bdf11727
|
||||
depends_on:
|
||||
s3:
|
||||
condition: service_healthy
|
||||
entrypoint: ["/bin/sh", "/bootstrap.sh"]
|
||||
environment:
|
||||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||||
secrets:
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
volumes:
|
||||
- ./infra/s3/bootstrap.sh:/bootstrap.sh:ro
|
||||
restart: "no"
|
||||
|
||||
# One-shot: applies Flyway migrations once and exits. Replicas start only after it succeeded,
|
||||
# so they never race each other on the schema.
|
||||
migrate:
|
||||
build: .
|
||||
image: mtusi-messenger:lab4
|
||||
command: ["migrate"]
|
||||
healthcheck:
|
||||
@@ -98,6 +137,8 @@ services:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
s3-init:
|
||||
condition: service_completed_successfully
|
||||
environment:
|
||||
APP_HOST: "0.0.0.0"
|
||||
APP_PORT: "8080"
|
||||
@@ -114,9 +155,15 @@ services:
|
||||
SESSION_CACHE_SINGLE_FLIGHT: ${SESSION_CACHE_SINGLE_FLIGHT:-true}
|
||||
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
|
||||
SHUTDOWN_DRAIN_DELAY_MS: "3000"
|
||||
S3_ENDPOINT: http://s3:9000
|
||||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
|
||||
secrets:
|
||||
- db_password
|
||||
- redis_password
|
||||
- s3_access_key_id
|
||||
- s3_secret_access_key
|
||||
# SIGTERM: readiness 503 and 3 s drain (HAProxy needs <= 2 s to notice), then Ktor closes the socket and
|
||||
# finishes requests in flight within 5 s. 3 + 5 = 8 s < 10 s before Docker sends SIGKILL.
|
||||
stop_grace_period: 10s
|
||||
@@ -130,7 +177,7 @@ services:
|
||||
api:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
- "127.0.0.1:${LAB_HTTP_PORT:-8080}:8080"
|
||||
# Port 8404 (health and stats) stays inside the compose network.
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8404/healthz"]
|
||||
@@ -150,5 +197,11 @@ secrets:
|
||||
redis_password:
|
||||
file: ./secrets/redis_password
|
||||
|
||||
s3_access_key_id:
|
||||
file: ./secrets/s3_access_key_id
|
||||
s3_secret_access_key:
|
||||
file: ./secrets/s3_secret_access_key
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
s3-data:
|
||||
|
||||
Reference in New Issue
Block a user