Skip to content

Commit

Permalink
Wait for mongo to be up and running before replication can be done
Browse files Browse the repository at this point in the history
  • Loading branch information
bradsawadye committed Sep 5, 2023
1 parent 93ae3a5 commit ecb7286
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.9'

services:
await-helper:
image: jembi/await-helper:1.0.1
deploy:
replicas: 1
restart_policy:
condition: none
command: '-k http://mongo-1:27017'
2 changes: 2 additions & 0 deletions interoperability-layer-openhim/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function initialize_package() {
if [[ "${CLUSTERED_MODE}" == "true" ]]; then
try "${COMPOSE_FILE_PATH}/initiate-replica-set.sh $STACK" throw "Fatal: Initiate Mongo replica set failed"
else
config::await_service_running "mongo-1" "${COMPOSE_FILE_PATH}"/docker-compose.await-helper-mongo.yml "1" "$STACK"

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 \
mongo event listeners which only work with a replica set"
fi
Expand Down

0 comments on commit ecb7286

Please sign in to comment.