diff --git a/.env b/.env index c690446..d3cbaf3 100644 --- a/.env +++ b/.env @@ -21,7 +21,7 @@ CURL_VERSION=8.4.0 # MongoDB variables MONGO_DB_PORT=27017 -MONGO_DB_VERSION=4.4 +MONGO_DB_VERSION=6.0 # IoT Agent Ultralight Variables ULTRALIGHT_VERSION=3.4.0-distroless diff --git a/docker-compose/common.yml b/docker-compose/common.yml index 95fd4c4..8199f2f 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 # IoT-Agent is configured for the UltraLight Protocol diff --git a/docker-compose/orion-ld.yml b/docker-compose/orion-ld.yml index 14b4f4b..17c3405 100644 --- a/docker-compose/orion-ld.yml +++ b/docker-compose/orion-ld.yml @@ -33,7 +33,7 @@ services: - default ports: - ${EXPOSED_PORT:-1026}:${ORION_LD_PORT:-1026} - command: -dbhost mongo-db -logLevel DEBUG -forwarding -experimental + command: -dbhost mongo-db -logLevel DEBUG -forwarding -mongocOnly healthcheck: test: curl --fail -s http://orion:${ORION_LD_PORT}/version || exit 1 diff --git a/services b/services index 52d0cf5..450e196 100755 --- a/services +++ b/services @@ -169,30 +169,9 @@ stoppingContainers () { } -addDatabaseIndex () { - echo -e "Create \033[1mMongoDB\033[0m database indexes ..." - docker exec db-mongo mongo --eval ' - conn = new Mongo();db.createCollection("orion"); - db = conn.getDB("orion"); - db.createCollection("entities"); - db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true}); - db.entities.createIndex({"_id.type": 1}); - db.entities.createIndex({"_id.id": 1});' > /dev/null - echo -e " \033[1;32mdone\033[0m" - - docker exec db-mongo mongo --eval ' - conn = new Mongo();db.createCollection("orion-openiot"); - db = conn.getDB("orion-openiot"); - db.createCollection("entities"); - db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true}); - db.entities.createIndex({"_id.type": 1}); - db.entities.createIndex({"_id.id": 1});' > /dev/null - echo -e " \033[1;32mdone\033[0m" -} - addIoTDatabaseIndex () { echo -e "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;36mIoT-Agent\033[0m ..." - docker exec db-mongo mongo --eval ' + docker exec db-mongo mongosh --eval ' conn = new Mongo(); db = conn.getDB("iotagentul"); db.getCollectionNames().forEach(c=>db[c].drop()); @@ -249,7 +228,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 loadData orion:1026 echo -e "\033[1;34m${command}\033[0m is now running and exposed on localhost:${EXPOSED_PORT}" @@ -268,7 +246,6 @@ case "${command}" in ${dockerCmd} -f docker-compose/common.yml -f docker-compose/scorpio.yml up -d --remove-orphans --renew-anon-volumes displayServices "scorpio|fiware" waitForMongo - addDatabaseIndex waitForScorpio loadData scorpio:9090 echo -e "\033[1;34m${command}\033[0m is now running and exposed on localhost:${EXPOSED_PORT}" @@ -287,7 +264,6 @@ case "${command}" in ${dockerCmd} -f docker-compose/common.yml -f docker-compose/stellio.yml up -d --remove-orphans --renew-anon-volumes displayServices "stellio|fiware" waitForMongo - addDatabaseIndex waitForStellio loadData stellio:8080 echo -e "\033[1;34m${command}\033[0m is now running and exposed on localhost:${EXPOSED_PORT}"