Skip to content

Commit 0afcaec

Browse files
committed
Update Orion and MongoDB
1 parent fc31eca commit 0afcaec

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ COMPOSE_PROJECT_NAME=fiware
33

44
# Orion variables
55
ORION_PORT=1026
6-
ORION_VERSION=3.10.1
6+
ORION_VERSION=3.11.0
77

88
# MongoDB variables
99
MONGO_DB_PORT=27017
10-
MONGO_DB_VERSION=4.4
10+
MONGO_DB_VERSION=6.0
1111

1212
# Custom IoT Agent Variables
1313
IOTA_NORTH_PORT=4041

docker-compose.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#
1919
version: "3.8"
2020
services:
21-
# Orion is the context broker
22-
orion:
21+
# Orion is an NGSI-v2 context broker
22+
orion-v2:
2323
labels:
2424
org.fiware: 'tutorial'
2525
image: quay.io/fiware/orion:${ORION_VERSION}
@@ -83,7 +83,7 @@ services:
8383
hostname: iot-sensors
8484
container_name: fiware-tutorial
8585
depends_on:
86-
- orion
86+
- orion-v2
8787
- iot-agent
8888
networks:
8989
default:
@@ -128,10 +128,11 @@ services:
128128
volumes:
129129
- mongo-db:/data
130130
healthcheck:
131-
test: |
132-
host=`hostname --ip-address || echo '127.0.0.1'`;
133-
mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
131+
test: ["CMD","mongosh", "--eval", "db.adminCommand('ping')"]
134132
interval: 5s
133+
timeout: 5s
134+
retries: 3
135+
start_period: 5s
135136

136137
networks:
137138
default:

services

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,30 @@ displayServices () {
6060
}
6161

6262
addDatabaseIndex () {
63+
64+
65+
6366
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;34mOrion\033[0m ..."
64-
docker exec db-mongo mongo --eval '
67+
68+
docker exec db-mongo /bin/mongosh --quiet --eval '
6569
conn = new Mongo();db.createCollection("orion");
6670
db = conn.getDB("orion");
6771
db.createCollection("entities");
6872
db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true});
6973
db.entities.createIndex({"_id.type": 1});
70-
db.entities.createIndex({"_id.id": 1});' > /dev/null
74+
db.entities.createIndex({"_id.id": 1});' || true
7175

72-
docker exec db-mongo mongo --eval '
76+
docker exec db-mongo /bin/mongosh --quiet --eval '
7377
conn = new Mongo();db.createCollection("orion-openiot");
7478
db = conn.getDB("orion-openiot");
7579
db.createCollection("entities");
7680
db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true});
7781
db.entities.createIndex({"_id.type": 1});
78-
db.entities.createIndex({"_id.id": 1});' > /dev/null
82+
db.entities.createIndex({"_id.id": 1});' || true
7983
echo -e " \033[1;32mdone\033[0m"
8084

8185
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;36mIoT-Agent\033[0m ..."
82-
docker exec db-mongo mongo --eval '
86+
docker exec db-mongo /bin/mongosh --quiet --eval '
8387
conn = new Mongo();
8488
db = conn.getDB("iotagentul");
8589
db.createCollection("devices");
@@ -88,7 +92,7 @@ addDatabaseIndex () {
8892
db.devices.createIndex({"_id.id": 1});
8993
db.createCollection("groups");
9094
db.groups.createIndex({"_id.resource": 1, "_id.apikey": 1, "_id.service": 1});
91-
db.groups.createIndex({"_id.type": 1});' > /dev/null
95+
db.groups.createIndex({"_id.type": 1});' || true
9296
echo -e " \033[1;32mdone\033[0m"
9397
}
9498

0 commit comments

Comments
 (0)