Skip to content

Commit 8ae1832

Browse files
committed
Split tutorial out from Orion-LD, Scorpio and Stellio
1 parent 76dad8f commit 8ae1832

6 files changed

Lines changed: 311 additions & 190 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ORION_LD_VERSION=0.8.2
77

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

1212
# Stellio variables
1313
STELLIO_DOCKER_TAG=latest

docker-compose/common.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# WARNING: Do not deploy this tutorial configuration directly to a production environment
2+
#
3+
# The tutorial docker-compose files have not been written for production deployment and will not
4+
# scale. A proper architecture has been sacrificed to keep the narrative focused on the learning
5+
# goals, they are just used to deploy everything onto a single Docker machine. All FIWARE components
6+
# are running at full debug and extra ports have been exposed to allow for direct calls to services.
7+
# They also contain various obvious security flaws - passwords in plain text, no load balancing,
8+
# no use of HTTPS and so on.
9+
#
10+
# This is all to avoid the need of multiple machines, generating certificates, encrypting secrets
11+
# and so on, purely so that a single docker-compose file can be read as an example to build on,
12+
# not use directly.
13+
#
14+
# When deploying to a production environment, please refer to the Helm Repository
15+
# for FIWARE Components in order to scale up to a proper architecture:
16+
#
17+
# see: https://github.com/FIWARE/helm-charts/
18+
#
19+
version: "3.5"
20+
services:
21+
# Databases
22+
mongo-db:
23+
image: mongo:${MONGO_DB_VERSION}
24+
hostname: mongo-db
25+
container_name: db-mongo
26+
expose:
27+
- "${MONGO_DB_PORT}"
28+
ports:
29+
- "${MONGO_DB_PORT}:${MONGO_DB_PORT}" # localhost:27017
30+
networks:
31+
- default
32+
command: --nojournal
33+
volumes:
34+
- mongo-db:/data
35+
healthcheck:
36+
test: |
37+
host=`hostname --ip-address || echo '127.0.0.1'`;
38+
mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
39+
interval: 5s
40+
41+
42+
43+
# Tutorial displays a web app to manipulate the context directly
44+
tutorial:
45+
image: fiware/tutorials.context-provider
46+
hostname: tutorial
47+
container_name: fiware-tutorial
48+
depends_on:
49+
- orion
50+
networks:
51+
default:
52+
aliases:
53+
- iot-sensors
54+
- context-provider
55+
expose:
56+
- "${TUTORIAL_APP_PORT}" # localhost:3000
57+
- "${TUTORIAL_DUMMY_DEVICE_PORT}" # localhost:3001
58+
ports:
59+
- "${TUTORIAL_APP_PORT}:${TUTORIAL_APP_PORT}" # localhost:3000
60+
- "${TUTORIAL_DUMMY_DEVICE_PORT}:${TUTORIAL_DUMMY_DEVICE_PORT}" # localhost:3001
61+
environment:
62+
- "MONGO_URL=mongodb://mongo-db:27017"
63+
- "DEBUG=tutorial:*"
64+
- "WEB_APP_PORT=${TUTORIAL_APP_PORT}" # Port used by the content provider proxy and web-app for viewing data
65+
- "NGSI_VERSION=ngsi-ld"
66+
- "CONTEXT_BROKER=http://orion:${ORION_LD_PORT}/ngsi-ld/v1" # URL of the context broker to update context
67+
- "DEVICE_BROKER=http://devices:${ORION_EDGE_PORT}/v2" # URL of the device's context broker to update context
68+
- "NGSI_LD_PREFIX=urn:ngsi-ld:"
69+
70+
- "IOTA_HTTP_HOST=iot-agent"
71+
- "IOTA_HTTP_PORT=${IOTA_SOUTH_PORT}"
72+
- "DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT}" # Port used by the dummy IOT devices to receive commands
73+
- "DUMMY_DEVICES_TRANSPORT=HTTP" # Default transport used by dummy Io devices
74+
75+
- "OPENWEATHERMAP_KEY_ID=<ADD_YOUR_KEY_ID>"
76+
- "TWITTER_CONSUMER_KEY=<ADD_YOUR_CONSUMER_KEY>"
77+
- "TWITTER_CONSUMER_SECRET=<ADD_YOUR_CONSUMER_SECRET>"
78+
79+
80+
81+
networks:
82+
default: ~
83+
84+
volumes:
85+
mongo-db: ~

