Skip to content

Commit ecb7286

Browse files
committed
Wait for mongo to be up and running before replication can be done
1 parent 93ae3a5 commit ecb7286

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3.9'
2+
3+
services:
4+
await-helper:
5+
image: jembi/await-helper:1.0.1
6+
deploy:
7+
replicas: 1
8+
restart_policy:
9+
condition: none
10+
command: '-k http://mongo-1:27017'

interoperability-layer-openhim/swarm.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ function initialize_package() {
5555
if [[ "${CLUSTERED_MODE}" == "true" ]]; then
5656
try "${COMPOSE_FILE_PATH}/initiate-replica-set.sh $STACK" throw "Fatal: Initiate Mongo replica set failed"
5757
else
58+
config::await_service_running "mongo-1" "${COMPOSE_FILE_PATH}"/docker-compose.await-helper-mongo.yml "1" "$STACK"
59+
5860
try "docker exec -i $(docker ps -q -f name=openhim_mongo) mongo --eval \"rs.initiate()\"" throw "Could not initiate replica set for the single mongo instance. Some services use \
5961
mongo event listeners which only work with a replica set"
6062
fi

0 commit comments

Comments
 (0)