From 2df90985860a0d80b9c1664cea1295e578c3f1e1 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 31 May 2025 19:44:14 -0300 Subject: [PATCH] feat: add service_healthy + healthcheck to docker-compose (#811) * Update docker-compose.yml Since you use healthcheck anyway, you get to verify that postgres is healthy * Update README.md Update the README with 'depends_on: postgresql: condition: service_healthy' * Add zipline healthcheck to docker-compose.yml * Add docker-compose healthcheck for zipline to README.md * Update docker-compose.yml --------- Co-authored-by: dicedtomato <35403473+diced@users.noreply.github.com> --- README.md | 8 +++++++- docker-compose.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7b6d1cc..d049bb38 100755 --- a/README.md +++ b/README.md @@ -77,11 +77,17 @@ services: environment: - DATABASE_URL=postgres://${POSTGRESQL_USER:-zipline}:${POSTGRESQL_PASSWORD}@postgresql:5432/${POSTGRESQL_DB:-zipline} depends_on: - - postgresql + postgresql: + condition: service_healthy volumes: - './uploads:/zipline/uploads' - './public:/zipline/public' - './themes:/zipline/themes' + healthcheck: + test: ['CMD', 'wget', '-q', '--spider', 'http://localhost:3000/api/healthcheck'] + interval: 15s + timeout: 2s + retries: 2 volumes: pgdata: diff --git a/docker-compose.yml b/docker-compose.yml index 9bfa1233..680c8c05 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,11 +26,17 @@ services: environment: - DATABASE_URL=postgres://${POSTGRESQL_USER:-zipline}:${POSTGRESQL_PASSWORD}@postgresql:5432/${POSTGRESQL_DB:-zipline} depends_on: - - postgresql + postgresql: + condition: service_healthy volumes: - './uploads:/zipline/uploads' - './public:/zipline/public' - './themes:/zipline/themes' + healthcheck: + test: ['CMD', 'wget', '-q', '--spider', 'http://0.0.0.0:3000/api/healthcheck'] + interval: 15s + timeout: 2s + retries: 2 volumes: pgdata: