Skip to content

Commit

Permalink
Added healthchecks to docker-compose and ensure correct order of exec…
Browse files Browse the repository at this point in the history
…ution.
  • Loading branch information
srtab committed Jan 31, 2025
1 parent f411b12 commit 325a749
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed

- Added healthchecks to the docker-compose.yml file to ensure the services are running correctly and at the correct order.

## [0.1.0-alpha.22] - 2025-01-30

### Added
Expand Down
31 changes: 25 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ x-app-defaults: &x_app_default
- ./data/models:/home/app/.cache/huggingface/hub/
- .:/home/app/src
depends_on:
- db
- redis
- gitlab
- sandbox
db:
condition: service_healthy
restart: true
redis:
condition: service_healthy
restart: true
gitlab:
condition: service_healthy
sandbox:
condition: service_healthy

services:
db:
Expand All @@ -31,6 +37,12 @@ services:
POSTGRES_DB: db
volumes:
- ./data/db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dbuser -d db"]
interval: 10s
timeout: 10s
start_period: 30s
retries: 5
ports:
- "5432:5432"

Expand All @@ -50,13 +62,19 @@ services:
ports:
- "8080:80"
depends_on:
- db
db:
condition: service_healthy

redis:
image: redis:latest
command: redis-server --save "" --appendonly no
restart: unless-stopped
container_name: daiv-redis
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
ports:
- "6379:6379"

Expand Down Expand Up @@ -101,7 +119,8 @@ services:
- ./docker/local/gitlab-runner/config.toml:/etc/gitlab-runner/config.toml
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- gitlab
gitlab:
condition: service_healthy

sandbox:
build:
Expand Down

0 comments on commit 325a749

Please sign in to comment.