Skip to content

Commit 2f02b0d

Browse files
committed
Add healthcheck to CI containers
To prevent geth containers from getting stuck
1 parent f574249 commit 2f02b0d

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

e2e/chains/bsc/docker-compose.simple.yml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ services:
7171
- ./scripts:/scripts
7272
- ./config:/config
7373
command: ash /scripts/bsc-rpc.sh
74+
healthcheck:
75+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
76+
interval: "5s"
77+
start_period: "10s"
7478

7579
bsc-rpc2: # This is the bootstrap node
7680
image: bsc-geth:docker-local
@@ -86,6 +90,10 @@ services:
8690
- ./scripts:/scripts
8791
- ./config:/config
8892
command: ash /scripts/bsc-rpc.sh
93+
healthcheck:
94+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
95+
interval: "5s"
96+
start_period: "10s"
8997

9098
bsc-validator1-1:
9199
image: bsc-geth:docker-local
@@ -99,6 +107,10 @@ services:
99107
- bsc-validator1-1:/root/.ethereum
100108
- ./scripts:/scripts
101109
command: ash /scripts/bsc-validator.sh
110+
healthcheck:
111+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
112+
interval: "5s"
113+
start_period: "10s"
102114

103115
bsc-validator1-2:
104116
image: bsc-geth:docker-local
@@ -112,6 +124,10 @@ services:
112124
- bsc-validator1-2:/root/.ethereum
113125
- ./scripts:/scripts
114126
command: ash /scripts/bsc-validator.sh
127+
healthcheck:
128+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
129+
interval: "5s"
130+
start_period: "10s"
115131

116132
bsc-validator1-3:
117133
image: bsc-geth:docker-local
@@ -125,6 +141,10 @@ services:
125141
- bsc-validator1-3:/root/.ethereum
126142
- ./scripts:/scripts
127143
command: ash /scripts/bsc-validator.sh
144+
healthcheck:
145+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
146+
interval: "5s"
147+
start_period: "10s"
128148

129149
bsc-validator1-4:
130150
image: bsc-geth:docker-local
@@ -138,6 +158,10 @@ services:
138158
- bsc-validator1-4:/root/.ethereum
139159
- ./scripts:/scripts
140160
command: ash /scripts/bsc-validator.sh
161+
healthcheck:
162+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
163+
interval: "5s"
164+
start_period: "10s"
141165

142166
bsc-validator1-5:
143167
image: bsc-geth:docker-local
@@ -151,6 +175,10 @@ services:
151175
- bsc-validator1-5:/root/.ethereum
152176
- ./scripts:/scripts
153177
command: ash /scripts/bsc-validator.sh
178+
healthcheck:
179+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
180+
interval: "5s"
181+
start_period: "10s"
154182

155183
bsc-validator2-1:
156184
image: bsc-geth:docker-local
@@ -164,6 +192,10 @@ services:
164192
- bsc-validator2-1:/root/.ethereum
165193
- ./scripts:/scripts
166194
command: ash /scripts/bsc-validator.sh
195+
healthcheck:
196+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
197+
interval: "5s"
198+
start_period: "10s"
167199

168200
bsc-validator2-2:
169201
image: bsc-geth:docker-local
@@ -177,6 +209,10 @@ services:
177209
- bsc-validator2-2:/root/.ethereum
178210
- ./scripts:/scripts
179211
command: ash /scripts/bsc-validator.sh
212+
healthcheck:
213+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
214+
interval: "5s"
215+
start_period: "10s"
180216

181217
bsc-validator2-3:
182218
image: bsc-geth:docker-local
@@ -190,6 +226,10 @@ services:
190226
- bsc-validator2-3:/root/.ethereum
191227
- ./scripts:/scripts
192228
command: ash /scripts/bsc-validator.sh
229+
healthcheck:
230+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
231+
interval: "5s"
232+
start_period: "10s"
193233

194234
bsc-validator2-4:
195235
image: bsc-geth:docker-local
@@ -203,6 +243,10 @@ services:
203243
- bsc-validator2-4:/root/.ethereum
204244
- ./scripts:/scripts
205245
command: ash /scripts/bsc-validator.sh
246+
healthcheck:
247+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
248+
interval: "5s"
249+
start_period: "10s"
206250

207251
bsc-validator2-5:
208252
image: bsc-geth:docker-local
@@ -216,6 +260,18 @@ services:
216260
- bsc-validator2-5:/root/.ethereum
217261
- ./scripts:/scripts
218262
command: ash /scripts/bsc-validator.sh
263+
healthcheck:
264+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
265+
interval: "5s"
266+
start_period: "10s"
267+
268+
autoheal:
269+
restart: always
270+
image: willfarrell/autoheal
271+
environment:
272+
- AUTOHEAL_CONTAINER_LABEL=all
273+
volumes:
274+
- /var/run/docker.sock:/var/run/docker.sock
219275

220276
networks:
221277
bsc:
@@ -227,4 +283,4 @@ networks:
227283
ipam:
228284
driver: default
229285
config:
230-
- subnet: 99.98.0.0/16
286+
- subnet: 99.98.0.0/16
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
[ "$(geth attach --exec eth.syncing /gethipc)" == "false" ]

0 commit comments

Comments
 (0)