Skip to content

Commit 6a29f2c

Browse files
committed
Update Orion and MongoDB
1 parent 012ff47 commit 6a29f2c

4 files changed

Lines changed: 41 additions & 58 deletions

File tree

docker-compose/common.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,25 @@
1717
# see: https://github.com/FIWARE/helm-charts/
1818
#
1919
version: '3.9'
20-
services:
20+
services:
21+
# @context file is served from here
22+
ld-context:
23+
labels:
24+
org.fiware: 'tutorial'
25+
image: httpd:alpine
26+
hostname: context
27+
container_name: fiware-ld-context
28+
ports:
29+
- "3004:80"
30+
volumes:
31+
- data-models:/usr/local/apache2/htdocs/
32+
- type: bind
33+
source: ${PWD}/conf/mime.types
34+
target: /usr/local/apache2/conf/mime.types
35+
read_only: true
36+
healthcheck:
37+
test: (wget --server-response --spider --quiet http://ld-context/ngsi-context.jsonld 2>&1 | awk 'NR==1{print $$2}'| grep -q -e "200") || exit 1
38+
2139
# Databases
2240
mongo-db:
2341
labels:
@@ -87,3 +105,9 @@ networks:
87105

88106
volumes:
89107
mongo-db: ~
108+
data-models:
109+
driver: local
110+
driver_opts:
111+
type: none
112+
o: bind
113+
device: ${PWD}/data-models

docker-compose/orion-ld.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
#
1919
version: '3.9'
2020
services:
21-
# Orion is the context broker
22-
orion:
21+
# Orion-LD is an NGSI-LD context broker
22+
orion-ld:
2323
labels:
2424
org.fiware: 'tutorial'
2525
image: quay.io/fiware/orion-ld:${ORION_LD_VERSION}
2626
hostname: orion
27-
container_name: fiware-orion
27+
container_name: fiware-orion-ld
2828
depends_on:
2929
- mongo-db
3030
networks:
Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,19 @@
1818
#
1919
version: '3.9'
2020
services:
21-
zookeeper:
22-
labels:
23-
org.fiware: 'tutorial'
24-
image: zookeeper
25-
hostname: zookeeper
26-
container_name: zookeeper
27-
networks:
28-
- default
29-
ports:
30-
- "2181"
31-
logging:
32-
driver: none
33-
kafka:
21+
# Scorpio is an NGSI-LD context broker
22+
scorpio:
3423
labels:
3524
org.fiware: 'tutorial'
36-
image: bitnami/kafka
37-
hostname: kafka
38-
container_name: kafka
25+
image: quay.io/fiware/scorpio:java-${SCORPIO_VERSION}
26+
hostname: scorpio
27+
container_name: fiware-scorpio
3928
networks:
4029
- default
4130
ports:
42-
- "9092"
43-
environment:
44-
KAFKA_ADVERTISED_HOST_NAME: kafka
45-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
46-
KAFKA_ADVERTISED_PORT: 9092
47-
KAFKA_LOG_RETENTION_MS: 10000
48-
KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS: 5000
49-
ALLOW_PLAINTEXT_LISTENER: "yes"
50-
volumes:
51-
- /var/run/docker.sock:/var/run/docker.sock
31+
- "${EXPOSED_PORT}:${SCORPIO_PORT}"
5232
depends_on:
53-
- zookeeper
54-
logging:
55-
driver: none
33+
- postgres
5634
postgres:
5735
labels:
5836
org.fiware: 'tutorial'
@@ -69,29 +47,10 @@ services:
6947
POSTGRES_DB: ngb
7048
logging:
7149
driver: none
72-
scorpio:
73-
labels:
74-
org.fiware: 'tutorial'
75-
image: scorpiobroker/all-in-one-runner:java-kafka-${SCORPIO_VERSION}
76-
hostname: scorpio
77-
container_name: fiware-scorpio
78-
networks:
79-
- default
80-
ports:
81-
- "${SCORPIO_PORT}:9090"
82-
depends_on:
83-
- postgres
84-
- kafka
8550

86-
# Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Scorpio Broker
8751
tutorial:
8852
environment:
89-
- IOTA_DEFAULT_RESOURCE=/iot/d
90-
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
91-
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
92-
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
93-
- CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context
94-
53+
- "CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}/ngsi-ld/v1" # URL of the context broker to update context
9554

9655
networks:
9756
default:

services

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ waitForScorpio () {
5858
while [ "${response}" -eq 000 ]
5959
do
6060
echo -e "Context Broker HTTP state: ${response} (waiting for 404)"
61-
pause 60
61+
pause 6
6262
getHeartbeat "${SCORPIO}"
6363
done
6464
}
@@ -123,15 +123,15 @@ loadData () {
123123

124124
addDatabaseIndex () {
125125
printf "Adding appropriate \033[1mMongoDB\033[0m indexes for \033[1;34mOrion\033[0m ..."
126-
docker exec db-mongo mongo --eval '
126+
docker exec db-mongo mongo --eval '
127127
conn = new Mongo();db.createCollection("orion");
128128
db = conn.getDB("orion");
129129
db.createCollection("entities");
130130
db.entities.createIndex({"_id.servicePath": 1, "_id.id": 1, "_id.type": 1}, {unique: true});
131131
db.entities.createIndex({"_id.type": 1});
132132
db.entities.createIndex({"_id.id": 1});' > /dev/null
133133

134-
docker exec db-mongo mongo --eval '
134+
docker exec db-mongo mongo --eval '
135135
conn = new Mongo();db.createCollection("orion-openiot");
136136
db = conn.getDB("orion-openiot");
137137
db.createCollection("entities");
@@ -190,7 +190,7 @@ case "${command}" in
190190
echo -e "- \033[1;34mScorpio\033[0m is the context broker"
191191
echo -e "- Data models \033[1m@context\033[0m (Smart Supermarket) is supplied externally"
192192
echo ""
193-
${dockerCmd} -f docker-compose/common.yml -f docker-compose/scorpio-aaio.yml up -d --remove-orphans --renew-anon-volumes
193+
${dockerCmd} -f docker-compose/common.yml -f docker-compose/scorpio.yml up -d --remove-orphans --renew-anon-volumes
194194
waitForMongo
195195
waitForScorpio
196196
export CONTEXT_BROKER=scorpio:9090
@@ -224,7 +224,7 @@ case "${command}" in
224224
export $(cat .env | grep "#" -v)
225225
echo "Pulling Docker images"
226226
docker pull -q quay.io/curl/curl
227-
${dockerCmd} -f docker-compose/common.yml -f docker-compose/scorpio-aaio.yml -f docker-compose/orion-ld.yml -f docker-compose/stellio.yml pull
227+
${dockerCmd} -f docker-compose/common.yml -f docker-compose/scorpio.yml -f docker-compose/orion-ld.yml -f docker-compose/stellio.yml pull
228228
;;
229229
*)
230230
echo "Command not Found."

0 commit comments

Comments
 (0)