Skip to content

Commit 9cad10d

Browse files
committed
Update to MongoDB 6.0
1 parent fc57566 commit 9cad10d

4 files changed

Lines changed: 4 additions & 39 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CURL_VERSION=8.4.0
2020

2121
# MongoDB variables
2222
MONGO_DB_PORT=27017
23-
MONGO_DB_VERSION=4.4
23+
MONGO_DB_VERSION=6.0
2424

2525
# IoT Agent Ultralight Variables
2626
ULTRALIGHT_VERSION=3.4.0-distroless

docker-compose/common.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ services:
5353
- mongo-db:/data/db
5454
- mongo-config:/data/configdb
5555
healthcheck:
56-
test: |
57-
host=`hostname --ip-address || echo '127.0.0.1'`;
58-
mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
56+
test: ["CMD","mongosh", "localhost:27017/test", "--quiet"]
5957
interval: 5s
6058

6159
# IoT-Agent is configured for the UltraLight Protocol

docker-compose/orion-ld.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333
- default
3434
ports:
3535
- ${EXPOSED_PORT:-1026}:${ORION_LD_PORT:-1026}
36-
command: -dbhost mongo-db -logLevel DEBUG -forwarding -experimental
36+
command: -dbhost mongo-db -logLevel DEBUG -forwarding -mongocOnly
3737
healthcheck:
3838
test: curl --fail -s http://orion:${ORION_LD_PORT}/version || exit 1
3939
interval: 5s

services

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -167,43 +167,11 @@ displayServices () {
167167
echo ""
168168
}
169169

170-
addDatabaseIndex () {
171-
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;34mOrion\033[0m ..."
172-
docker exec db-mongo mongo --eval '
173-
conn = new Mongo();db.createCollection("orion");
174-
db = conn.getDB("orion");
175-
db.createCollection("entities");
176-
db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true});
177-
db.entities.createIndex({"_id.type": 1});
178-
db.entities.createIndex({"_id.id": 1});' > /dev/null
179170

180-
docker exec db-mongo mongo --eval '
181-
conn = new Mongo();db.createCollection("orion-openiot");
182-
db = conn.getDB("orion-openiot");
183-
db.createCollection("entities");
184-
db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true});
185-
db.entities.createIndex({"_id.type": 1});
186-
db.entities.createIndex({"_id.id": 1});' > /dev/null
187-
echo -e " \033[1;32mdone\033[0m"
188-
189-
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;36mIoT-Agent\033[0m ..."
190-
docker exec db-mongo mongo --eval '
191-
conn = new Mongo();
192-
db = conn.getDB("iotagentul");
193-
db.getCollectionNames().forEach(c=>db[c].drop());
194-
db.createCollection("devices");
195-
db.devices.createIndex({"_id.service": 1, "_id.id": 1, "_id.type": 1});
196-
db.devices.createIndex({"_id.type": 1});
197-
db.devices.createIndex({"_id.id": 1});
198-
db.createCollection("groups");
199-
db.groups.createIndex({"_id.resource": 1, "_id.apikey": 1, "_id.service": 1});
200-
db.groups.createIndex({"_id.type": 1});' > /dev/null
201-
echo -e " \033[1;32mdone\033[0m"
202-
}
203171

204172
addIoTDatabaseIndex () {
205173
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;36mIoT-Agent\033[0m ..."
206-
docker exec db-mongo mongo --eval '
174+
docker exec db-mongo mongosh --eval '
207175
conn = new Mongo();
208176
db = conn.getDB("iotagentul");
209177
db.getCollectionNames().forEach(c=>db[c].drop());
@@ -233,7 +201,6 @@ case "${command}" in
233201
${dockerCmd} -f docker-compose/common.yml -f docker-compose/orion-ld.yml -p fiware up -d --renew-anon-volumes
234202
displayServices "orion|fiware"
235203
waitForMongo
236-
addDatabaseIndex
237204
waitForOrion
238205
loadData orion:1026
239206
echo -e "\033[1;34m${command}\033[0m is now running and exposed on localhost:${EXPOSED_PORT}"

0 commit comments

Comments
 (0)