fix health checks

parent 6a77e40e
version: "3.8"
services:
postgres:
image: pgvector/pgvector:pg16
container_name: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
......@@ -12,14 +12,19 @@ services:
- pgdata:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- app-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
retries: 10
start_period: 30s
minio:
image: minio/minio:latest
container_name: minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
......@@ -29,14 +34,19 @@ services:
ports:
- "9000:9000"
- "9001:9001"
networks:
- app-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
retries: 5
start_period: 60s
data-handler:
image: salmamohammedhamedmustafa/data-handler:latest
container_name: data-handler
environment:
MINIO_ENDPOINT: "http://minio:9000"
MINIO_ACCESS_KEY: "${MINIO_ROOT_USER}"
......@@ -44,20 +54,29 @@ services:
OPENAI_API_KEY: "${OPENAI_API_KEY}"
MINIO_BUCKET: "${MINIO_BUCKET}"
POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: "${POSTGRES_DB}"
networks:
- app-network
restart: "no"
depends_on:
- minio
- postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
retries: 3
timeout: 5s
postgres:
condition: service_healthy
minio:
condition: service_healthy
# Remove healthcheck for batch job
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 512M
voice-agent:
image: salmamohammedhamedmustafa/voice-agent:latest
container_name: voice-agent
ports:
- "8010:8000"
environment:
......@@ -67,13 +86,43 @@ services:
OPENAI_API_KEY: "${OPENAI_API_KEY}"
MINIO_BUCKET: "${MINIO_BUCKET}"
POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: "${POSTGRES_DB}"
DATA_HANDLER_URL: "http://data-handler:8000"
networks:
- app-network
restart: unless-stopped
depends_on:
- minio
- data-handler
postgres:
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:
pgdata:
driver: local
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