diff --git a/.env b/.env index 1167ef4..f57b93b 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 # Tutorial variables TUTORIAL_APP_PORT=3000 diff --git a/docker-compose/ckan.yml b/docker-compose/ckan.yml index 85f08b6..c409346 100644 --- a/docker-compose/ckan.yml +++ b/docker-compose/ckan.yml @@ -1,8 +1,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} @@ -102,10 +102,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 ckan: diff --git a/docker-compose/elasticsearch.yml b/docker-compose/elasticsearch.yml index f2711ad..87398f2 100644 --- a/docker-compose/elasticsearch.yml +++ b/docker-compose/elasticsearch.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} diff --git a/docker-compose/hdfs.yml b/docker-compose/hdfs.yml index af6dc35..183369a 100644 --- a/docker-compose/hdfs.yml +++ b/docker-compose/hdfs.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} @@ -161,10 +161,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 namenode: diff --git a/docker-compose/mongodb.yml b/docker-compose/mongodb.yml index 84b6227..0c804de 100644 --- a/docker-compose/mongodb.yml +++ b/docker-compose/mongodb.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} @@ -145,10 +145,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/multiple.yml b/docker-compose/multiple.yml index bee7ceb..1e2e7ea 100644 --- a/docker-compose/multiple.yml +++ b/docker-compose/multiple.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} @@ -120,7 +120,7 @@ services: hostname: iot-sensors container_name: fiware-tutorial depends_on: - - orion + - orion-v2 - iot-agent networks: default: @@ -166,10 +166,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 mysql-db: diff --git a/docker-compose/mysql.yml b/docker-compose/mysql.yml index 5726794..08a9ba0 100644 --- a/docker-compose/mysql.yml +++ b/docker-compose/mysql.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} @@ -105,7 +105,7 @@ services: hostname: iot-sensors container_name: fiware-tutorial depends_on: - - orion + - orion-v2 - iot-agent networks: default: @@ -151,10 +151,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 mysql-db: diff --git a/docker-compose/postgres.yml b/docker-compose/postgres.yml index 06564ec..900870e 100644 --- a/docker-compose/postgres.yml +++ b/docker-compose/postgres.yml @@ -19,8 +19,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} @@ -107,7 +107,7 @@ services: hostname: iot-sensors container_name: fiware-tutorial depends_on: - - orion + - orion-v2 - iot-agent networks: default: @@ -153,10 +153,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 postgres-db: diff --git a/services b/services index a43fe19..0757279 100755 --- a/services +++ b/services @@ -62,7 +62,7 @@ stoppingContainers () { 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"); @@ -70,7 +70,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"); @@ -79,18 +79,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 () {