forked from mtusi2026/mtusi2026lab5
all for 4
This commit is contained in:
+160
-59
@@ -1,18 +1,22 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16.6-alpine
|
||||
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:?}
|
||||
POSTGRES_USER: ${POSTGRES_USER:?}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?}
|
||||
|
||||
command:
|
||||
- postgres
|
||||
- -c
|
||||
- max_connections=100
|
||||
- -c
|
||||
- shared_buffers=128MB
|
||||
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
@@ -27,8 +31,10 @@ services:
|
||||
|
||||
redis:
|
||||
image: redis:7.4.1-alpine
|
||||
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:?}
|
||||
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
@@ -39,8 +45,10 @@ services:
|
||||
--appendfsync always \
|
||||
--maxmemory 128mb \
|
||||
--maxmemory-policy noeviction
|
||||
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
@@ -48,97 +56,124 @@ services:
|
||||
interval: 2s
|
||||
timeout: 1s
|
||||
retries: 30
|
||||
|
||||
cpus: 0.5
|
||||
mem_limit: 192m
|
||||
networks: [data]
|
||||
|
||||
minio:
|
||||
build:
|
||||
context: ./infra/minio
|
||||
dockerfile: Dockerfile
|
||||
build:
|
||||
context: ./infra/minio
|
||||
dockerfile: Dockerfile
|
||||
|
||||
image: mtusi4-minio:2025-04-22-local
|
||||
pull_policy: build
|
||||
image: mtusi5-minio:2025-04-22-local
|
||||
|
||||
command:
|
||||
- server
|
||||
- /data
|
||||
- --console-address
|
||||
- ":9001"
|
||||
command:
|
||||
- server
|
||||
- /data
|
||||
- --console-address
|
||||
- ":9001"
|
||||
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?}
|
||||
MINIO_API_STALE_UPLOADS_EXPIRY: "24h"
|
||||
MINIO_API_STALE_UPLOADS_CLEANUP_INTERVAL: "1h"
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?}
|
||||
MINIO_API_STALE_UPLOADS_EXPIRY: "24h"
|
||||
MINIO_API_STALE_UPLOADS_CLEANUP_INTERVAL: "1h"
|
||||
|
||||
volumes:
|
||||
- minio_data:/data
|
||||
volumes:
|
||||
- minio_data:/data
|
||||
|
||||
ports:
|
||||
- "127.0.0.1:9001:9001"
|
||||
ports:
|
||||
- "127.0.0.1:9001:9001"
|
||||
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- curl
|
||||
- -f
|
||||
- http://localhost:9000/minio/health/live
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 10s
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- curl
|
||||
- -f
|
||||
- http://localhost:9000/minio/health/live
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 10s
|
||||
|
||||
cpus: 1.0
|
||||
mem_limit: 768m
|
||||
restart: unless-stopped
|
||||
networks: [data]
|
||||
cpus: 1.0
|
||||
mem_limit: 768m
|
||||
restart: unless-stopped
|
||||
networks: [data]
|
||||
|
||||
minio-init:
|
||||
build:
|
||||
context: ./infra/minio
|
||||
dockerfile: Dockerfile
|
||||
image: mtusi5-minio:2025-04-22-local
|
||||
pull_policy: never
|
||||
|
||||
image: mtusi4-minio:2025-04-22-local
|
||||
pull_policy: build
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?}
|
||||
S3_BUCKET: ${S3_BUCKET:?}
|
||||
S3_ACCESS_KEY: ${S3_ACCESS_KEY:?}
|
||||
S3_SECRET_KEY: ${S3_SECRET_KEY:?}
|
||||
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?}
|
||||
volumes:
|
||||
- ./infra/minio/bootstrap.sh:/bootstrap/bootstrap.sh:ro
|
||||
- ./infra/minio/check-access.sh:/bootstrap/check-access.sh:ro
|
||||
|
||||
S3_BUCKET: ${S3_BUCKET:?}
|
||||
S3_ACCESS_KEY: ${S3_ACCESS_KEY:?}
|
||||
S3_SECRET_KEY: ${S3_SECRET_KEY:?}
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /bootstrap/bootstrap.sh
|
||||
|
||||
volumes:
|
||||
- ./infra/minio/bootstrap.sh:/bootstrap/bootstrap.sh:ro
|
||||
- ./infra/minio/check-access.sh:/bootstrap/check-access.sh:ro
|
||||
restart: "no"
|
||||
networks: [data]
|
||||
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /bootstrap/bootstrap.sh
|
||||
rabbitmq:
|
||||
image: rabbitmq:4.1.4-alpine
|
||||
hostname: rabbitmq
|
||||
|
||||
restart: "no"
|
||||
networks: [data]
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:?}
|
||||
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:?}
|
||||
|
||||
volumes:
|
||||
- rabbitmq_data:/var/lib/rabbitmq
|
||||
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- rabbitmq-diagnostics
|
||||
- -q
|
||||
- ping
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
|
||||
cpus: 1.0
|
||||
mem_limit: 512m
|
||||
restart: unless-stopped
|
||||
networks: [data]
|
||||
|
||||
migrate:
|
||||
image: flyway/flyway:10.20.1-alpine
|
||||
|
||||
command:
|
||||
- -connectRetries=30
|
||||
- migrate
|
||||
|
||||
environment:
|
||||
FLYWAY_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:?}
|
||||
FLYWAY_USER: ${POSTGRES_USER:?}
|
||||
FLYWAY_PASSWORD: ${POSTGRES_PASSWORD:?}
|
||||
|
||||
volumes:
|
||||
- ./java/src/main/resources/db/migration:/flyway/sql:ro
|
||||
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
cpus: 0.5
|
||||
mem_limit: 384m
|
||||
restart: "no"
|
||||
@@ -146,26 +181,45 @@ services:
|
||||
|
||||
api:
|
||||
build: .
|
||||
image: ${APP_IMAGE:-mtusi4-api:local}
|
||||
environment:
|
||||
image: ${APP_IMAGE:-mtusi5-api:local}
|
||||
|
||||
environment: &app-environment
|
||||
DB_URL: jdbc:postgresql://postgres:5432/${POSTGRES_DB:?}
|
||||
DB_USERNAME: ${POSTGRES_USER:?}
|
||||
DB_PASSWORD: ${POSTGRES_PASSWORD:?}
|
||||
DB_POOL_SIZE: ${DB_POOL_SIZE:-8}
|
||||
|
||||
REDIS_HOST: redis
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:?}
|
||||
DB_POOL_SIZE: ${DB_POOL_SIZE:-8}
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
|
||||
FLYWAY_ENABLED: "false"
|
||||
|
||||
S3_ENDPOINT: http://minio:9000
|
||||
S3_ACCESS_KEY: ${S3_ACCESS_KEY:?}
|
||||
S3_SECRET_KEY: ${S3_SECRET_KEY:?}
|
||||
S3_BUCKET: ${S3_BUCKET:?}
|
||||
|
||||
RABBITMQ_HOST: rabbitmq
|
||||
RABBITMQ_USER: ${RABBITMQ_USER:?}
|
||||
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD:?}
|
||||
|
||||
WORKER_ENABLED: "false"
|
||||
|
||||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-3}
|
||||
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-120}
|
||||
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-604800}
|
||||
|
||||
UPLOAD_MAX_CONCURRENT: ${UPLOAD_MAX_CONCURRENT:-1}
|
||||
UPLOAD_TEMP_DIR: /tmp/messenger-uploads
|
||||
|
||||
ATTACHMENT_CLEANUP_ENABLED: "true"
|
||||
ATTACHMENT_CLEANUP_GRACE_SECONDS: ${ATTACHMENT_CLEANUP_GRACE_SECONDS:-3600}
|
||||
ATTACHMENT_CLEANUP_INTERVAL_MS: ${ATTACHMENT_CLEANUP_INTERVAL_MS:-300000}
|
||||
ATTACHMENT_CLEANUP_INITIAL_DELAY_MS: ${ATTACHMENT_CLEANUP_INITIAL_DELAY_MS:-60000}
|
||||
|
||||
|
||||
JAVA_TOOL_OPTIONS: "-Djava.awt.headless=true"
|
||||
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
@@ -173,10 +227,14 @@ services:
|
||||
condition: service_healthy
|
||||
minio-init:
|
||||
condition: service_completed_successfully
|
||||
|
||||
deploy:
|
||||
replicas: ${API_REPLICAS:-2}
|
||||
|
||||
cpus: ${API_CPUS:-1.0}
|
||||
mem_limit: ${API_MEMORY:-768m}
|
||||
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 20s
|
||||
|
||||
healthcheck:
|
||||
@@ -189,14 +247,56 @@ services:
|
||||
timeout: 15s
|
||||
start_period: 60s
|
||||
retries: 3
|
||||
|
||||
networks: [edge, data]
|
||||
|
||||
worker:
|
||||
image: ${APP_IMAGE:-mtusi5-api:local}
|
||||
pull_policy: never
|
||||
|
||||
environment:
|
||||
<<: *app-environment
|
||||
WORKER_ENABLED: "true"
|
||||
ATTACHMENT_CLEANUP_ENABLED: "false"
|
||||
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
redis:
|
||||
condition: service_healthy
|
||||
minio-init:
|
||||
condition: service_completed_successfully
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
|
||||
cpus: 1.0
|
||||
mem_limit: 768m
|
||||
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 20s
|
||||
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- wget
|
||||
- -qO-
|
||||
- http://localhost:8080/health/live
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
start_period: 60s
|
||||
retries: 10
|
||||
|
||||
networks: [data]
|
||||
|
||||
lb:
|
||||
image: haproxy:3.0.5-alpine
|
||||
|
||||
ports:
|
||||
- "127.0.0.1:${API_PORT:-8080}:8080"
|
||||
|
||||
volumes:
|
||||
- ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
@@ -209,6 +309,7 @@ volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
minio_data:
|
||||
rabbitmq_data:
|
||||
|
||||
networks:
|
||||
edge:
|
||||
|
||||
Reference in New Issue
Block a user