Table of Contents

Set up an Alpine container with Node-RED

Goal

This wiki describes how to install an LXC container with the Alpine OS on the router. The LXC container is already prepared with a Node-RED installation and can then be used immediately.

Prerequisites

The wiki was tested with router software 5.0.0.100 and the LXC container with Alpine armhf 3.22.


1. Setting up an LXC container with Alpine Linux and a ready-to-run Node-RED implementation

You can download LXC containers via the link. The file contains Alpine for container installation and Node-RED has also been added.

* Alpine Linux with Node-REDAlpine and Node-RED

Password: node_red

Once you have downloaded the file “node-red_container.tar.xz”, save it in a subdirectory of the router. Use the subdirectory “/tmp” for this purpose.

You can then install the container via the router's web interface. Under point 1, you must specify the directory where the file was stored on the router.

file:///tmp/node-red_container.tar.xz

To execute the installation, the “check box Install on” must be activated under point 2.


If the installation from the file was performed correctly, the LXC container is installed on the router and visible in the web interface.


Next, a network connection is submitted for the container. In this example, the container is simply assigned to LAN interface 1. However, you can also set up the container with its own IP network via the “routed” option.

The container receives its IP address from LAN 1 via DHCP. To ensure that it always receives the same address, we set this under the “Static Host” option.

Under point 1, we store the MAC address of the container. This is easy, as it is always the one you see in this image: “00:FF:AA:00:44:00”.

Under point 2, we assign an IP address from the DHCP range. In this example, we have assigned the IP “192.168.1.100“.

Under the router console, you can check whether the router is assigned the correct IP address.

USER
~ $ lxc-info guest0 Name: guest0 State: RUNNING PID: 2653 IP: 192.168.1.100 CPU use: 32.63 seconds BlkIO use: 68.77 MiB Memory use: 103.00 MiB KMem use: 3.77 MiB Link: virt0 TX bytes: 4.67 KiB RX bytes: 66.28 KiB Total bytes: 70.95 KiB ~ $

Under the console of the LXC container, you can check again whether the Node-RED daemon has already been started.

USER
~ $ lxc-attach guest0 ~ $ rc-service node-red status * status: starting ~ $


If everything worked, you can now access Node-RED in your web browser via the IP address 192.168.1.100:1880.


2. Further settings under Node-RED

No user has been stored for this Node-RED installation. However, one can be stored later for secure access to the Node-RED container.

USER
~ $ node-red admin init Node-RED Settings File initialisation ===================================== This tool will help you create a Node-RED settings file. ✔ Settings file · /root/.node-red/settings.js ✔ That file already exists. Are you sure you want to overwrite it? · Yes Share Anonymouse Usage Information ================================== ✔ Node-RED can notify you when there is a new version available. This ensures you keep up to date with the latest features and fixes. This requires sending anonymised data back to the Node-RED team. It does not include any details of your flows or users. For full information on what information is collected and how it is used, please see https://nodered.org/docs/telemetry · No, do not send my usage data User Security ============= User Security ============= ✔ Do you want to setup user security? · Yes ✔ Username · admin ✔ Password · * ✔ User permissions · full access ✔ Add another user? · No

The command “node-red admin init” is executed under the console of the container. Changes can be made to Node-RED via a text-based menu and a user with a password can be stored. This provides you with additional security for this additional function.

Important Changes to “node-red admin init” will only take effect after restarting the container.