- Replicate devices with rich semantic properties
- Authentification by access tokens and API keys
- Handle devices and sensors CRUD methods triggered via HTTP and MQTT
- MQTT events generated by HTTP operations hooks
- Dispatch MQTT payload from several protocol sources
- Adding context to sensors with OMA schemas
- Store devices and sensors state ( MongoDB )
- Fast access to sensor resources, clients and timers ( Redis )
- Mesurement (sensor values and tags ) stored in timeseries ( InfluxDB )
- Users and Devices files stored in filesystem or cloud providers, see loopback-component-storage
- Trigger persisted schedulers (via sensors) to create timed scenarios ( Skyring )
- Interact with external application and share selection of devices
Application build upon :
These need to be installed, configured and started manually, when working locally and not using docker setup.
- Install MongoDB to persist Users, AccessTokens, Devices, Sensors, Addresses, File models.
mongod --config /usr/local/etc/mongod.conf
- Install Redis to persist SensorResources, Schedulers and Client models, MQTT connection and RateLimiter
redis-server /usr/local/etc/redis.conf
- Install InfluxDB to persist Measurements
influxd -config /usr/local/etc/influxdb.conf
- Install Skyring to use persistent timers for Scheduler
# start NATS server
nats-server
# start Skyring
DEBUG=skyring:* skyring run -p 3005 -s localhost:3455
-
/. --> Main application configuration, dependencies list, and launch scripts
-
/bin --> contains some maintenance scripts - not needed yet
-
/deploy --> contains environment variables ( hidden files )
-
/log --> contains logs from PM2 and Nginx used via Docker
-
/storage --> contains folders where Users / Devices files are stored
-
/src --> contains source code
- /. --> Loopback configuration
- /boot --> code executed at application start
- /initial-data --> JSON datasets to make global application running
- /lib --> Helpers for models and services
- /middleware --> scripts used in development/staging only
- /mixins --> add special properties to models
- /models --> Data models, controllers and REST API descriptions
- /services --> external modules
- /views --> templates used for automated mailing
URL pattern : +apiRoot/+modelPluralName/+path
Access controlled using Access tokens ( set in HTTP headers ) and roles for Users and using apiKey property for Applications and Devices.
Topic pattern : +userId/+modelName/+method/[+modelId]
Access controlled using Access tokens ( set in MQTT password ) and roles for Users and using apiKey property for Applications and Devices.
Edit your config in .env_sample and save it as .env
.
You can override these by populating deploy
with files corresponding to an environment ( eg: .env_production ... ).
$ npm install
$ npm run lint
-
To set Aloes verbosity, configure SERVER_LOGGER_LEVEL from 0 to 4
-
To activate Loopback debug :
$ DEBUG=loopback npm run start:dev
Create or update .env
file to match your enviroment.
For example to run in local mode, create ./deploy/.env_local
using .env_sample
as an example.
$ npm run start:local
- Starting PM2 processes :
$ npm run start:pm2
- Stopping PM2 processes :
$ npm run stop:pm2
You can serve the project with a distant server by filling deploy
folder with files corresponding to an environment ( eg: .env_docker ), and then launching this app with docker via docker-compose up
Remember to update *.dockerfile
to match your environment, if you don't use docker-compose, otherwise edit docker-compose.yml
to match your environment and needs.
Creating environment :
$ npm run build:docker
Starting containers :
$ npm run start:docker
Stopping containers :
$ npm run stop:docker
Read https://nodejs.org/api/tls.html#tls_tls_ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./deploy/key.pem -out ./deploy/cert.pem
openssl dhparam -out ./deploy/dhparam.pem 2048
Install your own server instance : https://github.com/localtunnel/server
And then install wildcards certificates with : https://certbot.eff.org/
Finally, configure TUNNEL_HOST and TUNNEL_SECURE in your environment files.
-
Add e2e tests for processes interruption signal and tests for MQTT with mysensors / lorawan source
-
Finish restore helper for InfluxDB
-
Implement user+ip rate limit for HTTP endpoints requiring auth
-
Finish account linking with github
-
Add user(s) in a team to easily share devices access ( via collaborators property/role ? )
-
Catch and store data related to MQTT traffic ( https://github.com/mcollina/aedes-logging#readme ; via specific sensor instance ? )
-
Update to loopback 4
-
Add redis replication config ( docker deployement )
-
Synchronize data from Aloes ecosystem to a distributed ledger ( IOTA Tangle ? )