Implement lab4 S3 attachments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-11-13 19:06:03 +03:00
co-authored by Copilot
parent ec540a1a72
commit 21d9976597
19 changed files with 1405 additions and 18 deletions
+59
View File
@@ -0,0 +1,59 @@
services:
postgres:
image: postgres:16.6-alpine
environment:
POSTGRES_DB: messenger
POSTGRES_USER: messenger
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-messenger_local_only}
volumes: [postgres_data:/var/lib/postgresql/data]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"]
interval: 3s
timeout: 3s
retries: 20
minio:
image: quay.io/minio/minio:RELEASE.2024-12-18T13-15-44Z
command: server /data
environment:
MINIO_ROOT_USER: messenger
MINIO_ROOT_PASSWORD: messenger-secret
volumes: [s3_data:/data]
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 3s
timeout: 3s
retries: 20
api1:
build: .
environment: &api-env
APP_HOST: 0.0.0.0
APP_PORT: 8080
INSTANCE_ID: api1
DATABASE_URL: jdbc:postgresql://postgres:5432/messenger
DATABASE_USER: messenger
DATABASE_PASSWORD: ${POSTGRES_PASSWORD:-messenger_local_only}
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY: messenger
S3_SECRET_KEY: messenger-secret
S3_BUCKET: attachments
expose: ["8080"]
depends_on:
postgres: {condition: service_healthy}
minio: {condition: service_healthy}
api2:
build: .
environment:
<<: *api-env
INSTANCE_ID: api2
expose: ["8080"]
depends_on:
postgres: {condition: service_healthy}
minio: {condition: service_healthy}
lb:
image: nginx:1.27.3-alpine
ports: ["127.0.0.1:${HOST_PORT:-8080}:8080"]
volumes: ["./nginx.conf:/etc/nginx/nginx.conf:ro"]
depends_on: [api1, api2]
volumes:
postgres_data:
s3_data: