Skip to content

Commit 4ac5ecf

Browse files
committed
Update Scorpio and Stellio
1 parent ed6cf86 commit 4ac5ecf

4 files changed

Lines changed: 102 additions & 68 deletions

File tree

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ ORION_LD_VERSION=1.1.0-PRE-697
77

88
# Scorpio variables
99
SCORPIO_PORT=9090
10-
SCORPIO_VERSION=1.1.0
10+
SCORPIO_VERSION=2.1.13
1111

1212
# Stellio variables
13-
STELLIO_DOCKER_TAG=v1.7.2
13+
STELLIO_DOCKER_TAG=v1.8.0
1414
STELLIO_PORT=8080
1515

1616
# MongoDB variables

docker-compose/scorpio-aaio.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
#
1717
# see: https://github.com/FIWARE/helm-charts/
1818
#
19-
version: "3.8"
19+
version: "3.9"
2020

2121
services:
22-
2322
zookeeper:
2423
labels:
2524
org.fiware: 'tutorial'
@@ -30,10 +29,12 @@ services:
3029
- default
3130
ports:
3231
- "2181"
32+
logging:
33+
driver: none
3334
kafka:
3435
labels:
3536
org.fiware: 'tutorial'
36-
image: wurstmeister/kafka
37+
image: bitnami/kafka
3738
hostname: kafka
3839
container_name: kafka
3940
networks:
@@ -44,15 +45,19 @@ services:
4445
KAFKA_ADVERTISED_HOST_NAME: kafka
4546
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
4647
KAFKA_ADVERTISED_PORT: 9092
48+
KAFKA_LOG_RETENTION_MS: 10000
49+
KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS: 5000
50+
ALLOW_PLAINTEXT_LISTENER: "yes"
4751
volumes:
4852
- /var/run/docker.sock:/var/run/docker.sock
4953
depends_on:
5054
- zookeeper
51-
55+
logging:
56+
driver: none
5257
postgres:
5358
labels:
5459
org.fiware: 'tutorial'
55-
image: mdillon/postgis
60+
image: postgis/postgis
5661
hostname: postgres
5762
container_name: db-postgres
5863
networks:
@@ -63,30 +68,21 @@ services:
6368
POSTGRES_USER: ngb
6469
POSTGRES_PASSWORD: ngb
6570
POSTGRES_DB: ngb
66-
71+
logging:
72+
driver: none
6773
scorpio:
6874
labels:
6975
org.fiware: 'tutorial'
70-
image: scorpiobroker/scorpio:scorpio-aaio_${SCORPIO_VERSION}
76+
image: scorpiobroker/scorpio:scorpio-aaio-no-eureka_${SCORPIO_VERSION}
7177
hostname: scorpio
7278
container_name: fiware-scorpio
7379
networks:
7480
- default
7581
ports:
7682
- "${SCORPIO_PORT}:9090"
7783
depends_on:
78-
- kafka
7984
- postgres
80-
#healthcheck:
81-
# test: curl --fail -s http://scorpio:${SCORPIO_PORT}/scorpio/v1/info/ || exit 1
82-
deploy:
83-
resources:
84-
limits:
85-
cpus: '0.8'
86-
memory: 640M
87-
reservations:
88-
cpus: '0.6'
89-
memory: 480M
85+
- kafka
9086

9187
# IoT-Agent connects to the Scorpio Broker
9288
iot-agent:

docker-compose/stellio.yml

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,5 @@
1-
version: '3.5'
1+
version: '3.9'
22
services:
3-
zookeeper:
4-
image: confluentinc/cp-zookeeper:5.4.1
5-
container_name: zookeeper
6-
ports:
7-
- 2181:2181
8-
environment:
9-
ZOOKEEPER_SERVER_ID: 1
10-
ZOOKEEPER_CLIENT_PORT: 2181
11-
ZOOKEEPER_TICK_TIME: 2000
12-
13-
kafka:
14-
image: confluentinc/cp-kafka:5.4.1
15-
container_name: kafka
16-
ports:
17-
- 29092:29092
18-
environment:
19-
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:29092
20-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
21-
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
22-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
23-
KAFKA_BROKER_ID: 1
24-
KAFKA_LOG4J_ROOT_LOGLEVEL: INFO
25-
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
26-
depends_on:
27-
- zookeeper
28-
293
api-gateway:
304
container_name: stellio-api-gateway
315
hostname: stellio
@@ -38,6 +12,7 @@ services:
3812
- "${STELLIO_PORT}:8080"
3913

4014
entity-service:
15+
restart: always
4116
container_name: stellio-entity-service
4217
labels:
4318
org.fiware: 'tutorial'
@@ -48,8 +23,10 @@ services:
4823
ports:
4924
- 8082:8082
5025
depends_on:
51-
- neo4j
52-
- kafka
26+
neo4j:
27+
condition: service_healthy
28+
kafka:
29+
condition: service_started
5330

5431
search-service:
5532
container_name: stellio-search-service
@@ -66,8 +43,10 @@ services:
6643
ports:
6744
- 8083:8083
6845
depends_on:
69-
- postgres
70-
- kafka
46+
postgres:
47+
condition: service_healthy
48+
kafka:
49+
condition: service_started
7150

