/ming

Apache License 2.0Apache-2.0

MING (MQTT, InfluxDB, NodeRED and Grafana)

This is an educative project called MING based on MQTT, InfluxDB, balena Node-RED block, Grafana and WiFi Connect balena blocks. MING is an Open-Source LAMP-like stack for the Internet of Things.

Each of these applications is built and runs in its own container on an embedded Linux target supporting balena.io or Docker:

  • Mosquitto MQTT broker listening on port 1883 for MQtt message publications.
  • InfluxDB listening on port 8086 providing a time series database for sensor data storage.
  • NodeRed listening on port 80 to provide an easy to use graphical environment for parsing, analysing, storing, and forwarding sensor data messages.
  • Grafana listening on port 8080 providing a data visualisation environment for sensor data.
  • WiFi Connect listening on the port 80 in case there is not WiFi connectivity available.

Requirements

Hardware

  • Raspberry Pi 0/2/3/4 or balenaFin
  • SD card in case of the RPi 3/4
  • Power supply and (optionally) ethernet cable

Software

Deploy

You have two options here:

One-click deploy via Balena Deploy

You can deploy this project to a new balenaCloud application in one click using the button below:

Or, you can create an application in your balenaCloud dashboard and balena push this code to it the traditional way.

In-control deploy via balena CLI

If you are a balena CLI expert, feel free to use balena CLI. This option lets you configure in detail some options, like adding new services to your deploy or configure de DNS Server to use.

  • Sign up on balena.io
  • Create a new application on balenaCloud.
  • Add a new device and download the image of the BalenaOS it creates.
  • Burn and SD card (if using a Pi), connect it to the device and boot it up.

While the device boots (it will eventually show up in the Balena dashboard) we will prepare de services:

cd ~/workspace
git clone https://github.com/mpous/ming
cd ming
  • Using Balena CLI, push the code with balena push <application-name>
  • See the magic happening, your device is getting updated 🌟Over-The-Air🌟!

Variables

Device Variables

Variable Name Default Description
PORT 80 the port that exposes the Node-RED UI
USERNAME balena the Node-RED admin username
PASSWORD balena the Node-RED admin password
ENCRIPTION_KEY balena the encription key used to store your credentials files

You must set the USERNAME and PASSWORD environment variables to be able to save or run programs in Node-RED.

Node-RED

For running Node-RED, use the local IP address on port 80, if you are on the same network than your device. You also can use the Publick Device URL by balena to access to the Node-RED UI.

Add new Node-RED nodes

Add new Node-RED nodes on the Dockerfile templates on the node-red folder in the project. Find more an example here.

Add new services

For adding new services, use the docker-compose here. Go to balenaHub and use the blocks available there to accelerate your development.

Deploy your flow into your entire fleet

If you would like to deploy your flow into your entire fleet, you can introduce a file into the folder node-red/app/flows here on your cloned github repository. Then using the balena CLI call balena push <your Fleet name> and you will find the flow deployed on all your fleet.

Go to the Node-RED UI and Import the flow and start using it.

Attribution

Disclaimer

This project is for educational purposes only. Do not deploy it into your premises without understanding what you are doing.