Skip to content

Commit

Permalink
Add healthchecks to docker compose services
Browse files Browse the repository at this point in the history
  • Loading branch information
richardboehme committed Aug 28, 2024
1 parent 9e917b2 commit 47ff85d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 47ff85d

Please sign in to comment.