Skip to content

Commit

Permalink
Update Orion and MongoDB
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jan 29, 2024
1 parent 3fa6284 commit 08396c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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 JSON Variables
JSON_VERSION=3.1.0-distroless
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ services:
hostname: iot-sensors
container_name: fiware-tutorial
depends_on:
- orion
- orion-v2
- iot-agent
networks:
default:
Expand Down Expand Up @@ -128,10 +128,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:
Expand Down
16 changes: 2 additions & 14 deletions services
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ 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");
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

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");
Expand All @@ -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 () {
Expand Down

0 comments on commit 08396c6

Please sign in to comment.