(Locally) how to apply an updated subflow over multiple machines?

Yeah, I probably have asked before.

I have just had a lot of fun retrospectively rolling out an update of a subflow I wrote over my machines.

Is there an easier way?

I had to copy/export the new code, go to each machine, edit the subflow and paste in the new code and hook it up.

Not the worst but a bit tedious.

Keeping things LOCAL...

Is there an easier way?
(Oh and keeping it simple.)
If it involves too much stuff, it may not be easy for me.

(I nearly asked again, but as I found the original post)

Sorry, but it is sort of becoming a bit more frequent in happening and I would prefer to keep things local.

I haven't done this, but I guess you could package it as a module which can then be installed into each machine and updated via npm as usual. Put in a github repository rather than publishing to npm of course since, presumably, it will only be of use to you. Packaging a Subflow as a module : Node-RED

1 Like

You could do via. the following programmatically

  1. Get global flows from target.
  2. Get global flows from source.
  3. Isolate the subflow from the source global - using subflow name.
  4. Replace the subflow in target global - using sub flow name . Replace it by subflow from #3.
  5. Send back global to target

1,2,5 you use NR APIs.
3,4 function nodes.

Thanks Colin.

But reading that link I fear you are overestimating my skills.

I'm not sure what is going on with me, but I do not feel confident enough to want to go down that path. Yeah, ok, so that means what I want to do can't be done.

Such is life.
But thanks.

Hi Sandeep.

Again, I think you are giving me too much credit for intelligence.

What you wrote is (basically) a foreign language to me.
All I am seeing is words. Their meaning is unknown.

Packaging my first nodes seemed intimidating at first (still new, I just learn as I go), but it really wasn't bad, and definitely worth learning.

Thanks. When I have the energy (just sustained other high priority things) would you mind helping me get my head around it?

Yeah, absolutely. Just send a message when you got time.

Andrew, have you considered moving away from subflows?

As you have multiple node-reds, you could elect one (the important one) to be a "master" (with ONE COPY of your important nodes & functions) on a regular flow TAB.

Then using HTTP or some other transport, call the remote code.


NODE-RED1 - TAB "shared functions" (Master Flows)

HTTP IN "/calculate-colour" → <some nodes> → HTTP Response


<some nodes> → HTTP Request to "/calculate-colour" → <some nodes, use result>


<some nodes> → HTTP Request to "/calculate-colour" → <some nodes, use result>


<some nodes> → HTTP Request to "/calculate-colour" → <some nodes, use result>

This way, all you code is in one place (on NODE-RED1) - no need to update subflows in multiple places.

I'm not sure that will always work.

If that machine dies.... I have multiple points of failure because of their dependency on it.

Not sure that is a good strategy. Still thinking.

That's true. But if there is a critical part that "must always be 'up"' then it's a viable option. Since if there is a critical element to your setup, the failure of that is more critical than some globally shared functionality.

And believe me, I am having the devil's own trying to work out where this line is....

I get that I may never REALLY NEED this stuff, but my curiosity is painful at best.

I am (just now) having a big discussion about push buttons and what they say.
Do they say/display the state or do they show what will happen when they are pressed.

(Sorry. Off topic)

But it is annoying with this mind set.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.