Skip to content

Commit 06d125b

Browse files
Merge pull request #3 from qiot-project/v2
V2
2 parents a4b0d23 + e749548 commit 06d125b

File tree

17 files changed

+479
-343
lines changed

17 files changed

+479
-343
lines changed

README.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
## qiot-datahub-docker
22

33
A set od docker-compose files to run the QIoT environment on your host machine using a OCI-compliant container engine and tools.
4-
Podman engine is recommendedthus you'll find below the prerequisited and mandatory actions to take before using these compose files:
4+
Podman engine is recommended, thus you'll find below the prerequisites and mandatory actions to take before using these compose files:
55

66
# if you want to go with podman:
77

88
`$ sudo dnf install -y podman podman-compose`
99

1010
# Set up a dedicated container network for both your edge pods and datahub pods
1111

12-
1312
`$ sudo docker network create edge` - Network dedicated to the services running on the edge device
1413
/etc/cni/net.d/qiot-covid19-edge.conflist
1514

16-
`$ sudo podman network create datahub` - Network dedicated to the services running on the datacenter
15+
`$ sudo docker network create datahub` - Network dedicated to the services running on the datacenter
1716
/etc/cni/net.d/qiot-covid19-datahub.conflist
1817

1918
`$ sudo docker network create qiotconnect` - Network dedicated to the interaction between the edge device and the datahub
@@ -33,7 +32,7 @@ Podman: Podman Cockpit extension
3332

3433
We can edit the `/etc/selinux/config` text file with our persistent setting, either enforcing, permissive, or disabled. By default this file appears as shown below.
3534

