Bladeren bron

Healthcheck must to ensure mongo availability on startup

Vadim Surkov 6 jaren geleden
bovenliggende
commit
e98d9ad0cb
1 gewijzigde bestanden met toevoegingen van 1 en 0 verwijderingen
  1. 1 0
      healthcheck.sh

+ 1 - 0
healthcheck.sh

@@ -3,6 +3,7 @@
 containerstart=`stat -c %Z /proc/1`
 curtime=`date +%s`
 if (( curtime-containerstart < 180 )); then
+    while ! mongo --host "${DB_CLUSTER}" --eval "db.runCommand( { connectionStatus: 1 } )"; do echo "Waiting for ${DB_CLUSTER} to be available"; sleep 1; done
     echo "0"
     exit 0
 fi