feat: add healthchecks to all docker compose services
Run Tests on Branches / Detect Changes (push) Successful in 13s
Run Tests on Branches / Backend Tests (push) Has been skipped
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped

This commit is contained in:
Antoni Nuñez Romeu
2026-07-27 15:23:16 +02:00
parent ddd8ae8537
commit 258839dfc8
+33
View File
@@ -2,6 +2,11 @@ services:
redis: redis:
image: redis:alpine image: redis:alpine
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks: networks:
- internal - internal
@@ -28,6 +33,12 @@ services:
context: . context: .
dockerfile: apps/backend/Dockerfile dockerfile: apps/backend/Dockerfile
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/healthz', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) })"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
env_file: env_file:
- ./apps/backend/.env - ./apps/backend/.env
environment: environment:
@@ -68,6 +79,12 @@ services:
VITE_FARO_ENV: ${VITE_FARO_ENV:-production} VITE_FARO_ENV: ${VITE_FARO_ENV:-production}
VITE_FARO_APP_VERSION: ${VITE_FARO_APP_VERSION:-1.0.0} VITE_FARO_APP_VERSION: ${VITE_FARO_APP_VERSION:-1.0.0}
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:80/"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
ports: ports:
- "4000:80" - "4000:80"
depends_on: depends_on:
@@ -80,6 +97,11 @@ services:
redis-exporter: redis-exporter:
image: oliver006/redis_exporter:latest image: oliver006/redis_exporter:latest
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:9121/metrics"]
interval: 15s
timeout: 5s
retries: 3
environment: environment:
REDIS_ADDR: redis://redis:6379 REDIS_ADDR: redis://redis:6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-} REDIS_PASSWORD: ${REDIS_PASSWORD:-}
@@ -91,6 +113,11 @@ services:
postgres-exporter: postgres-exporter:
image: prometheuscommunity/postgres-exporter:latest image: prometheuscommunity/postgres-exporter:latest
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:9187/metrics"]
interval: 15s
timeout: 5s
retries: 3
environment: environment:
DATA_SOURCE_NAME: postgresql://farmafinder:${PG_PASSWORD:?PG_PASSWORD must be set}@postgres:5432/farmafinder?sslmode=disable DATA_SOURCE_NAME: postgresql://farmafinder:${PG_PASSWORD:?PG_PASSWORD must be set}@postgres:5432/farmafinder?sslmode=disable
depends_on: depends_on:
@@ -129,6 +156,12 @@ services:
mongodb: mongodb:
image: mongo:7 image: mongo:7
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
volumes: volumes:
- mongodb_data:/data/db - mongodb_data:/data/db
networks: networks: