fix health checks

parent 6a77e40e
version: "3.8" version: "3.8"
services: services:
postgres: postgres:
image: pgvector/pgvector:pg16 image: pgvector/pgvector:pg16
container_name: postgres
environment: environment:
POSTGRES_USER: ${POSTGRES_USER} POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
...@@ -12,14 +12,19 @@ services: ...@@ -12,14 +12,19 @@ services:
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
ports: ports:
- "5432:5432" - "5432:5432"
networks:
- app-network
restart: unless-stopped
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 10
start_period: 30s
minio: minio:
image: minio/minio:latest image: minio/minio:latest
container_name: minio
command: server /data --console-address ":9001" command: server /data --console-address ":9001"
environment: environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_USER: ${MINIO_ROOT_USER}
...@@ -29,14 +34,19 @@ services: ...@@ -29,14 +34,19 @@ services:
ports: ports:
- "9000:9000" - "9000:9000"
- "9001:9001" - "9001:9001"
networks:
- app-network
restart: unless-stopped
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 5
start_period: 60s
data-handler: data-handler:
image: salmamohammedhamedmustafa/data-handler:latest image: salmamohammedhamedmustafa/data-handler:latest
container_name: data-handler
environment: environment:
MINIO_ENDPOINT: "http://minio:9000" MINIO_ENDPOINT: "http://minio:9000"
MINIO_ACCESS_KEY: "${MINIO_ROOT_USER}" MINIO_ACCESS_KEY: "${MINIO_ROOT_USER}"
...@@ -44,20 +54,29 @@ services: ...@@ -44,20 +54,29 @@ services:
OPENAI_API_KEY: "${OPENAI_API_KEY}" OPENAI_API_KEY: "${OPENAI_API_KEY}"
MINIO_BUCKET: "${MINIO_BUCKET}" MINIO_BUCKET: "${MINIO_BUCKET}"
POSTGRES_HOST: "postgres" POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
POSTGRES_USER: "${POSTGRES_USER}" POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: "${POSTGRES_DB}" POSTGRES_DB: "${POSTGRES_DB}"
networks:
- app-network
restart: "no"
depends_on: depends_on:
- minio postgres:
- postgres condition: service_healthy
healthcheck: minio:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] condition: service_healthy
interval: 10s # Remove healthcheck for batch job
retries: 3 deploy:
timeout: 5s resources:
limits:
memory: 1G
reservations:
memory: 512M
voice-agent: voice-agent:
image: salmamohammedhamedmustafa/voice-agent:latest image: salmamohammedhamedmustafa/voice-agent:latest
container_name: voice-agent
ports: ports:
- "8010:8000" - "8010:8000"
environment: environment:
...@@ -67,13 +86,43 @@ services: ...@@ -67,13 +86,43 @@ services:
OPENAI_API_KEY: "${OPENAI_API_KEY}" OPENAI_API_KEY: "${OPENAI_API_KEY}"
MINIO_BUCKET: "${MINIO_BUCKET}" MINIO_BUCKET: "${MINIO_BUCKET}"
POSTGRES_HOST: "postgres" POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
POSTGRES_USER: "${POSTGRES_USER}" POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: "${POSTGRES_DB}" POSTGRES_DB: "${POSTGRES_DB}"
DATA_HANDLER_URL: "http://data-handler:8000"
networks:
- app-network
restart: unless-stopped
depends_on: depends_on:
- minio postgres:
- data-handler condition: service_healthy
minio:
condition: service_healthy
data-handler:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "python -c 'import requests; requests.get(\"http://localhost:8000/health\")' || exit 1"]
interval: 30s
timeout: 15s
retries: 5
start_period: 60s
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
volumes: volumes:
pgdata: pgdata:
driver: local
miniodata: miniodata:
driver: local
networks:
app-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment