Skip to content

Commit 542c698

Browse files
committed
fix: add depends_on and healthcheck for service stability in docker-compose
1 parent c1cf5d6 commit 542c698

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

spec/docker-compose.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
version: "3"
21
services:
32
ubuntu_node:
43
build: .
54
container_name: ubuntu_node
65
ports:
76
- "20022:22"
7+
depends_on:
8+
openvoxserver:
9+
condition: service_healthy
10+
restart: always
811

912
puppet_8_node:
1013
build:
@@ -14,6 +17,10 @@ services:
1417
container_name: puppet_8_node
1518
ports:
1619
- "20024:22"
20+
depends_on:
21+
openvoxserver:
22+
condition: service_healthy
23+
restart: always
1724

1825
puppet_7_node:
1926
build:
@@ -23,6 +30,10 @@ services:
2330
container_name: puppet_7_node
2431
ports:
2532
- "20025:22"
33+
depends_on:
34+
openvoxserver:
35+
condition: service_healthy
36+
restart: always
2637

2738
postgres:
2839
image: docker.io/postgres:17-alpine
@@ -34,13 +45,22 @@ services:
3445
volumes:
3546
- ./fixtures/puppetdb/custom_source:/docker-entrypoint-initdb.d
3647
restart: always
48+
healthcheck:
49+
test: ["CMD-SHELL", "sh -c 'pg_isready -U openvoxdb -d openvoxdb'"]
50+
interval: 10s
51+
timeout: 3s
52+
retries: 3
3753

3854
openvoxdb:
3955
image: ghcr.io/openvoxproject/openvoxdb:latest
4056
hostname: pdb
4157
environment:
4258
CERTNAME: pdb
4359
restart: always
60+
depends_on:
61+
openvoxserver:
62+
condition: service_healthy
63+
restart: always
4464
ports:
4565
- "18081:8081"
4666

0 commit comments

Comments
 (0)