Skip to content

Commit

Permalink
bring back ports
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspoehls committed Apr 8, 2024
1 parent ad7bccb commit 7e1501d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions start-mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ wait_for_mongodb () {
fi

# until ${WAIT_FOR_MONGODB_COMMAND}
until docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT $MONGODB_ARGS --eval "db.serverStatus()"
until docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --port $MONGODB_PORT $MONGODB_ARGS --eval "db.serverStatus()"
do
echo "."
sleep 1
Expand All @@ -85,7 +85,7 @@ if [ -z "$MONGODB_REPLICA_SET" ]; then
echo " - container-name [$MONGODB_CONTAINER_NAME]"
echo ""

docker run --name $MONGODB_CONTAINER_NAME --publish $MONGODB_PORT:27017 -e MONGO_INITDB_DATABASE=$MONGODB_DB -e MONGO_INITDB_ROOT_USERNAME=$MONGODB_USERNAME -e MONGO_INITDB_ROOT_PASSWORD=$MONGODB_PASSWORD --detach mongo:$MONGODB_VERSION
docker run --name $MONGODB_CONTAINER_NAME --publish $MONGODB_PORT:$MONGODB_PORT -e MONGO_INITDB_DATABASE=$MONGODB_DB -e MONGO_INITDB_ROOT_USERNAME=$MONGODB_USERNAME -e MONGO_INITDB_ROOT_PASSWORD=$MONGODB_PASSWORD --detach mongo:$MONGODB_VERSION --port $MONGODB_PORT

if [ $? -ne 0 ]; then
echo "Error starting MongoDB Docker container"
Expand All @@ -108,7 +108,7 @@ echo " - container-name [$MONGODB_CONTAINER_NAME]"
echo ""


docker run --name $MONGODB_CONTAINER_NAME --publish $MONGODB_PORT:27017 --detach mongo:$MONGODB_VERSION --replSet $MONGODB_REPLICA_SET
docker run --name $MONGODB_CONTAINER_NAME --publish $MONGODB_PORT:$MONGODB_PORT --detach mongo:$MONGODB_VERSION --port $MONGODB_PORT --replSet $MONGODB_REPLICA_SET

if [ $? -ne 0 ]; then
echo "Error starting MongoDB Docker container"
Expand All @@ -121,7 +121,7 @@ wait_for_mongodb

echo "::group::Initiating replica set [$MONGODB_REPLICA_SET]"

docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --eval "
docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --port $MONGODB_PORT --eval "
rs.initiate({
\"_id\": \"$MONGODB_REPLICA_SET\",
\"members\": [ {
Expand All @@ -136,5 +136,5 @@ echo "::endgroup::"


echo "::group::Checking replica set status [$MONGODB_REPLICA_SET]"
docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --eval "rs.status()"
docker exec --tty $MONGODB_CONTAINER_NAME $MONGODB_CLIENT --port $MONGODB_PORT --eval "rs.status()"
echo "::endgroup::"

0 comments on commit 7e1501d

Please sign in to comment.