Skip to content

Commit 47ff85d

Browse files
committed
Add healthchecks to docker compose services
1 parent 9e917b2 commit 47ff85d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/ruby.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- run: mv test/database.yml.example test/database.yml
2222
- run: mv docker-compose.yml.example docker-compose.yml
2323
if: ${{ matrix.db_adapter == 'mysql' || matrix.db_adapter == 'postgresql' }}
24-
- run: docker compose up -d ${{ matrix.db_adapter }}
24+
- run: docker compose up -d --wait ${{ matrix.db_adapter }}
2525
if: ${{ matrix.db_adapter == 'mysql' || matrix.db_adapter == 'postgresql' }}
2626
- uses: ruby/setup-ruby@v1
2727
with:

docker-compose.yml.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ services:
99
- "5432:5432"
1010
volumes:
1111
- postgres_data:/var/lib/postgresql/data
12+
healthcheck:
13+
test: ["CMD-SHELL", "pg_isready", "-d", "lexorank"]
14+
start_period: 10s
15+
interval: 10s
16+
timeout: 5s
17+
retries: 3
1218

1319
mysql:
1420
image: mariadb
@@ -20,6 +26,12 @@ services:
2026
- "3306:3306"
2127
volumes:
2228
- mysql_data:/var/lib/mysql
29+
healthcheck:
30+
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
31+
start_period: 10s
32+
interval: 10s
33+
timeout: 5s
34+
retries: 3
2335

2436
volumes:
2537
postgres_data:

0 commit comments

Comments
 (0)