From 8e7af846a36af45d3761726a96d533d185eaac14 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 29 Jan 2024 17:41:36 +0100 Subject: [PATCH] Update Orion and MongoDB --- .env | 4 ++-- docker-compose.yml | 11 ++++++----- services | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 8afc750..1bad08d 100644 --- a/.env +++ b/.env @@ -3,8 +3,8 @@ 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 \ No newline at end of file +MONGO_DB_VERSION=6.0 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0abf71f..bced772 100644 --- a/docker-compose.yml +++ b/docker-compose.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} @@ -52,10 +52,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/services b/services index 9705d32..041a10b 100755 --- a/services +++ b/services @@ -59,17 +59,17 @@ stoppingContainers () { } addDatabaseIndex () { - printf "Create \033[1mMongoDB\033[0m database indexes ..." - docker exec db-mongo mongo --eval ' + printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;34mOrion\033[0m ..." + docker exec db-mongo mongosh --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" } + waitForMongo () { echo -e "\n⏳ Waiting for \033[1mMongoDB\033[0m to be available\n" while ! [ `docker inspect --format='{{.State.Health.Status}}' db-mongo` == "healthy" ]