Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
fix: mongosh in provision.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVZ96 committed Feb 17, 2024
1 parent 29b08cd commit 8c3f354
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,32 @@ docker-compose exec -T mysql57 bash -e -c "mysql -uroot mysql" < provision.sql
if needs_mongo "$to_provision_ordered"; then
echo -e "${GREEN}Waiting for MongoDB...${NC}"
# mongo container and mongo process/shell inside the container
echo "Getting mongo shell ..."
set +e
MONGO_SHELL=$(docker-compose exec -T mongo which mongosh)
if [[ $MONGO_SHELL ]] then
until docker-compose exec -T mongo mongosh --eval "db.serverStatus()" &> /dev/null
else
set -e
echo "Got mongo shell"
if [ -z "$MONGO_SHELL" ]; then
echo "Using old mongo CLI"
until docker-compose exec -T mongo mongo --eval "db.serverStatus()" &> /dev/null
do
printf "."
sleep 1
done
else
echo "Using new mongosh CLI"
until docker-compose exec -T mongo mongosh --eval "db.serverStatus()" &> /dev/null
do
printf "."
sleep 1
done
fi
t do
printf "."
sleep 1
done
echo -e "${GREEN}MongoDB ready.${NC}"
echo -e "${GREEN}Creating MongoDB users...${NC}"
if [[ $MONGO_SHELL ]] then
docker-compose exec -T mongo bash -e -c "mongosh" < mongo-provision.js
if [ -z $MONGO_SHELL ]; then
docker-compose exec -T mongo bash -e -c "mongo" < mongo-provision.js;
else
docker-compose exec -T mongo bash -e -c "mongo" < mongo-provision.js
docker-compose exec -T mongo bash -e -c "mongosh" < mongo-provision.js;
fi
else
echo -e "${GREEN}MongoDB preparation not required; skipping.${NC}"
Expand Down

0 comments on commit 8c3f354

Please sign in to comment.