From b923cf7752f064923aff5f000eebc62b8921b12a Mon Sep 17 00:00:00 2001 From: Ilija Leko <52656086+ilijaleko@users.noreply.github.com> Date: Mon, 8 May 2023 20:13:45 +0200 Subject: [PATCH] Fix docker compose services startup (#1947) * Fix docker compose services startup * Update changelog --- CHANGELOG.md | 6 ++++++ docker/docker-compose.build.yml | 15 +++++++++++++++ docker/docker-compose.yml | 15 +++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 058abc966..a9e05dfcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for the _Stripe_ checkout to the pricing page +### Added + +- Added `depends_on` and `healthcheck` for the _Postgres_ and _Redis_ services to the `docker-compose` files (`docker-compose.yml` and `docker-compose.build.yml`) + +## Unreleased + ### Changed - Improved the management of platforms in the admin control panel diff --git a/docker/docker-compose.build.yml b/docker/docker-compose.build.yml index 1b552b9a3..be7d6248b 100644 --- a/docker/docker-compose.build.yml +++ b/docker/docker-compose.build.yml @@ -11,16 +11,31 @@ services: REDIS_PASSWORD: ${REDIS_PASSWORD} ports: - 3333:3333 + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy postgres: image: postgres:12 env_file: - ../.env + healthcheck: + test: ['CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}'] + interval: 10s + timeout: 5s + retries: 5 volumes: - postgres:/var/lib/postgresql/data redis: image: 'redis:alpine' + healthcheck: + test: ['CMD-SHELL', 'redis-cli ping | grep PONG'] + interval: 10s + timeout: 5s + retries: 5 volumes: postgres: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 66b08748e..410751876 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,16 +11,31 @@ services: REDIS_PASSWORD: ${REDIS_PASSWORD} ports: - 3333:3333 + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy postgres: image: postgres:12 env_file: - ../.env + healthcheck: + test: ['CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}'] + interval: 10s + timeout: 5s + retries: 5 volumes: - postgres:/var/lib/postgresql/data redis: image: 'redis:alpine' + healthcheck: + test: ['CMD-SHELL', 'redis-cli ping | grep PONG'] + interval: 10s + timeout: 5s + retries: 5 volumes: postgres: