1
- version : " 3"
2
1
services :
3
2
4
3
# #
@@ -14,11 +13,30 @@ services:
14
13
volumes :
15
14
- ./lowcoder-stacks/data/mongodb:/data/db
16
15
restart : unless-stopped
16
+ healthcheck : # https://github.com/rodrigobdz/docker-compose-healthchecks?tab=readme-ov-file#mongo
17
+ test :
18
+ [
19
+ " CMD" ,
20
+ " mongosh" ,
21
+ " --quiet" ,
22
+ " 127.0.0.1/test" ,
23
+ " --eval" ,
24
+ " 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'" ,
25
+ ]
26
+ interval : 5s
27
+ timeout : 10s
28
+ retries : 10
29
+ start_period : 40s
17
30
18
31
redis :
19
32
image : redis:7-alpine
20
33
container_name : redis
21
34
restart : unless-stopped
35
+ healthcheck : # https://stackoverflow.com/a/71504657
36
+ test : ["CMD-SHELL", "redis-cli ping | grep PONG"]
37
+ interval : 1s
38
+ timeout : 3s
39
+ retries : 10
22
40
23
41
24
42
# #
@@ -82,11 +100,20 @@ services:
82
100
LOWCODER_SUPERUSER_PASSWORD :
83
101
restart : unless-stopped
84
102
depends_on :
85
- - mongodb
86
- - redis
103
+ mongodb :
104
+ condition : service_healthy
105
+ restart : true
106
+ redis :
107
+ condition : service_healthy
108
+ restart : true
87
109
volumes :
88
110
- ./lowcoder-stacks:/lowcoder-stacks
89
111
- ./lowcoder-stacks/assets:/lowcoder/assets
112
+ healthcheck : # https://stackoverflow.com/questions/71101967/how-should-i-use-grep-in-docker-compose-healthcheck
113
+ test : curl -sS http://lowcoder-api-service:8080 | grep -c "Lowcoder API is up and runnig" > /dev/null
114
+ interval : 3s
115
+ timeout : 5s
116
+ retries : 10
90
117
91
118
92
119
lowcoder-node-service :
@@ -101,7 +128,14 @@ services:
101
128
LOWCODER_API_SERVICE_URL : " http://lowcoder-api-service:8080"
102
129
restart : unless-stopped
103
130
depends_on :
104
- - lowcoder-api-service
131
+ lowcoder-api-service :
132
+ condition : service_healthy
133
+ restart : true
134
+ healthcheck : # https://stackoverflow.com/questions/71101967/how-should-i-use-grep-in-docker-compose-healthcheck
135
+ test : curl -sS http://lowcoder-node-service:6060 | grep -c "Lowcoder Node Service is up and running" > /dev/null
136
+ interval : 3s
137
+ timeout : 5s
138
+ retries : 10
105
139
106
140
# #
107
141
# # Start Lowcoder web frontend
@@ -120,8 +154,18 @@ services:
120
154
LOWCODER_NODE_SERVICE_URL : " http://lowcoder-node-service:6060"
121
155
restart : unless-stopped
122
156
depends_on :
123
- - lowcoder-node-service
124
- - lowcoder-api-service
157
+ lowcoder-node-service :
158
+ condition : service_healthy
159
+ restart : true
160
+ lowcoder-api-service :
161
+ condition : service_healthy
162
+ restart : true
125
163
volumes :
126
164
- ./lowcoder-stacks/assets:/lowcoder/assets
165
+ healthcheck :
166
+ test : curl --fail http://lowcoder-frontend:3000 || exit 1
167
+ interval : 5s
168
+ retries : 10
169
+ start_period : 10s
170
+ timeout : 10s
127
171
0 commit comments