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

**URL:** <https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701>\
**Category:** General\
**Created:** [25 December 2021 23:39 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701 "2021-12-25T23:39:56Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [25 December 2021 23:39 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/1 "2021-12-25T23:39:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 February 2022 22:57 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/2 "2022-02-16T22:57:19Z")

</div>

(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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 February 2022 11:04 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/3 "2022-02-17T11:04:42Z")

</div>

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](https://nodered.org/docs/creating-nodes/subflow-modules)

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [17 February 2022 16:53 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/4 "2022-02-17T16:53:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 February 2022 20:33 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/5 "2022-02-17T20:33:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 February 2022 20:34 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/6 "2022-02-17T20:34:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [18 February 2022 01:51 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/7 "2022-02-18T01:51:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [18 February 2022 03:47 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/8 "2022-02-18T03:47:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [18 February 2022 07:04 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/9 "2022-02-18T07:04:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 February 2022 08:57 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/10 "2022-02-18T08:57:27Z")

</div>

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.

Example...

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

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

### NODE-RED2

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

### NODE-RED3

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

### NODE-RED4

\<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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [18 February 2022 22:42 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/11 "2022-02-18T22:42:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 February 2022 22:44 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/12 "2022-02-18T22:44:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [18 February 2022 22:48 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/13 "2022-02-18T22:48:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 April 2022 22:48 UTC](https://discourse.nodered.org/t/locally-how-to-apply-an-updated-subflow-over-multiple-machines/55701/14 "2022-04-19T22:48:04Z")

</div>

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