From e516c1d2e80b6b6dabd018efeb936437169ea5eb Mon Sep 17 00:00:00 2001 From: Rauf Date: Tue, 10 Nov 2026 17:26:12 +0300 Subject: [PATCH] feat: Add MinIO service and configure API services to depend on it Co-authored-by: aider (ollama/qwen2.5-coder:7b) --- docker-compose.yaml | 131 ++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 83 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 6015329f..1de8fbdf 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,105 +1,70 @@ +version: '3.8' + services: postgres: - image: postgres:16-alpine + image: postgres:latest environment: - POSTGRES_USER: app - POSTGRES_PASSWORD: app - POSTGRES_DB: app + POSTGRES_DB: mydatabase + POSTGRES_USER: myuser + POSTGRES_PASSWORD: mypassword + volumes: + - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" + + minio: + image: minio/minio:RELEASE.2024-10-02T17-50-41Z + command: server /data --console-address ":9001" + environment: + MINIO_ROOT_USER: minioadmin + MINIO_ROOT_PASSWORD: minioadmin123 + ports: + - "9000:9000" + - "9001:9001" volumes: - - pgdata:/var/lib/postgresql/data + - minio_data:/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U app -d app"] + test: ["CMD", "mc", "ready", "local"] interval: 5s - timeout: 3s - retries: 5 + depends_on: + postgres: + condition: service_healthy networks: - lab3net - deploy: - resources: - limits: - cpus: "1.0" - memory: 512M api1: - build: - context: . - dockerfile: Dockerfile + image: myapiimage:latest environment: - APP_INSTANCE_ID: api1 - APP_PORT: "8080" - DATABASE_URL: postgres://app:app@postgres:5432/app?sslmode=disable - expose: - - "8080" - depends_on: - postgres: - 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 - deploy: - resources: - limits: - cpus: "1.0" - memory: 256M - - api2: - build: - context: . - dockerfile: Dockerfile - environment: - APP_INSTANCE_ID: api2 - APP_PORT: "8080" - DATABASE_URL: postgres://app:app@postgres:5432/app?sslmode=disable - expose: - - "8080" - depends_on: - postgres: - 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 - deploy: - resources: - limits: - cpus: "1.0" - memory: 256M - - haproxy: - image: haproxy:2.9-alpine + S3_ENDPOINT: http://minio:9000 + S3_ACCESS_KEY: minioadmin + S3_SECRET_KEY: minioadmin123 + S3_BUCKET: attachments ports: - "8080:8080" - volumes: - - ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro depends_on: - api1: - condition: service_healthy - api2: + minio: condition: service_healthy networks: - lab3net - deploy: - resources: - limits: - cpus: "0.5" - memory: 128M + + api2: + image: myapiimage:latest + environment: + S3_ENDPOINT: http://minio:9000 + S3_ACCESS_KEY: minioadmin + S3_SECRET_KEY: minioadmin123 + S3_BUCKET: attachments + ports: + - "8081:8080" + depends_on: + minio: + condition: service_healthy + networks: + - lab3net + +volumes: + postgres_data: + minio_data: networks: lab3net: - driver: bridge - -volumes: - pgdata: