Node-Red running with balena

@rojasyal Thanks for mentioning the version of the modbus library that is compatible with the Node-RED with nodeJS v16.

Did you try to update the nodeJS version from the Dockerfile template?

Let us know about your results!

It doesn’t work for me, it still has version v16.19.1

What did you change @rojasyal ? do you think you can share the Dockerfile so I can try to reproduce?

Thanks!

In the dockerfile I change the version of node.js in the following way but no change appears.

Dockerfile:

Build step

FROM balenalib/raspberrypi3-debian-node:19-bookworm-build as build

WORKDIR /usr/src/app
COPY ./app/package.json package.json
COPY ./app/package-lock.json package-lock.json

RUN JOBS=MAX npm install -g --production --unsafe-perm
node-red
node-red-contrib-balena
&& JOBS=MAX npm install --unsafe-perm --production && npm cache clean --force

Runtime image

FROM balenalib/raspberrypi3-debian-node:19-bookworm-run

RUN apt-get update && apt-get install -yq --no-install-recommends
rpi.gpio
python3-dev
python3-rpi.gpio
libatomic1
git
openssh-client
&& apt-get clean && rm -rf /var/lib/apt/lists/*

Defines our working directory in container

WORKDIR /usr/src/app

Copy over the files created in the previous step, including lib/, bin/

COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=build /usr/src/app/node_modules /usr/src/app/node_modules
COPY ./ssh_config /etc/ssh/ssh_config

This will copy all files in our root to the working directory in the container

COPY ./app ./

server.js will run when container starts up on the device

CMD [“bash”, “/usr/src/app/start.sh”]

and this is my docker compose

node-red:

build: ./node-red



container_name: node-red
privileged: true
restart: unless-stopped
volumes:
    - 'node-red-data:/data'
labels:
    io.balena.features.dbus: '1'
    io.balena.features.sysfs: '1'
    io.balena.features.supervisor-api: '1'
    io.balena.features.balena-api: '1'
ports:
    - 1880:1880
environment:
    PORT: 1880
    USERNAME: "balena"
    PASSWORD: "balena"
    ENCRIPTION_KEY: "balena"        
cap_add:
    - SYS_RAWIO
devices:
    - "/dev/mem:/dev/mem"
    - "/dev/gpiomem:/dev/gpiomem"
    - "/dev/i2c-1:/dev/i2c-1"

They even ask the same question in the original repository

@rojasyal in this repo i’m running Node-RED with nodeJS version v19.6.1

The balena-node-red repo is archived, so my recommendation is to clone it and make the changes to update the nodejs version.

Let me know if that works!

thanks @mpous, I managed to update the version of node.js in node red

modify the dockerfile