diff --git a/.env b/.env index cc0c2ff..c3b5445 100644 --- a/.env +++ b/.env @@ -3,11 +3,11 @@ COMPOSE_PROJECT_NAME=fiware # Orion variables ORION_PORT=1026 -ORION_VERSION=3.10.1 +ORION_VERSION=3.11.0 # MongoDB variables MONGO_DB_PORT=27017 -MONGO_DB_VERSION=4.4 +MONGO_DB_VERSION=6.0 # IoT Agent Ultralight Variables ULTRALIGHT_VERSION=3.1.0-distroless diff --git a/docker-compose/cygnus-sth-comet.yml b/docker-compose/cygnus-sth-comet.yml index 33ed692..5ed27bc 100644 --- a/docker-compose/cygnus-sth-comet.yml +++ b/docker-compose/cygnus-sth-comet.yml @@ -1,7 +1,7 @@ version: "3.8" services: - # Orion is the context broker - orion: + # Orion is an NGSI-v2 context broker + orion-v2: labels: org.fiware: 'tutorial' image: quay.io/fiware/orion:${ORION_VERSION} @@ -105,7 +105,7 @@ services: hostname: iot-sensors container_name: fiware-tutorial depends_on: - - orion + - orion-v2 - iot-agent - sth-comet networks: @@ -154,10 +154,11 @@ services: volumes: - mongo-db:/data 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", "--eval", "db.adminCommand('ping')"] interval: 5s + timeout: 5s + retries: 3 + start_period: 5s networks: diff --git a/docker-compose/sth-comet.yml b/docker-compose/sth-comet.yml index d21a32d..645a7ed 100644 --- a/docker-compose/sth-comet.yml +++ b/docker-compose/sth-comet.yml @@ -18,8 +18,8 @@ # version: "3.8" services: - # Orion is the context broker - orion: + # Orion is an NGSI-v2 context broker + orion-v2: labels: org.fiware: 'tutorial' image: quay.io/fiware/orion:${ORION_VERSION} @@ -98,7 +98,7 @@ services: hostname: iot-sensors container_name: fiware-tutorial depends_on: - - orion + - orion-v2 - iot-agent - sth-comet networks: @@ -146,10 +146,11 @@ services: volumes: - mongo-db:/data 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", "--eval", "db.adminCommand('ping')"] interval: 5s + timeout: 5s + retries: 3 + start_period: 5s networks: default: diff --git a/services b/services index 49cd327..07584f8 100755 --- a/services +++ b/services @@ -61,7 +61,7 @@ displayServices () { 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"); @@ -69,7 +69,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"); @@ -78,18 +78,6 @@ addDatabaseIndex () { db.entities.createIndex({"_id.id": 1});' > /dev/null echo -e " \033[1;32mdone\033[0m" - printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;36mIoT-Agent\033[0m ..." - docker exec db-mongo mongo --eval ' - conn = new Mongo(); - db = conn.getDB("iotagentul"); - db.createCollection("devices"); - db.devices.createIndex({"_id.service": 1, "_id.id": 1, "_id.type": 1}); - db.devices.createIndex({"_id.type": 1}); - db.devices.createIndex({"_id.id": 1}); - db.createCollection("groups"); - db.groups.createIndex({"_id.resource": 1, "_id.apikey": 1, "_id.service": 1}); - db.groups.createIndex({"_id.type": 1});' > /dev/null - echo -e " \033[1;32mdone\033[0m" } waitForMongo () {