Skip to main content
Version: Torizon OS 7.x.y

Node-RED

Introduction

Quoting from nodered.org:

Node-RED is a programming tool for wiring together hardware devices, APIs, and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single click.

This article complies with the Typographic Conventions for Torizon Documentation

Running on Torizon

Prerequisites

  • A Toradex Computer on Module with Torizon installed.

Executing the Node-RED Container through the Command-Line

Getting Node-RED to run on Torizon is very easy, especially because the Node-RED project provides good support and documentation for Docker.

Below is the most basic setup to get started. Execute this command on the SoM:

info

you can try to use another tag for a newer version, such as latest or any other tag listed on the images's Docker Hub, as long as it is available for your hardware architecture. We use a fixed version to make sure that such a version actually works and further updates do not compromise our examples and documentation.

# docker run -it -p 1880:1880 --name mynodered nodered/node-red:1.0.6-2

Expand the collapsible section below to see sample output. A similar output will be presented:

Command output from Node-RED bring-up in a container
Unable to find image 'nodered/node-red:1.0.6-2' locally
1.0.6-2: Pulling from nodered/node-red
29e5d40040c1: Pull complete
0ec0f388054b: Pull complete
b084d382ca62: Pull complete
1580a2fc9070: Pull complete
0348d9c756c0: Pull complete
f42a64fc0138: Pull complete
1179029c387a: Pull complete
19ab1cb9f5b0: Pull complete
9d11d3876140: Pull complete
7d1e58f134ce: Pull complete
dc292a4d34ec: Pull complete
Digest: sha256:a0978c868dc856c31e02ba2764f213a445b6e2c1122fe2ed88f0c3175cd97735
Status: Downloaded newer image for nodered/node-red:1.0.6-2

> node-red-docker@1.0.6 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"

9 Jun 18:08:33 - [info]

Welcome to Node-RED
===================

9 Jun 18:08:33 - [info] Node-RED version: v1.0.6
9 Jun 18:08:33 - [info] Node.js version: v10.20.1
9 Jun 18:08:33 - [info] Linux 4.14.159-4.0.0-devel+git.1f43bce17a57 arm64 LE
9 Jun 18:08:34 - [info] Loading palette nodes
9 Jun 18:08:37 - [info] Settings file : /data/settings.js
9 Jun 18:08:37 - [info] Context store : 'default' [module=memory]
9 Jun 18:08:37 - [info] User directory : /data
9 Jun 18:08:37 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Jun 18:08:37 - [info] Flows file : /data/flows.json
9 Jun 18:08:37 - [info] Creating new flow file
9 Jun 18:08:37 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

9 Jun 18:08:37 - [info] Starting flows
9 Jun 18:08:37 - [info] Started flows
9 Jun 18:08:37 - [info] Server now running at http://127.0.0.1:1880/

In summary, the Docker image is downloaded and started, and Node-RED is exposed through port 1880.

Alternative: Executing the Node-RED Container through Portainer

The image TorizonCore with evaluation containers has many different demos. For instructions about how to install Torizon on your board, refer to Toradex Quickstart Guide.

With Portainer opened, explore it by going to the App Templates section in Portainer and click on the Node-RED template.

Available Container Examples in Portainer

Usage

On a desktop PC connected to the same network as the Computer on Module, open a web-browser (for example Chrome or Firefox) and use either one of the following URLs:

  • http://<Board's Ethernet IP>:1880

    or

  • http://<SoM name>-<serial number>.local:1880

See the example below for my Apalis iMX8, with Ethernet IP 192.168.10.5 and serial number 0333444555. The zero to the left cannot be disregarded:

  • http://192.168.10.5:1880

    or

  • http://apalis-imx8-0333444555.local:1880

And now you have access to the web-based Node-RED dashboard:

Node-RED Dashboard running on a Colibri iMX8X

Next Steps / Additional Resources

Well done, now you know the basics! Go ahead and read the extensive Node-RED official documentation, which includes documentation for Docker as well:

Webinars

Toradex has presented webinars about Node-RED and you can watch them on demand.

Get your ideas off the drawing board with Node-RED

Tirando ideias do papel com Node-RED - Brazilian Portuguese



Send Feedback!