From 47ff85d93cc96854266290c463add7f39b82910f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20B=C3=B6hme?= Date: Wed, 28 Aug 2024 09:55:55 +0200 Subject: [PATCH] Add healthchecks to docker compose services --- .github/workflows/ruby.yml | 2 +- docker-compose.yml.example | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 24c752a..a657178 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -21,7 +21,7 @@ jobs: - run: mv test/database.yml.example test/database.yml - run: mv docker-compose.yml.example docker-compose.yml if: ${{ matrix.db_adapter == 'mysql' || matrix.db_adapter == 'postgresql' }} - - run: docker compose up -d ${{ matrix.db_adapter }} + - run: docker compose up -d --wait ${{ matrix.db_adapter }} if: ${{ matrix.db_adapter == 'mysql' || matrix.db_adapter == 'postgresql' }} - uses: ruby/setup-ruby@v1 with: diff --git a/docker-compose.yml.example b/docker-compose.yml.example index cb5470b..f30d0de 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -9,6 +9,12 @@ services: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready", "-d", "lexorank"] + start_period: 10s + interval: 10s + timeout: 5s + retries: 3 mysql: image: mariadb @@ -20,6 +26,12 @@ services: - "3306:3306" volumes: - mysql_data:/var/lib/mysql + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + start_period: 10s + interval: 10s + timeout: 5s + retries: 3 volumes: postgres_data: