The repository includes five modules:
- Common - the implementation of DAL models and utils;
- Device - the implementation to run on a RaspberryPi device, requires a MQTT Broker for communication with a server;
- Server - the implementation to run on an available host, requires a MQTT Broker for communication with devices and a MongoDB to store data;
- Broker - the docker-compose configuration with default settings for a MQTT Broker instance running;
- Database - the docker configuration for MongoDB and Mongo Express instances running.
- node.js - v10.14.1
- npm - 6.4.1
- Docker Engine - 18.09.0
- Docker Compose - 1.23.2
Some useful commands are described in this block.
Change directory to relocate into Broker folder:
user@host:Group3_IoT_Services$ cd Broker
Build container if it's needed:
user@host:Broker$ docker-compose build
Up container (without output):
user@host:Broker$ docker-compose up -d
Down container:
user@host:Broker$ docker-compose down
Change directory to relocate into Database folder:
user@host:Group3_IoT_Services$ cd Database
Build container if it's needed:
user@host:Database$ docker-compose build
Up container (without output):
user@host:Database$ docker-compose up -d mongodb
Down container:
user@host:Database$ docker-compose down
Change directory to relocate into Database folder:
user@host:Group3_IoT_Services$ cd Database
Build container if it's needed:
user@host:Database$ docker-compose build
Up containers (without output):
user@host:Database$ docker-compose up -d
Down container:
user@host:Database$ docker-compose down
When step 1 or 2 is performed, you can run a special shell for MongoDB:
user@host:Database$ docker exec -t -i mongodb mongo
When step 2 is performed, you can open link via browser to watch and configure DB data:
Install all JS modules via npm (it's worth using in the first time):
user@host:Group3_IoT_Services$ npm run install-all
Remove all dependencies and lock-files in all JS modules:
user@host:Group3_IoT_Services$ npm run uninstall-all
Install JS modules after removing of old dependencies:
user@host:Group3_IoT_Services$ npm run reinstall-all
Run unit tests in all JS modules:
user@host:Group3_IoT_Services$ npm test
Run lint for JavaScript files in all JS modules:
user@host:Group3_IoT_Services$ npm run lint
Before running of Server application MQTT Broker and MongoDB are needed to start (see MQTT Broker and see MongoDB).
Run Server application:
user@host:Group3_IoT_Services$ cd Server
user@host:Server$ node index.js
After that, you can open link via browser to watch result:
Before running of Device application MQTT Broker is needed to start (see MQTT Broker).
Run Device application:
user@host:Group3_IoT_Services$ cd Device
user@host:Device$ node index.js
After that, you can open link via browser to watch result:
Thanks a lot boykosha and dkravtsova for your help to develop this project.