docker-compose/orion-ld.yml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,13 @@ services:
3434
test: curl --fail -s http://orion:${ORION_LD_PORT}/version || exit 1
3535
interval: 5s
3636

37+
38+
# Tutorial acts as a series of dummy IoT Sensors over HTTP and connects to the Orion-LD Broker
39+
tutorial:
40+
environment:
41+
- IOTA_DEFAULT_RESOURCE=/iot/d
42+
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
43+
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
44+
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
45+
- CONTEXT_BROKER=http://orion:${ORION_LD_PORT}/ngsi-ld/v1 # URL of the context broker to update context
3746

38-
# Databases
39-
mongo-db:
40-
image: mongo:${MONGO_DB_VERSION}
41-
hostname: mongo-db
42-
container_name: db-mongo
43-
expose:
44-
- "${MONGO_DB_PORT}"
45-
ports:
46-
- "${MONGO_DB_PORT}:${MONGO_DB_PORT}" # localhost:27017
47-
networks:
48-
- default
49-
command: --nojournal
50-
volumes:
51-
- mongo-db:/data
52-
healthcheck:
53-
test: |
54-
host=`hostname --ip-address || echo '127.0.0.1'`;
55-
mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
56-
interval: 5s
57-
58-
59-
networks:
60-
default:
61-
ipam:
62-
config:
63-
- subnet: 172.18.1.0/24
64-
65-
volumes:
66-
mongo-db: ~

docker-compose/scorpio-aaio.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,22 @@ services:
6868
depends_on:
6969
- kafka
7070
- postgres
71-
healthcheck:
72-
test: curl --fail -s http://scorpio:${SCORPIO_PORT}/scorpio/v1/info/ || exit 1
71+
#healthcheck:
72+
# test: curl --fail -s http://scorpio:${SCORPIO_PORT}/scorpio/v1/info/ || exit 1
73+
deploy:
74+
resources:
75+
limits:
76+
cpus: '0.8'
77+
memory: 640M
78+
reservations:
79+
cpus: '0.6'
80+
memory: 480M
7381

74-
networks:
75-
default: ~
82+
# Tutorial connects to the Scorpio Broker
83+
tutorial:
84+
environment:
85+
- IOTA_DEFAULT_RESOURCE=/iot/d
86+
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
87+
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
88+
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
89+
- CONTEXT_BROKER=http://scorpio:${SCORPIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context

docker-compose/stellio.yml

