Adding healthcheck

https://github.com/Freika/dawarich/issues/321
This commit is contained in:
tetebueno 2024-10-14 15:42:18 -03:00 committed by GitHub
parent 378758f035
commit 44cfcecfd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,12 @@ services:
volumes: volumes:
- shared_data:/var/shared/redis - shared_data:/var/shared/redis
restart: always restart: always
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
dawarich_db: dawarich_db:
image: postgres:14.2-alpine image: postgres:14.2-alpine
container_name: dawarich_db container_name: dawarich_db
@ -21,6 +27,12 @@ services:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
restart: always restart: always
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
dawarich_app: dawarich_app:
image: freikin/dawarich:latest image: freikin/dawarich:latest
container_name: dawarich_app container_name: dawarich_app
@ -55,9 +67,19 @@ services:
options: options:
max-size: "100m" max-size: "100m"
max-file: "5" max-file: "5"
healthcheck:
test: [ "CMD-SHELL", "wget -qO - http://127.0.0.1:3000/api/v1/health | grep -q '\"status\"\\s*:\\s*\"ok\"'" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
depends_on: depends_on:
- dawarich_db db:
- dawarich_redis condition: service_healthy
restart: true
redis:
condition: service_healthy
restart: true
deploy: deploy:
resources: resources:
limits: limits:
@ -94,10 +116,22 @@ services:
options: options:
max-size: "100m" max-size: "100m"
max-file: "5" max-file: "5"
healthcheck:
test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep $(hostname)" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
depends_on: depends_on:
- dawarich_db db:
- dawarich_redis condition: service_healthy
- dawarich_app restart: true
redis:
condition: service_healthy
restart: true
app:
condition: service_healthy
restart: true
deploy: deploy:
resources: resources:
limits: limits: