# Work with deployed flows on /ui and run the editor for different flows

**URL:** <https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366>\
**Category:** General\
**Created:** [29 January 2023 16:57 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366 "2023-01-29T16:57:24Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [29 January 2023 16:57 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/1 "2023-01-29T16:57:24Z")

</div>

My first flows are build and deployed at port 1880 and stored with` .node-red/flows.json`.  
While the first version is in use, I would like to continue "working on it". I thought that this should go with a copy at another port e.g. 2000 and in another directory.  
However, I see that when I start with  
`~/.node-red $ node-red -p 2000 -u /home/pi/.node-red/red2000`  
the Flows.json is taken from the .node-red directory.  
I can't work with any other flows with this!  
_Note: the /red2000 was not build beforehand, I expected NR to create it by itself, and yes it did._

What should be the correct configuration?

```auto
~/.node-red $ node-red -p 2000 -u /home/pi/.node-red/red2000
29 Jan 17:59:26 - [info] 

Welcome to Node-RED
===================

29 Jan 17:59:26 - [info] Node-RED version: v3.0.2
29 Jan 17:59:26 - [info] Node.js version: v19.3.0
29 Jan 17:59:26 - [info] Linux 5.10.103-v7+ arm LE
29 Jan 17:59:31 - [info] Loading palette nodes
29 Jan 17:59:37 - [info] Dashboard version 3.3.1 started at /ui
29 Jan 17:59:37 - [info] Settings file : /home/pi/.node-red/red2000/settings.js
29 Jan 17:59:37 - [info] Context store : 'default' [module=memory]
29 Jan 17:59:37 - [info] User directory : /home/pi/.node-red/red2000
29 Jan 17:59:37 - [warn] Projects disabled : editorTheme.projects.enabled=false
29 Jan 17:59:37 - [info] Flows file : /home/pi/.node-red/flows.json
29 Jan 17:59:38 - [info] Server now running at http://127.0.0.1:2000/
29 Jan 17:59:38 - [warn]

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [29 January 2023 16:59 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/2 "2023-01-29T16:59:19Z")

</div>

Moved to general since this isn't a question about creating custom nodes.

---

<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:** [30 January 2023 09:22 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/3 "2023-01-30T09:22:55Z")

</div>

> [@gNeandr](#):
>
> node-red -p 2000 -u /home/pi/.node-red/red2000

I am surprised that does not do what you expect, however if you add the path to the flows file on the end then I think it will work  
`node-red -p 2000 -u /home/pi/.node-red/red2000 /home/pi/.node-red/red2000/flows.json`

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [30 January 2023 12:52 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/4 "2023-01-30T12:52:00Z")

</div>

These both ways work:  
Using an extra directory and extra port for the "Edit" task:

```auto
~ $ node-red -p 2000 -u /home/pi/.red2000
 --> [info] User directory : /home/pi/.red2000
 --> [info] Flows file : /home/pi/.red2000/flows.json

```

Having the extra directory in the "default" directory:

```auto
`~ $ node-red -p 2000 -u /home/pi/.node-red/red2000 /home/pi/.node-red/red2000/flows.json`
 --> [info] User directory : /home/pi/.node-red/red2000
 --> [info] Flows file : /home/pi/.node-red/red2000/flows.json

```

I wonder what advantages one or the other method has?!

---

<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:** [30 January 2023 17:41 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/5 "2023-01-30T17:41:49Z")

</div>

Well diagnosed. The problem arises when the user directory is a subdirectory of the default. In fact that is not a good idea. I think npm will look in directories above the current one when loading modules, so putting flows in a subdirectory of the default is not a good idea, it could cause confusion. Therefore, I suggest using your first example, keeping the folders separate.

I am not sure whether this is a bug in the node-red command or not.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [31 January 2023 17:10 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/6 "2023-01-31T17:10:51Z")

</div>

Just to complete the possibilities:  
Here is another flows.json in the "default" directory and then started on a different port:  
`~/.node-red $ node-red flows_1304.json -p 2000`  
The "default" flows was started before and has no problem with this second start.  
So now the second flows is not started in a sub-directory, but in the same directory as the default flows.json.  
@colin: Does npm have similar problems as mentioned above, or is this cleaner?

---

<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:** [31 January 2023 17:30 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/7 "2023-01-31T17:30:07Z")

</div>

Running it that way will use the same node\_modules folder (where additional nodes are installed) and package.json and package-lock.json, which are where the node dependencies are kept. If your second flow is similar to the original, so they require all the same additional nodes, then that should be ok as far as npm is concerned. However, node red keeps status about, for example, the current settings in the editor (in the .config files) so node-red might get confused if you had editors open on both flows at the same time. Also, and possibly more serious, if you use file based persistent storage then they would be both using the same context files (in .node-red/context) which would be disastrous I think. So I think this is a bad idea.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [31 January 2023 19:30 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/8 "2023-01-31T19:30:39Z")

</div>

So, bottom line:  
-- start "default" with  
`~ $ node-red` goes with `.node-red` directory

-- start second/next project with the other port like this:  
`~ $ node-red -p 2000 -u /home/pi/.red2000`

The `.red2000` directory would be build just with a `cp` of `.node-red`  
Both projects work with "flows.json" in their respective directory

---

<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:** [31 January 2023 21:14 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/9 "2023-01-31T21:14:31Z")

</div>

I think so, unless someone else pipes up with other ideas. One exception, though, if you want to run the same flows on multiple ports (though I am not sure why you would do that), then you can just use  
`node-red -p 2000`  
It would not be advisable to run the editor on both at once though.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [31 January 2023 22:59 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/10 "2023-01-31T22:59:24Z")

</div>

It's just about running a working Flows.json on one device (e.g. RPI) and at the same time being able to use it with different devices (PC, Mobile, etc) using the Dashboard /UI.

It is NOT about using more than one editor instance to manipulate this Default Flows.json.

The goal is to be able to use other Flows.json with Editor and /UI during the default operation (Editor and /UI). This obviously makes sense only with different ports and separate directories.

---

<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:** [1 February 2023 08:23 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/11 "2023-02-01T08:23:21Z")

</div>

Understood. That should be fine.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [1 February 2023 09:12 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/12 "2023-02-01T09:12:30Z")

</div>

Another option might be to use the Projects facility in Node-RED.  
Create a new project and cut-and-paste your flow into it.  
 ![project_option](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/c/8c435e1267fc4b5c71174f6e1244ed5fde7d0e27.png)

---

<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:** [1 February 2023 10:16 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/13 "2023-02-01T10:16:35Z")

</div>

I think you can only run one project at a time using projects, I believe @gNeandr wants to run one while working on another.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [1 February 2023 10:31 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/14 "2023-02-01T10:31:20Z")

</div>

Oh - I see what he means (now). Yes - you can only run one project at a time.

---

<div class="post-metadata">

**Author:** ![gNeandr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gneandr/32/73947_2.png) [@gNeandr](https://discourse.nodered.org/u/gNeandr)\
**Post date:** [1 February 2023 11:52 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/15 "2023-02-01T11:52:32Z")

</div>

The real question is: How can a nodeRED installation on a computer (e.g. RPI) be used in a way that a running project can be executed and on the other hand further work on other projects can be done.

See on page: [Projects : Node-RED](https://nodered.org/docs/user-guide/projects/)

> Open an existing project  
> Node-RED only runs one project at any time. By opening another project you change what flows are running.

This is probably not the separation that is desired here.

See also [Deploy a nodeRED project](https://discourse.nodered.org/t/deploy-a-nodered-project/74549)

---

<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:** [1 February 2023 15:19 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/16 "2023-02-01T15:19:01Z")

</div>

> [@gNeandr](#):
>
> a running project can be executed and on the other hand further work on other projects can be done.

Yes, multiple directories alongside .node-red, not below it, is the way to go I think.

---

<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:** [2 April 2023 15:19 UTC](https://discourse.nodered.org/t/work-with-deployed-flows-on-ui-and-run-the-editor-for-different-flows/74366/17 "2023-04-02T15:19:38Z")

</div>

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