Lines changed: 65 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,18 @@
1-
# WARNING: Do not deploy this tutorial configuration directly to a production environment
2-
#
3-
# The tutorial docker-compose files have not been written for production deployment and will not
4-
# scale. A proper architecture has been sacrificed to keep the narrative focused on the learning
5-
# goals, they are just used to deploy everything onto a single Docker machine. All FIWARE components
6-
# are running at full debug and extra ports have been exposed to allow for direct calls to services.
7-
# They also contain various obvious security flaws - passwords in plain text, no load balancing,
8-
# no use of HTTPS and so on.
9-
#
10-
# This is all to avoid the need of multiple machines, generating certificates, encrypting secrets
11-
# and so on, purely so that a single docker-compose file can be read as an example to build on,
12-
# not use directly.
13-
#
14-
# When deploying to a production environment, please refer to the Helm Repository
15-
# for FIWARE Components in order to scale up to a proper architecture:
16-
#
17-
# see: https://github.com/FIWARE/helm-charts/
18-
#
19-
version: "3.5"
1+
version: '3.5'
202
services:
21-
223
zookeeper:
234
image: confluentinc/cp-zookeeper:5.4.1
24-
container_name: stellio-zookeeper
5+
container_name: zookeeper
256
ports:
267
- 2181:2181
278
environment:
289
ZOOKEEPER_SERVER_ID: 1
2910
ZOOKEEPER_CLIENT_PORT: 2181
3011
ZOOKEEPER_TICK_TIME: 2000
12+
3113
kafka:
3214
image: confluentinc/cp-kafka:5.4.1
33-
container_name: stellio-kafka
15+
container_name: kafka
3416
ports:
3517
- 29092:29092
3618
environment:
@@ -43,86 +25,99 @@ services:
4325
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
4426
depends_on:
4527
- zookeeper
46-
neo4j:
47-
image: neo4j:4.0
48-
container_name: stellio-neo4j
49-
volumes:
50-
- stellio-neo4j-storage:/data
51-
environment:
52-
- NEO4J_dbms_allow__upgrade=${NEO4J_ALLOW_UPGRADE}
53-
- NEO4J_dbms_default__database=${NEO4J_DEFAULT_DATABASE}
54-
- NEO4J_AUTH=neo4j/${NEO4J_PASSWORD}
55-
- "NEO4J_dbms_security_procedures_unrestricted=apoc.*"
56-
- "NEO4J_dbms_security_procedures_whitelist=apoc.*"
57-
- NEO4JLABS_PLUGINS=["apoc"]
58-
ports:
59-
- 7474:7474
60-
- 7687:7687
61-
postgres:
62-
image: stellio/stellio-timescale-postgis:1.7.2-pg11
63-
container_name: stellio-postgres
64-
environment:
65-
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
66-
- "POSTGRES_MULTIPLE_DATABASES=${STELLIO_SEARCH_DB_DATABASE},${STELLIO_SEARCH_DB_USER},${STELLIO_SEARCH_DB_PASSWORD}: ${STELLIO_SUBSCRIPTION_DB_DATABASE},${STELLIO_SUBSCRIPTION_DB_USER},${STELLIO_SUBSCRIPTION_DB_PASSWORD}"
67-
# not sure it is really necessary but it does not break anything ...
68-
- PGDATA=/var/lib/postgresql/data/pgdata
69-
ports:
70-
- 5432:5432
71-
volumes:
72-
- stellio-postgres-storage:/var/lib/postgresql/data
28+
7329
api-gateway:
7430
container_name: stellio-api-gateway
31+
hostname: stellio
7532
image: stellio/stellio-api-gateway:${STELLIO_DOCKER_TAG}
7633
environment:
77-
- SPRING_PROFILES_ACTIVE=${ENVIRONMENT}
34+
- SPRING_PROFILES_ACTIVE=docker
7835
ports:
79-
- 8080:8080
36+
- "${STELLIO_PORT}:8080"
37+
8038
entity-service:
8139
container_name: stellio-entity-service
8240
image: stellio/stellio-entity-service:${STELLIO_DOCKER_TAG}
8341
environment:
84-
- SPRING_DATA_NEO4J_PASSWORD=${NEO4J_PASSWORD}
85-
- SPRING_PROFILES_ACTIVE=${ENVIRONMENT}
86-
- APPLICATION_AUTHENTICATION_ENABLED=${STELLIO_AUTHENTICATION_ENABLED}
42+
- SPRING_PROFILES_ACTIVE=docker
43+
- APPLICATION_AUTHENTICATION_ENABLED=false
8744
ports:
8845
- 8082:8082
8946
depends_on:
9047
- neo4j
9148
- kafka
49+
9250
search-service:
9351
container_name: stellio-search-service
9452
image: stellio/stellio-search-service:${STELLIO_DOCKER_TAG}
9553
environment:
96-
- SPRING_PROFILES_ACTIVE=${ENVIRONMENT}
97-
- SPRING_R2DBC_URL=r2dbc:postgresql://postgres/${STELLIO_SEARCH_DB_DATABASE}
98-
- SPRING_FLYWAY_URL=jdbc:postgresql://postgres/${STELLIO_SEARCH_DB_DATABASE}
99-
- SPRING_R2DBC_USERNAME=${STELLIO_SEARCH_DB_USER}
100-
- SPRING_R2DBC_PASSWORD=${STELLIO_SEARCH_DB_PASSWORD}
101-
- APPLICATION_AUTHENTICATION_ENABLED=${STELLIO_AUTHENTICATION_ENABLED}
54+
- SPRING_PROFILES_ACTIVE=docker
55+
- SPRING_R2DBC_URL=r2dbc:postgresql://postgres/stellio_search
56+
- SPRING_FLYWAY_URL=jdbc:postgresql://postgres/stellio_search
57+
- SPRING_R2DBC_USERNAME=stellio_search
58+
- SPRING_R2DBC_PASSWORD=stellio_search_db_password
59+
- APPLICATION_AUTHENTICATION_ENABLED=false
10260
ports:
10361
- 8083:8083
10462
depends_on:
10563
- postgres
10664
- kafka
65+
10766
subscription-service:
10867
container_name: stellio-subscription-service
10968
image: stellio/stellio-subscription-service:${STELLIO_DOCKER_TAG}
11069
environment:
111-
- SPRING_PROFILES_ACTIVE=${ENVIRONMENT}
112-
- SPRING_R2DBC_URL=r2dbc:postgresql://postgres/${STELLIO_SUBSCRIPTION_DB_DATABASE}
113-
- SPRING_FLYWAY_URL=jdbc:postgresql://postgres/${STELLIO_SUBSCRIPTION_DB_DATABASE}
114-
- SPRING_R2DBC_USERNAME=${STELLIO_SUBSCRIPTION_DB_USER}
115-
- SPRING_R2DBC_PASSWORD=${STELLIO_SUBSCRIPTION_DB_PASSWORD}
116-
- APPLICATION_AUTHENTICATION_ENABLED=${STELLIO_AUTHENTICATION_ENABLED}
70+
- SPRING_PROFILES_ACTIVE=docker
71+
- SPRING_R2DBC_URL=r2dbc:postgresql://postgres/stellio_subscription
72+
- SPRING_FLYWAY_URL=jdbc:postgresql://postgres/stellio_subscription
73+
- SPRING_R2DBC_USERNAME=stellio_subscription
74+
- SPRING_R2DBC_PASSWORD=stellio_subscription_db_password
75+
- APPLICATION_AUTHENTICATION_ENABLED=false
11776
ports:
11877
- 8084:8084
11978
depends_on:
12079
- postgres
12180
- kafka
12281