7251
subscription-service:
7352
container_name: stellio-subscription-service
@@ -84,12 +63,50 @@ services:
8463
ports:
8564
- 8084:8084
8665
depends_on:
87-
- postgres
88-
- kafka
66+
postgres:
67+
condition: service_healthy
68+
kafka:
69+
condition: service_started
70+
71+
zookeeper:
72+
labels:
73+
org.fiware: 'tutorial'
74+
image: confluentinc/cp-zookeeper:5.5.7
75+
container_name: zookeeper
76+
ports:
77+
- 2181:2181
78+
restart: always
79+
environment:
80+
ZOOKEEPER_SERVER_ID: 1
81+
ZOOKEEPER_CLIENT_PORT: 2181
82+
ZOOKEEPER_TICK_TIME: 2000
83+
84+
kafka:
85+
labels:
86+
org.fiware: 'tutorial'
87+
image: confluentinc/cp-kafka:5.5.7
88+
container_name: kafka
89+
ports:
90+
- 29092:29092
91+
restart: always
92+
environment:
93+
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:29092
94+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
95+
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
96+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
97+
KAFKA_BROKER_ID: 1
98+
KAFKA_LOG4J_ROOT_LOGLEVEL: INFO
99+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
100+
depends_on:
101+
- zookeeper
102+
103+
89104

90105
# Databases
91106
neo4j:
92-
image: neo4j:4.2
107+
labels:
108+
org.fiware: 'tutorial'
109+
image: neo4j:4.4
93110
hostname: neo4j
94111
container_name: db-neo4j
95112
volumes:
@@ -103,6 +120,13 @@ services:
103120
ports:
104121
- 7474:7474
105122
- 7687:7687
123+
# following https://github.com/neo4j/neo4j/issues/7203#issuecomment-898511474
124+
healthcheck:
125+
test: wget -qO- http://localhost:7474 || exit 1
126+
interval: 1s
127+
timeout: 10s
128+
retries: 20
129+
start_period: 3s
106130

107131
postgres:
108132
labels:
@@ -118,7 +142,12 @@ services:
118142
- 5432:5432
119143
volumes:
120144
- postgres-db:/var/lib/postgresql/data
121-
145+
healthcheck:
146+
test: ["CMD-SHELL", "pg_isready -U postgres"]
147+
interval: 10s
148+
timeout: 5s
149+
retries: 20
150+
start_period: 10s
122151

123152
# IoT-Agent connects to the Stellio Broker
124153
iot-agent:
@@ -134,7 +163,7 @@ services:
134163
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
135164
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
136165
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
137-
- CONTEXT_BROKER=http://api-gateway:${STELLIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context
166+
- CONTEXT_BROKER=http://stellio:${STELLIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context
138167

139168
volumes:
140169
neo4j-db: ~

services

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
set -e
88

9-
SCORPIO="http://scorpio:9090/scorpio/v1/info/"
9+
STELLIO="http://stellio:8080/actuator/health"
10+
SCORPIO="http://scorpio:9090/scorpio/"
1011
ORION="http://orion:1026/version"
1112
CONTEXT="http://context/ngsi-context.jsonld"
1213

@@ -17,7 +18,7 @@ fi
1718

1819
if (( $# < 1 )); then
1920
echo "Illegal number of parameters"
20-
echo "usage: services [create|orion|scorpio|stop]"
21+
echo "usage: services [create|orion|scorpio|stellio|stop]"
2122
exit 1
2223
fi
2324

@@ -58,13 +59,6 @@ waitForScorpio () {
5859
pause 60
5960
getHeartbeat "${SCORPIO}"
6061
done
61-
echo -e "\n⏳ Waiting for all \033[1;34mScorpio\033[0m services to be fully available\n"
62-
while [ "$response" -eq 500 ]
63-
do
64-
echo -e "Context Broker HTTP state: ${response} (waiting for 200)"
65-
pause 60
66-
getHeartbeat "${SCORPIO}"
67-
done
6862
}
6963

7064
waitForStellio () {
@@ -220,9 +214,9 @@ addIoTDatabaseIndex () {
220214
command="$1"
221215
case "${command}" in
222216
"help")
223-
echo "usage: services [create|orion|scorpio|stop]"
217+
echo "usage: services [create|orion|scorpio|stellio|stop]"
224218
;;
225-
"orion")
219+
"orion")
226220
export $(cat .env | grep "#" -v)
227221
stoppingContainers
228222
echo -e "Starting containers: \033[1;34mOrion\033[0m, \033[1;36mIoT-Agent\033[0m, \033[1mTutorial\033[0m, a linked data \033[1mContext\033[0m and \033[1mMongoDB\033[0m databases."
@@ -253,6 +247,21 @@ case "${command}" in
253247
displayServices
254248
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
255249
;;
250+
"stellio")
251+
export $(cat .env | grep "#" -v)
252+
stoppingContainers
253+
echo -e "Starting containers: \033[1;34mStellio\033[0m, \033[1mKafka\033[0m, \033[1mZookeeper\033[0m and a \033[1mPostgres\033[0m database and a \033[1mNeo4J\033[0m database, \033[1;36mIoT-Agent\033[0m, \033[1mTutorial\033[0m, a linked data \033[1mContext\033[0m and \033[1mMongoDB\033[0m databases."
254+
echo -e "- \033[1;Stellio\033[0m is the context broker"
255+
echo ""
256+
${dockerCmd} -f docker-compose/common.yml -f docker-compose/stellio.yml -p fiware up -d --remove-orphans --renew-anon-volumes
257+
waitForMongo
258+
addIoTDatabaseIndex
259+
waitForContext
260+
waitForStellio
261+
loadData stellio:8080
262+
displayServices
263+
echo -e "Now open \033[4mhttp://localhost:3000/device/monitor\033[0m"
264+
;;
256265
"stop")
257266
export $(cat .env | grep "#" -v)
258267
stoppingContainers
@@ -269,7 +278,7 @@ case "${command}" in
269278
;;
270279
*)
271280
echo "Command not Found."
272-
echo "usage: services [create|orion|scorpio|stop]"
281+
echo "usage: services [create|orion|scorpio|stellio|stop]"
273282
exit 127;
274283
;;
275284
esac

0 commit comments

Comments
 (0)