Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspoehls committed Apr 8, 2024
1 parent 633d2ab commit a4392ea
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions start-mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand All @@ -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 ""


Expand All @@ -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]"
Expand Down

0 comments on commit a4392ea

Please sign in to comment.