123-
networks:
124-
default: ~
82+
# Databases
83+
neo4j:
84+
image: neo4j:4.2
85+
hostname: neo4j
86+
container_name: db-neo4j
87+
volumes:
88+
- neo4j-db:/data
89+
environment:
90+
- NEO4J_dbms_default__database=stellio
91+
- NEO4J_AUTH=none
92+
- "NEO4J_dbms_security_procedures_unrestricted=apoc.*"
93+
- "NEO4J_dbms_security_procedures_allowlist=apoc.*"
94+
- NEO4JLABS_PLUGINS=["apoc"]
95+
ports:
96+
- 7474:7474
97+
- 7687:7687
98+
99+
postgres:
100+
image: stellio/stellio-timescale-postgis:2.3.0-pg13
101+
hostname: postgres
102+
container_name: db-postgres
103+
environment:
104+
- POSTGRES_PASSWORD=password
105+
- "POSTGRES_MULTIPLE_DATABASES=stellio_search,stellio_search,stellio_search_db_password: stellio_subscription,stellio_subscription,stellio_subscription_db_password"
106+
- PGDATA=/var/lib/postgresql/data/pgdata
107+
ports:
108+
- 5432:5432
109+
volumes:
110+
- postgres-db:/var/lib/postgresql/data
125111

112+
# Tutorial connects to the Stellio Broker
113+
tutorial:
114+
environment:
115+
- IOTA_DEFAULT_RESOURCE=/iot/d
116+
- DUMMY_DEVICES_PORT=${TUTORIAL_DUMMY_DEVICE_PORT} # Port used by the dummy IOT devices to receive commands
117+
- DUMMY_DEVICES_TRANSPORT=HTTP # Default transport used by dummy Io devices
118+
- DUMMY_DEVICES_PAYLOAD=ULTRALIGHT
119+
- CONTEXT_BROKER=http://api-gateway:${STELLIO_PORT}/ngsi-ld/v1 # URL of the context broker to update context
120+
126121
volumes:
127-
stellio-neo4j-storage: ~
128-
stellio-postgres-storage: ~
122+
neo4j-db: ~
123+
postgres-db: ~

0 commit comments

Comments
 (0)