36-
```
35+
```properties
3736
This file controls the state of SELinux on the system.
3837
SELINUX= can take one of these three values:
3938
enforcing - SELinux security policy is enforced.
@@ -47,4 +46,55 @@ ELINUXTYPE= can take one of three two values:
4746
SELINUXTYPE=targeted
4847
```
4948

50-
We can simply edit the SELINUX variable between enforcing, permissive, or disabled, as outlined in the comments of the file. After editing the file the changes will not be in place immediately and will only change after system reboot.
49+
We can simply edit the SELINUX variable between enforcing, permissive, or disabled, as outlined in the comments of the file. After editing the file the changes will not be in place immediately and will only change after system reboot.
50+
51+
# The QIoT-covid19 system
52+
53+
The QIoT covid19 use-case implementation is made up of 3 main layers:
54+
55+
- **comp**: the software infrastructure, composite of integration products to make micro-services interact with each other and to manage endpoints and data
56+
- **datahub**: micro-services implementing the use-case business logic
57+
- **edge**: software running at the edge device
58+
- **sensors**: a micro-service emulating the behavior of the sensor board connected to the raspberry pi
59+
- **edge**: the micro-service implementing the edge device business logic
60+
61+
## Spinning up the environment
62+
63+
Just enter each and every folder and run a docker compose or, alternatively, use Portainer.io to manage your stacks.
64+
65+
Please follow the order below to make sure all the components are capable to find their dependencies accordingly:
66+
67+
### software architecture
68+
69+
```bash
70+
$ cd comp
71+
$ docker-compose up --remove-orphans
72+
```
73+
74+
​ access the mysql instance and execute the script contained in the file *mysql-setup.sql*:
75+
76+
77+
```bash
78+
$ docker exec -it mysql bash -l
79+
```
80+
81+
### business logic
82+
83+
```bash
84+
$ cd datahub
85+
$ docker-compose up --remove-orphans
86+
```
87+
88+
### edge device - sensors
89+
90+
```bash
91+
$ cd edge/sensors
92+
$ docker-compose up --remove-orphans
93+
```
94+
95+
### edge device - business logic
96+
97+
```bash
98+
$ cd edge/application
99+
$ docker-compose up --remove-orphans
100+
```

buildQiot.sh

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-storer/qiot-datahub-storer-gas/
1+
cd ~/git/qiot/datahub/qiot-datahub-localization/
22
chmod +x build.sh
33
./build.sh
4-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-storer/qiot-datahub-storer-pollution/
4+
cd ~/git/qiot/datahub/qiot-datahub-station/
55
chmod +x build.sh
66
./build.sh
7-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-aggregation/
7+
cd ~/git/qiot/datahub/qiot-datahub-registration/
88
chmod +x build.sh
99
./build.sh
10-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-query/
10+
cd ~/git/qiot/datahub/qiot-datahub-collector/
11+
chmod +x build*.sh
12+
./buildgas.sh
13+
./buildpollution.sh
14+
cd ~/git/qiot/datahub/qiot-datahub-storer/
15+
chmod +x build*.sh
16+
./buildgas.jvm.sh
17+
./buildpollution.jvm.sh
18+
cd ~/git/qiot/datahub/qiot-datahub-importer/
1119
chmod +x build.sh
1220
./build.sh
13-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-importer/
14-
chmod +x build.sh
15-
./build.sh
16-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-registration/
17-
chmod +x build.sh
18-
./build.sh
19-
cd /home/abattagl/git/qiot/datahub/qiot-datahub-endpoint/qiot-datahub-endpoint-mqtt/
20-
chmod +x build.sh
21-
./build.sh
22-
#cd /home/abattagl/git/qiot/edge/qiot-sensors-emulator/
21+
#cd ~/git/qiot/edge/qiot-sensors-emulator/
2322
#chmod +x build.sh
2423
#./build.sh
25-
#cd /home/abattagl/git/qiot/edge/qiot-service/
24+
#cd ~/git/qiot/edge/qiot-service/
2625
#chmod +x build.sh
2726
#./build.sh
2827

comp/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
/volumes/

comp/docker-compose.yaml

Lines changed: 69 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,95 @@
11
version: '3'
22
services:
3-
activemq:
4-
image: vromero/activemq-artemis:2-alpine-latest
5-
container_name: "activemq"
6-
restart: "no"
3+
4+
mosquitto:
5+
image: eclipse-mosquitto:1.6.2
6+
container_name: "mosquitto"
7+
restart: "always"
78
networks:
89
- datahub
910
- qiotconnect
1011
ports:
11-
- "8161:8161"
12-
# - "61616:61616"
13-
# - "5672:5672"
14-
- "1883:1883"
15-
environment:
16-
ARTEMIS_USERNAME: "quarkus"
17-
ARTEMIS_PASSWORD: "quarkus"
18-
# kafdrop:
19-
# image: obsidiandynamics/kafdrop
20-
# container_name: "kafkadrop"
21-
# restart: "no"
22-
# ports:
23-
# - "9000:9000"
24-
# environment:
25-
# KAFKA_BROKERCONNECT: "kafka:29092"
26-
# JVM_OPTS: "-Xms16M -Xmx48M -Xss180K -XX:-TieredCompilation -XX:+UseStringDeduplication -noverify"
27-
# depends_on:
28-
# - "kafka"
12+
- "1883:1883"
13+
- "9001:9001"
14+
2915
kafka:
3016
image: obsidiandynamics/kafka
3117
container_name: "kafka"
32-
restart: "no"
18+
restart: "always"
3319
ports:
3420
- "2181:2181"
3521
- "9092:9092"
3622
environment:
37-
KAFKA_LISTENERS: "INTERNAL://:29092,EXTERNAL://kafka:9092"
23+
KAFKA_LISTENERS: "INTERNAL://:29092,EXTERNAL://:9092"
3824
KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:29092,EXTERNAL://kafka:9092"
3925
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT"
4026
KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL"
4127
KAFKA_ZOOKEEPER_SESSION_TIMEOUT: "6000"
4228
KAFKA_RESTART_ATTEMPTS: "10"
4329
KAFKA_RESTART_DELAY: "5"
4430
ZOOKEEPER_AUTOPURGE_PURGE_INTERVAL: "0"
45-
mongo:
46-
image: "mongo"
47-
container_name: "mongo"
31+
32+
postgresql:
33+
image: postgres
34+
container_name: "postgresql"
35+
restart: always
36+
ports:
37+
- "5432:5432"
38+
volumes:
39+
- postgres-storage:/var/lib/postgresql/data
4840
environment:
49-
MONGO_INITDB_DATABASE: "qiot"
50-
#MONGO_INITDB_ROOT_USERNAME: "root"
51-
#MONGO_INITDB_ROOT_PASSWORD: "root"
41+
POSTGRES_USER: "qiot"
42+
POSTGRES_PASSWORD: "qiot"
43+
POSTGRES_DB: "qiot"
44+
45+
postgresqladminer:
46+
image: adminer
47+
container_name: "postgresqladminer"
48+
restart: always
49+
ports:
50+
- "18080:8080"
51+
52+
influxdb:
53+
image: "influxdb:latest"
54+
container_name: "influxdb"
55+
ports:
56+
- "8086:8086"
57+
- "9999:9999"
5258
volumes:
53-
#- ./init-mongo.js: /docker-entrypoint-initdb.d/init-mongo.js:ro
54-
- ./volumes/mongo:/data/db
59+
- influxdb-user-storage:/root/.influxdbv2
60+
- influxdb-data-storage:/var/lib/influxdb2
61+
- influxdb-config-storage:/etc/influxdb2
62+
environment:
63+
DOCKER_INFLUXDB_INIT_MODE: "setup"
64+
DOCKER_INFLUXDB_INIT_USERNAME: "qiot"
65+
DOCKER_INFLUXDB_INIT_PASSWORD: "qiotcovid19password"
66+
DOCKER_INFLUXDB_INIT_ORG: "qiot"
67+
DOCKER_INFLUXDB_INIT_BUCKET: "covid19"
68+
# DOCKER_INFLUXDB_INIT_RETENTION: The duration the system's initial bucket should retain data. If not set, the initial bucket will retain data forever
69+
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: "qiotcovid19influxdbtoken"
70+
71+
grafana:
72+
image: "grafana/grafana"
73+
container_name: "grafana"
74+
links:
75+
- influxdb
5576
ports:
56-
- "27017-27019:27017-27019"
57-
# mongo-express:
58-
# image: mongo-express
59-
# container_name: mongo-express
60-
# environment:
61-
# ME_CONFIG_MONGODB_SERVER: "mongo"
62-
# ME_CONFIG_MONGODB_PORT: "27017"
63-
# #ME_CONFIG_MONGODB_ENABLE_ADMIN: "false"
64-
# #ME_CONFIG_MONGODB_AUTH_DATABASE: "qiot"
65-
# #ME_CONFIG_MONGODB_AUTH_USERNAME: "qiot"
66-
# #ME_CONFIG_MONGODB_AUTH_PASSWORD: "qiot"
67-
# ports:
68-
# - "8081:8081"
69-
# influx:
70-
# image: "quay.io/influxdb/influxdb:v2.0.3"
71-
# container_name: "influx"
72-
# volumes:
73-
# - ./volumes/influxdb2:/root/.influxdbv2
74-
# ports:
75-
# - "8086:8086"
76-
# - "9999:9999"
77+
- "3000:3000"
78+
volumes:
79+
- grafana-storage:/var/lib/grafana
80+
- ./volumes/grafana/provisioning:/etc/grafana/provisioning
81+
depends_on:
82+
- influxdb
83+
environment:
84+
GF_SECURITY_ADMIN_USER: "qiot"
85+
GF_SECURITY_ADMIN_PASSWORD: "qiot"
86+
87+
volumes:
88+
influxdb-user-storage:
89+
influxdb-data-storage:
90+
influxdb-config-storage:
91+
grafana-storage:
92+
postgres-storage:
7793
networks:
7894
datahub:
7995
external: true

comp/init-mongo.js

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: 1
2+
providers:
3+
- name: InfluxDB
4+
folder: ''
5+
type: file
6+
disableDeletion: false
7+
editable: true
8+
options:
9+
path: /etc/grafana/provisioning/dashboards
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: 1
2+
datasources:
3+
- name: InfluxDB
4+
type: influxdb
5+
access: proxy
6+
database: qiot
7+
user: qiot
8+
password: qiot
9+
url: http://influxdb:8086
10+
isDefault: true
11+
editable: true

0 commit comments

Comments
 (0)