Skip to content

Commit

Permalink
Merge pull request Freika#327 from tetebueno/patch-2
Browse files Browse the repository at this point in the history
Adding healthcheck for containers for Docker compose configuration
  • Loading branch information
Freika authored Oct 15, 2024
2 parents ece941c + cf005bf commit 5058049
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ services:
volumes:
- shared_data:/var/shared/redis
restart: always
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
dawarich_db:
image: postgres:14.2-alpine
container_name: dawarich_db
Expand All @@ -21,6 +27,12 @@ services:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
restart: always
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
dawarich_app:
image: freikin/dawarich:latest
container_name: dawarich_app
Expand Down Expand Up @@ -55,9 +67,19 @@ services:
options:
max-size: "100m"
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:
- dawarich_db
- dawarich_redis
dawarich_db:
condition: service_healthy
restart: true
dawarich_redis:
condition: service_healthy
restart: true
deploy:
resources:
limits:
Expand Down Expand Up @@ -94,10 +116,22 @@ services:
options:
max-size: "100m"
max-file: "5"
healthcheck:
test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep $(hostname)" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
depends_on:
- dawarich_db
- dawarich_redis
- dawarich_app
dawarich_db:
condition: service_healthy
restart: true
dawarich_redis:
condition: service_healthy
restart: true
dawarich_app:
condition: service_healthy
restart: true
deploy:
resources:
limits:
Expand Down

0 comments on commit 5058049

Please sign in to comment.