PINE A64, Node.js, Balena, PM2 and ResinOS (Part 2) …

Image for post
Image for post

I’m starting here from a new design that will use both PINE A64, Raspberry Pi 3 and OrangePi Zero cards…

Image for post
Image for post

with these technical specifications:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

As usual, I use Etcher to flash OS images on these cards :

Image for post
Image for post
Image for post
Image for post

I will use Debian Stretch as OS for these cards via Armbian :

Image for post
Image for post

and DietPi, a extremely lightweight Debian OS :

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

To do this you have to start after you flash the images on the cards to scan your network to find the IP addresses provided with the DHCP :

Image for post
Image for post

and I can see the characteristics of these boards :

Image for post
Image for post

I take this opportunity to install a Docker CE engine again:

Image for post
Image for post

and I can initiate a cluster via Docker Swarm Mode very quickly:

Image for post
Image for post
Image for post
Image for post

Orange Pi Zero card serves as the master node here:

Image for post
Image for post

with a local overlay network:

Image for post
Image for post

I can tag these nodes of this cluster to differentiate them according to their respective hardware architecture:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

I can then test the Portainer installation to graphically visualize the cluster characteristics:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

After this first test, I slightly modify the previous design to replace a PINE A64 card by an OrangePi Zero card:

Image for post
Image for post

And I can recreate a Docker Swarm Mode cluster where the RPi3 card is used here as the master node:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Here again I differentiate the cluster nodes according to their hardware characteristics (ARMv7 32 Bits or ARMv8 64 Bits):

Image for post
Image for post
Image for post
Image for post

with as usual the FranceConnect Particulier demonstrator test in ARMv7 :

Image for post
Image for post
Image for post
Image for post

or in ARMv8 :

Image for post
Image for post
Image for post
Image for post

I can use Traefik multi-architecture binaries as Docker images to get a global endpoint for my cluster:

Image for post
Image for post
Image for post
Image for post

Launch of Traefik in the cluster:

Image for post
Image for post

and launch of the FranceConnect Particulier demonstrators :

Image for post
Image for post

They appear in Traefik’s dashboard with two endpoints specific to ARMv7 and ARMv8 architectures :

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

And to allow external access to these locally running maps, Ngrok can be used again:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

or with the OpenFaaS stack to test functions on demand in Serverless mode :

Image for post
Image for post
Image for post
Image for post

with its specific command line :

Image for post
Image for post

or graphically :

Image for post
Image for post
Image for post
Image for post

And if I want an alternative to using the Docker engine, once again Keymetrics PM2 can work with these boards :

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

and PM2 Plus offers a dashboard:

Image for post
Image for post

You can imitate a “Capistrano” deployment mode like Rubyists with a configuration file that will exploit SSH connections to these devices :

Image for post
Image for post
Image for post
Image for post

Here I deploy the FC Agent demonstrator directly from the sources on Github with PM2 :

Image for post
Image for post

and PM2 cluster mode is active :

Image for post
Image for post
Image for post
Image for post

with metrics in an APM logic with PM2 Plus and its dashboard :

Image for post
Image for post
Image for post
Image for post

or more classically to the old formula offered by Keymetrics :

Image for post
Image for post
Image for post
Image for post

Using a utility dedicated to Reverse Proxy via the NPM register allows me to get a single local endpoint pointing to the different local endpoints provided by PM2 to access the FC Agent demonstrator:

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Finally with all these operations, the CPU/memory consumption remained relatively correct…

Image for post
Image for post

To close with the previous article, we could find here the logic of Edge Computing:

Image for post
Image for post

By the way I’m testing here the Azure IoT Hub service from Microsoft :

Image for post
Image for post

I can install the Azure IoT Edge runtime on the RPi3 board which will use the Docker CE engine again:

Image for post
Image for post
Image for post
Image for post

One can take into account the fact that this Edge node could be used to locally analyze data with Azure Stream Analytics on IoT Edge (via a Docker container using Machine Learning bricks) to send only some useful data to Azure IoT Hub (for the moment this is limited to 32-bit ARMv7 devices: https://hub.docker.com/r/microsoft/azureiotedge-azure-stream-analytics/):

Image for post
Image for post
Image for post
Image for post

and I can connect all these boards to Azure IoT Hub:

Image for post
Image for post

with the first lifts:

Image for post
Image for post

Using the Azure IoT Node.js SDK on each board:

Image for post
Image for post
Image for post
Image for post

and these examples: here, simulated sensor data are fed back to these devices using the MQTT protocol

Image for post
Image for post
Image for post
Image for post

by inserting the connection string for each device:

Image for post
Image for post

and the data is uploaded:

Image for post
Image for post

Please note that the free plan is limited to 8000 messages per day…

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Finally, I can also use the cloud monitoring service dedicated to IoT provided by Datadog by compiling on these devices the sources of its dedicated agent :

Image for post
Image for post

generating these graphs in dashboards :

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Above the clouds, the sky is always blue ...

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store