Files
mtusi2026lab4/compose.yaml
T

60 lines
1.6 KiB
YAML

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: