Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

IoTGateway

The IoTGateway application is based on a Mosquitto MQTT broker with an authentication plugin and ACL checks. It also contains a node.js application to provide a web interface for device management. All componenets are Dockerized, and defined as services with Docker-compose.

Services:

  • mauthp Mosquitto MQTT broker with auth plugin using authdb
  • mqttadmin node.js web application for device management
  • authdb Mongo database to store device data

Usage

Start the services:

docker-compose up

The service addresses are:

  • webadmin localhost :3000
  • mqtt localhost :1883
  • db localhost :27017

Stop the services:

docker-compose down

More useful commands at the Update section

Test

Using MQTT clients: - [mosquitto_sub](https://mosquitto.org/man/mosquitto_sub-1.html) - [mosquitto_pub](https://mosquitto.org/man/mosquitto_pub-1.html)

Install client packages:

sudo apt install mosquitto_clients

Add a device on the webadmin page localhost:3000

Subscribe to a topic (grant read permission r to the topic)

mosquitto_sub -u <USERNAME> -P <PASS> -t <TOPIC>

Example:

mosquitto_sub -u mydevice -P mypass -t /device/mytype/mydevice

Open another terminal and publish to the same topic (grant write permission w to the topic)

mosquitto_pub -u <USERNAME> -P <PASS> -t <TOPIC> -m <MSG>

Example:

mosquitto_pub -u mydevice -P mypass -t /device/mytype/mydevice -m "hello"

The mosquitto_sub terminal should show a hello message.

You could also test:

  • subscribe/publish without or wrong username and password
  • subscribe to a topic without granted read permission
  • publish to a topic without granted write permission

Update a service

If you want to update only one service: List the containers

docker-compose ps

Stop the service

docker-compose stop <service>

Delete it

docker-compose rm <service>

Build it

docker-compose build <service>

Start it again

docker-compose up -d --no-deps <service>

Architecture / modifications

TODO

  • update to Docker-compose v3
  • generate logger password from ENV, block new device creation with the logger name
  • compare with the official mosquitto Dockerfile https://github.com/eclipse/mosquitto/blob/master/docker/generic/Dockerfile
  • multistage build to minimalize the image size
  • move application to a standard location (/usr/bin/)
  • add security to authdb
  • logging with plugin instead of a client subscribe to all topics
  • show connected clients
  • show resent messages
  • REST API for device (batch) CRUD
  • secure REST API with users and permissions
  • add graph web application: real time and history data, multiple devices

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published