Multiple Instances of Node Red

#1

Good Day all

I am working on a project where i have multiple Raspberry PI. Each PI controls a room where node red install in it. The node red will control devices like smart lights within each room.

I have a created a flow which to be deployed on each of the PI. The flow is same for all of them.

if i make a change in the flow, i need to copy and paste and test in all the PIs. This is time consuming.

Is there a way for me to centrally manage this and push changes to all PIs where node red is installed?

What are other option available in terms of a central node red that communicates to all PIs?

Any help will be much appreciated.

regards
deven

0 Likes

#2

Have a look at the "Projects" feature of Node Red.
https://nodered.org/docs/user-guide/projects/

0 Likes

#3

thanks. i will.

0 Likes

#4

I don't think that lets you push to multiple Pis from the controlling one. Certainly using git to store the flow (whether via projects or otherwise) could help as then you just need to run a script on each one that pulls the new flow file and restarts node-red. Then you could run a script on the controller that runs the pull/restart script on all the other ones by using ssh to run a command remotely.

1 Like

#5

Thanks for the feedback Colin. I am completely new on this. Is there a sample script already available for this?

0 Likes

#6

The script is trivial once you get your head round git.

0 Likes

#7

:smiley:ok will do. thanks

0 Likes

#8

Another possibility is to use the "Admin APIs" to push a new flow from the master node-red server to multiple slave instances.

Normally, the deploy button does an Http POST to the internal admin endpoint called /flows -- here is the documentation for this and all the other internal admin apis . What I have done in the past is to use http response nodes to POST the new flow.json to remote node-red instances (running, of course). This causes the remote servers to immediately replace their current runtime flows with the newly posted version and restart their runtimes.

Potentially dangerous -- but very powerful!

1 Like

#9

This came up 3 weeks ago i believe (at most 4 weeks ago) someone wanting to have a central script that was deployed to multiple Pis - have a look at the ideas in here

Craig

0 Likes

#10

Thanks a lot for guidance. Certainly will give it a go.

I also came to know this option while googling.

Distributed Node Red-Editor from giang nam.

It's ready available contrib in Node Red.

Any thoughts?

0 Likes

#11

Wow impressive! Thanks for the link!! Would be nice to hear some pros and cons from the other forum members...

0 Likes

#12

Hey guys,

For anybody interested in the movie, these are the contribution links:

Looks really cool, but does anybody know what the relationship is to the standard Node-RED flow editor? I assume that both editors have nothing in common? I.e. when something is added in a new release to the standard editor, that won't be available in the DNR editor?

It looks to me that it offers some of the functionality from this Trello item on the Node-RED roadmap. But (again) I assume there is no connection whatsoever between the both?

Would be nice to hear some thoughts about it...

Bart

0 Likes

#13

I still like the idea of one day having the option to “Deploy To Fleet”

Configure the host names or IP addresses of the node-red instances you would like to deploy to and then click the button. Done.

3 Likes

#14

Hi Deven

Advantech have done a lot of work on creating and reading nodes from sources and I wondered if this could be of use. Here are a few links to the relevant youtube channel pages and the NPM source page:

Node-Red Flow Communicator Demo:

Here is a link to the Node-Red flow:

And a link to the NPM package page:

They also have Node-Red flow Cloner:

And Node-Red Flow Reader Writer:

Also, Node-Red Flow Communicator Demo:

Many thanks

Michael

0 Likes

#15

Hi guys,

This is Nam, from DNR Editor, I try to keep DNR Editor up to date with upstream (Node-RED) editor as much as I can while being a PhD student.

I also work with FRED if you ever heard of (fred.sensetecnic.com), DNR was initially an idea of Mike, the co-founder of FRED and a very cool guy. I've been pushing it forward ever since.

Glad to hear it might be of use somewhere.

For the question about multi device deployment, here is a sample flow that can be done through DNR Editor, this will help to deploy the same flow to different device. It's a bit hacky but currently work that way.

The constraints 1, 2, 3 is based on device Id, which you assign when register each device to DNR Editor. The participating Node-RED needs to have node-red-contrib-dnr installed to be able to register to DNR Editor.

image

The main goal of the project is to assign portions of the flow on different devices. But since nothing prevents you from having multiple clones of the same flow on the same tab, it will work.

1 Like