diff --git a/start-mongodb.sh b/start-mongodb.sh index 7185bdb..5b0783f 100644 --- a/start-mongodb.sh +++ b/start-mongodb.sh @@ -57,20 +57,14 @@ wait_for_mongodb () { sleep 1 TIMER=$((TIMER + 1)) - if [[ $TIMER -eq 40 ]]; then - echo "MongoDB did not initialize within 40 seconds. Exiting." + if [[ $TIMER -eq 20 ]]; then + echo "MongoDB did not initialize within 20 seconds. Exiting." exit 2 fi done echo "::endgroup::" } -# check if the container already exists and remove it -if [ "$(docker ps -q -f name=$MONGODB_CONTAINER_NAME)" ]; then - echo "Removing existing container [$MONGODB_CONTAINER_NAME]" - docker rm -f $MONGODB_CONTAINER_NAME -fi - if [ -z "$MONGODB_REPLICA_SET" ]; then echo "::group::Starting single-node instance, no replica set" echo " - port [$MONGODB_PORT]" @@ -97,7 +91,9 @@ fi echo "::group::Starting MongoDB as single-node replica set" echo " - port [$MONGODB_PORT]" echo " - version [$MONGODB_VERSION]" -echo " - replica set [$MONGODB_REPLICA_SET]" +echo " - database [$MONGODB_DB]" +echo " - credentials [$MONGODB_USERNAME:$MONGODB_PASSWORD]" +echo " - container-name [$MONGODB_CONTAINER_NAME]" echo "" @@ -109,6 +105,12 @@ if [ $? -ne 0 ]; then fi echo "::endgroup::" + +echo "::group::Listing all Docker containers" +docker ps +echo "::endgroup::" + + wait_for_mongodb echo "::group::Initiating replica set [$MONGODB_REPLICA_SET]"