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

Image for post
Image for post

The Resin.io team has made its ResinOS system available to support the management of IoT peripheral fleets and the implementation of CI/CD :

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

I start with a PINE A64 card with 2 GB RAM :

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

And first, I will load the latest version Ubuntu 18.04 in 64-bit ARM specifically for this SBC :

Image for post
Image for post

and with an SD card, I use Etcher to load this Ubuntu 18.04 image :

Image for post
Image for post

If you do not have the wifi connector, you must use a gateway to your wifi network (or its 4G connection in my case) via the Ethernet connector on the card :

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

I connect to this card in SSH :

Image for post
Image for post

I install there the Docker CE engine :

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

The Docker engine is working and I then go to the Resin.io platform to load ResinOS (but as the card is not officially supported, it will be in the form of a Docker image) :

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

The operating principle for loading an application (in addition here the FranceConnect Agent demonstrator coded with Node.js) follows this principle (even if Docker is replaced by Balena) :

Image for post
Image for post

So I load the ResinOS image on the card and with the configuration file provided by the platform, I launch this image via the local Docker engine :

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

which is active :

Image for post
Image for post

The map then appears active on the Resin.io dashboard :

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

As with any fleet of IoT devices, it can be geolocated via the dashboard :

Image for post
Image for post

We see then that it is the Balena engine and not Docker that is embedded within ResinOS (which runs as a Docker image in the case of this card) :

Image for post
Image for post

As a reminder, Balena is the result of Docker’s Moby project and specifically dedicated to the IoT context :

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

So I can launch via Balena an image I loaded on the Docker Hub of the FranceConnect Agent demonstrator but for 64-bit ARM machines :

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

and according to this Dockerfile :

Image for post
Image for post

So I run this application on HTTP port 80 and use the public endpoint provided by Resin.io to connect to it :

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

Usual test that works (as usual) 😉 …

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

Note that the Balena engine can also be installed directly on the PINE A64 card:

Image for post
Image for post

Without ResinOS, I could also launch this image of the FranceConnect Agent demonstrator also locally on the board :

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

and via the service serveo.net, I could make public the URL of the demonstrator :

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

and the public endpoint provided by this online service :

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

via multi-platform packages :

Image for post
Image for post

Finally, if I don’t want to use containers but rather natively vfor example a Node.js and PM2 engine from Keymetrics, we get the same result. I clone the demo repository on github :

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

I install PM2 from Keymetrics and its monitoring module :

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

and then I test its cluster mode to run several processes in parallel (instead of containers here)…

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

and several processes are load-balanced with a single output port :

Image for post
Image for post

Locally via the card, I once again have access to the demonstrator :

Image for post
Image for post

and I reuse NGROK to make this demonstrator accessible on Internet via the public endpoint provided in output :

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

with PM2 I have different monitoring metrics available on a Keymetrics dashboard :

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

or locally on the board :

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

and I can switch to more advanced metrics in an APM context via PM2 Plus :

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

To conclude, the Raspberry Pi community provided the Raspberry Pi 3 Compute module for industrial use :

Image for post
Image for post

with an official physical support :

Image for post
Image for post

But with the Balena engine in mind, a new support was born for this module and available under the name Balena Fin :

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

And the Resin.io team already provides an official image of ResinOS dedicated to it…

Image for post
Image for post

The Resin.io team offers new features around its connected object fleet management system such as the ability to manage multiple different devices in a single application :

Image for post
Image for post

integrate micro services, notably through the Flogo open source project:

Image for post
Image for post

or generate highly customized dashboards through partners like Losant :

Image for post
Image for post

Evolutions to follow with the development of Edge Computing (brought to exceed in turnover that of the Cloud this year and which would lead to the return of DC of proximity according to certain analyses) and the explosion of connected devices !

Image for post
Image for post

Links :

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