From 8f63f828a97f948038599522dbcd68a122a70184 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Fri, 30 Aug 2024 13:39:04 +0200 Subject: [PATCH] Update to MongoDB 6.0 --- .env | 2 +- docker-compose/common.yml | 4 +--- docker-compose/orion-ld.yml | 2 +- services | 5 ++--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 7bb3c2c..8923c9f 100755 --- a/.env +++ b/.env @@ -20,7 +20,7 @@ CURL_VERSION=8.4.0 # MongoDB variables MONGO_DB_PORT=27017 -MONGO_DB_VERSION=4.4 +MONGO_DB_VERSION=6.0 # Tutorial variables TUTORIAL_APP_PORT=3000 diff --git a/docker-compose/common.yml b/docker-compose/common.yml index d7d383c..c08fb8d 100644 --- a/docker-compose/common.yml +++ b/docker-compose/common.yml @@ -53,9 +53,7 @@ services: - mongo-db:/data/db - mongo-config:/data/configdb healthcheck: - test: | - host=`hostname --ip-address || echo '127.0.0.1'`; - mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1 + test: ["CMD","mongosh", "localhost:27017/test", "--quiet"] interval: 5s # Tutorial acts as a series of dummy IoT Sensors over HTTP diff --git a/docker-compose/orion-ld.yml b/docker-compose/orion-ld.yml index 57fc0ee..6088f48 100644 --- a/docker-compose/orion-ld.yml +++ b/docker-compose/orion-ld.yml @@ -31,7 +31,7 @@ services: - default ports: - ${EXPOSED_PORT:-1026}:${ORION_LD_PORT:-1026} - command: -dbhost mongo-db -logLevel DEBUG -forwarding + command: -dbhost mongo-db -logLevel DEBUG -forwarding -mongocOnly healthcheck: test: curl --fail -s http://orion:${ORION_LD_PORT:-1026}/version || exit 1 interval: 5s diff --git a/services b/services index fe6c178..cbcda07 100755 --- a/services +++ b/services @@ -123,7 +123,7 @@ loadData () { addDatabaseIndex () { printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;34mOrion\033[0m ..." - docker exec db-mongo mongo --eval ' + docker exec db-mongo mongosh --eval ' conn = new Mongo();db.createCollection("orion"); db = conn.getDB("orion"); db.createCollection("entities"); @@ -131,7 +131,7 @@ addDatabaseIndex () { db.entities.createIndex({"_id.type": 1}); db.entities.createIndex({"_id.id": 1});' > /dev/null - docker exec db-mongo mongo --eval ' + docker exec db-mongo mongosh --eval ' conn = new Mongo();db.createCollection("orion-openiot"); db = conn.getDB("orion-openiot"); db.createCollection("entities"); @@ -181,7 +181,6 @@ case "${command}" in ${dockerCmd} -f docker-compose/common.yml -f docker-compose/orion-ld.yml up -d --remove-orphans --renew-anon-volumes displayServices "orion|fiware" waitForMongo - addDatabaseIndex waitForOrion export CONTEXT_BROKER=orion:1026 loadData