forked from mtusi2026/mtusi2026lab4
115 lines
2.6 KiB
YAML
115 lines
2.6 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: app
|
|
POSTGRES_PASSWORD: app
|
|
POSTGRES_DB: app
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U app -d app"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- lab3net
|
|
|
|
minio:
|
|
image: chrislusf/seaweedfs:latest
|
|
command: server -s3 -dir=/data -s3.port=9000 -master.port=9333 -volume.port=8081 -filer.port=8888
|
|
ports:
|
|
- "9000:9000"
|
|
- "9333:9333"
|
|
volumes:
|
|
- minio_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9333/cluster/status"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 10s
|
|
networks:
|
|
- lab3net
|
|
|
|
api1:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
APP_INSTANCE_ID: api1
|
|
APP_PORT: "8080"
|
|
DATABASE_URL: postgres://app:app@postgres:5432/app?sslmode=disable
|
|
S3_ENDPOINT: http://minio:9000
|
|
S3_ACCESS_KEY: minioadmin
|
|
S3_SECRET_KEY: minioadmin123
|
|
S3_BUCKET: attachments
|
|
expose:
|
|
- "8080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
minio:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 10s
|
|
stop_grace_period: 15s
|
|
networks:
|
|
- lab3net
|
|
|
|
api2:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
APP_INSTANCE_ID: api2
|
|
APP_PORT: "8080"
|
|
DATABASE_URL: postgres://app:app@postgres:5432/app?sslmode=disable
|
|
S3_ENDPOINT: http://minio:9000
|
|
S3_ACCESS_KEY: minioadmin
|
|
S3_SECRET_KEY: minioadmin123
|
|
S3_BUCKET: attachments
|
|
expose:
|
|
- "8080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
minio:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 10s
|
|
stop_grace_period: 15s
|
|
networks:
|
|
- lab3net
|
|
|
|
haproxy:
|
|
image: haproxy:2.9-alpine
|
|
ports:
|
|
- "8080:8080"
|
|
volumes:
|
|
- ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
depends_on:
|
|
api1:
|
|
condition: service_healthy
|
|
api2:
|
|
condition: service_healthy
|
|
networks:
|
|
- lab3net
|
|
|
|
networks:
|
|
lab3net:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
pgdata:
|
|
minio_data: |