Created
April 30, 2021 18:27
-
-
Save deeTEEcee/2a9aa30f8247ee363aa111c030eeda0b to your computer and use it in GitHub Desktop.
mongo-connection.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rs.initiate() is playing 2 roles: | |
# * required for my local mongo setup | |
# * it can also be used to test a connection but you can use almost any other evaluation command. | |
# The command below runs a mongo check in a loop and times out after a minute. | |
# Why not use "wait-for-it.sh"? That establishes a tcp connection check but you could still run into a connection error | |
# if you run a single mongo connection check so we still need to loop. | |
timeout -v 1m bash -c 'until docker exec -it mongo mongo --eval "rs.initiate()"; do sleep 3; done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment