Skip to content

Commit 74549fb

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

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ 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+
retries: 2
78+
start_period: "5s"
7479

7580
bsc-rpc2: # This is the bootstrap node
7681
image: bsc-geth:docker-local
@@ -86,6 +91,10 @@ services:
8691
- ./scripts:/scripts
8792
- ./config:/config
8893
command: ash /scripts/bsc-rpc.sh
94+
healthcheck:
95+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
96+
interval: "5s"
97+
start_period: "5s"
8998

9099
bsc-validator1-1:
91100
image: bsc-geth:docker-local
@@ -99,6 +108,11 @@ services:
99108
- bsc-validator1-1:/root/.ethereum
100109
- ./scripts:/scripts
101110
command: ash /scripts/bsc-validator.sh
111+
healthcheck:
112+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
113+
interval: "5s"
114+
retries: 2
115+
start_period: "5s"
102116

103117
bsc-validator1-2:
104118
image: bsc-geth:docker-local
@@ -112,6 +126,11 @@ services:
112126
- bsc-validator1-2:/root/.ethereum
113127
- ./scripts:/scripts
114128
command: ash /scripts/bsc-validator.sh
129+
healthcheck:
130+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
131+
interval: "5s"
132+
retries: 2
133+
start_period: "5s"
115134

116135
bsc-validator1-3:
117136
image: bsc-geth:docker-local
@@ -125,6 +144,11 @@ services:
125144
- bsc-validator1-3:/root/.ethereum
126145
- ./scripts:/scripts
127146
command: ash /scripts/bsc-validator.sh
147+
healthcheck:
148+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
149+
interval: "5s"
150+
retries: 2
151+
start_period: "5s"
128152

129153
bsc-validator1-4:
130154
image: bsc-geth:docker-local
@@ -138,6 +162,11 @@ services:
138162
- bsc-validator1-4:/root/.ethereum
139163
- ./scripts:/scripts
140164
command: ash /scripts/bsc-validator.sh
165+
healthcheck:
166+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
167+
interval: "5s"
168+
retries: 2
169+
start_period: "5s"
141170

142171
bsc-validator1-5:
143172
image: bsc-geth:docker-local
@@ -151,6 +180,11 @@ services:
151180
- bsc-validator1-5:/root/.ethereum
152181
- ./scripts:/scripts
153182
command: ash /scripts/bsc-validator.sh
183+
healthcheck:
184+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
185+
interval: "5s"
186+
retries: 2
187+
start_period: "5s"
154188

155189
bsc-validator2-1:
156190
image: bsc-geth:docker-local
@@ -164,6 +198,11 @@ services:
164198
- bsc-validator2-1:/root/.ethereum
165199
- ./scripts:/scripts
166200
command: ash /scripts/bsc-validator.sh
201+
healthcheck:
202+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
203+
interval: "5s"
204+
retries: 2
205+
start_period: "5s"
167206

168207
bsc-validator2-2:
169208
image: bsc-geth:docker-local
@@ -177,6 +216,11 @@ services:
177216
- bsc-validator2-2:/root/.ethereum
178217
- ./scripts:/scripts
179218
command: ash /scripts/bsc-validator.sh
219+
healthcheck:
220+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
221+
interval: "5s"
222+
retries: 2
223+
start_period: "5s"
180224

181225
bsc-validator2-3:
182226
image: bsc-geth:docker-local
@@ -190,6 +234,11 @@ services:
190234
- bsc-validator2-3:/root/.ethereum
191235
- ./scripts:/scripts
192236
command: ash /scripts/bsc-validator.sh
237+
healthcheck:
238+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
239+
interval: "5s"
240+
retries: 2
241+
start_period: "5s"
193242

194243
bsc-validator2-4:
195244
image: bsc-geth:docker-local
@@ -203,6 +252,11 @@ services:
203252
- bsc-validator2-4:/root/.ethereum
204253
- ./scripts:/scripts
205254
command: ash /scripts/bsc-validator.sh
255+
healthcheck:
256+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
257+
interval: "5s"
258+
retries: 2
259+
start_period: "5s"
206260

207261
bsc-validator2-5:
208262
image: bsc-geth:docker-local
@@ -216,6 +270,19 @@ services:
216270
- bsc-validator2-5:/root/.ethereum
217271
- ./scripts:/scripts
218272
command: ash /scripts/bsc-validator.sh
273+
healthcheck:
274+
test: ["CMD", "ash", "/scripts/healthcheck.sh"]
275+
interval: "5s"
276+
retries: 2
277+
start_period: "5s"
278+
279+
autoheal:
280+
restart: always
281+
image: willfarrell/autoheal
282+
environment:
283+
- AUTOHEAL_CONTAINER_LABEL=all
284+
volumes:
285+
- /var/run/docker.sock:/var/run/docker.sock
219286

220287
networks:
221288
bsc:
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)