File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ services:
34
34
command : -dbhost mongo-db -logLevel DEBUG
35
35
healthcheck :
36
36
test : curl --fail -s http://orion:${ORION_PORT}/version || exit 1
37
+ interval : 5s
37
38
38
39
# IoT-Agent is configured for the UltraLight Protocol
39
40
#
@@ -127,7 +128,9 @@ services:
127
128
healthcheck :
128
129
test : |
129
130
host=`hostname --ip-address || echo '127.0.0.1'`;
130
- mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
131
+ mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
132
+ interval : 5s
133
+
131
134
132
135
# Other services
133
136
mosquitto :
Original file line number Diff line number Diff line change @@ -67,10 +67,19 @@ addDatabaseIndex () {
67
67
echo -e " \033[1;32mdone\033[0m"
68
68
}
69
69
70
+ waitForMongo () {
71
+ echo -e " \n⏳ Waiting for \033[1mMongoDB\033[0m to be available\n"
72
+ while ! [ ` docker inspect --format=' {{.State.Health.Status}}' db-mongo` == " healthy" ]
73
+ do
74
+ sleep 1
75
+ done
76
+ }
77
+
70
78
waitForOrion () {
71
79
echo -e " \n⏳ Waiting for \033[1;34mOrion\033[0m to be available\n"
72
- while [ ` docker run --network fiware_default --rm curlimages/curl -s -o /dev/null -w %{http_code} ' http://orion:1026/version' ` -eq 000 ]
73
- do
80
+
81
+ while ! [ ` docker inspect --format=' {{.State.Health.Status}}' fiware-orion` == " healthy" ]
82
+ do
74
83
echo -e " Context Broker HTTP state: " ` curl -s -o /dev/null -w %{http_code} ' http://localhost:1026/version' ` " (waiting for 200)"
75
84
sleep 1
76
85
done
@@ -100,6 +109,7 @@ case "${command}" in
100
109
echo -e " - \033[1mMosquitto\033[0m acts as an MQTT Message Broker"
101
110
echo " "
102
111
docker-compose --log-level ERROR -p fiware up -d --remove-orphans
112
+ waitForMongo
103
113
addDatabaseIndex
104
114
waitForOrion
105
115
loadData
You can’t perform that action at this time.
0 commit comments