Multiple node red instances

What is the best way to run multiple node-red instances? As far as i can find a different port is needed for every instance. Is sharing the setting.js file and or node_modules a good option? Or is it advised to make multiple folders?

For now i am using: node-red -p 1881 -u C:\Users\xx.node-red test.json and node-red -p 1881 -u C:\Users\xxx\Test2

It depends on your use case.

In my setups I am using one Node-RED installation and launch different workspaces with -u, each with their own dependencies, settings.js, flows.json and so on.

Structured like this:

.
โ”œโ”€โ”€ apps
โ”‚   โ”œโ”€โ”€ node-red -> node-red_1.0
โ”‚   โ”œโ”€โ”€ node-red_0.19
โ”‚   โ”œโ”€โ”€ node-red_0.20
โ”‚   โ””โ”€โ”€ node-red_1.0
โ””โ”€โ”€ workspaces
    โ”œโ”€โ”€ node-red-controller
    โ”‚   โ”œโ”€โ”€ flows_cred.json
    โ”‚   โ”œโ”€โ”€ flows.json
    โ”‚   โ”œโ”€โ”€ lib
    โ”‚   โ”œโ”€โ”€ node_modules
    โ”‚   โ”œโ”€โ”€ package.json
    โ”‚   โ”œโ”€โ”€ package-lock.json
    โ”‚   โ””โ”€โ”€ settings.js
    โ”œโ”€โ”€ node-red-dashboard
    โ”‚   โ”œโ”€โ”€ flows_cred.json
    โ”‚   โ”œโ”€โ”€ flows.json
    โ”‚   โ”œโ”€โ”€ lib
    โ”‚   โ”œโ”€โ”€ node_modules
    โ”‚   โ”œโ”€โ”€ package.json
    โ”‚   โ”œโ”€โ”€ package-lock.json
    โ”‚   โ”œโ”€โ”€ settings.js
    โ”‚   โ””โ”€โ”€ static
    โ”œโ”€โ”€ node-red-telegram
    โ”‚   โ”œโ”€โ”€ flows_cred.json
    โ”‚   โ”œโ”€โ”€ flows.json
    โ”‚   โ”œโ”€โ”€ lib
    โ”‚   โ”œโ”€โ”€ node_modules
    โ”‚   โ”œโ”€โ”€ package.json
    โ”‚   โ”œโ”€โ”€ package-lock.json
    โ”‚   โ””โ”€โ”€ settings.js
    โ””โ”€โ”€ node-red-test
        โ”œโ”€โ”€ flows_cred.json
        โ”œโ”€โ”€ flows.json
        โ”œโ”€โ”€ lib
        โ”œโ”€โ”€ package.json
        โ””โ”€โ”€ settings.js

Everything is managed with a PM2 ecosystem file.

After all it's not very different from your approach.

In my own case, I use my alternate installer so that each instance is self-contained & I don't have to mess with the package.json because it contains the startup scripts (npm start), the script doesn't need to change because the userDir for each instance is in the data subfolder.

As with Matthias's example, the advantage is that you can run each instance with a different version of Node-RED if you like. You could also adapt the start script to run a custom version of node.js if you needed to.

By the way @kuema, are you trying to copy my picture?! I've only just noticed that you also have an archery image but facing in the other direction :smiley:

Looks like a standoff when you two guys get chatting...
image

10 Likes

Julian (@TotallyInformation), I have been using that picture for a while now, and you have noticed just now? :grin: But in fact, that was not intentional. I used it as my Github avatar, so it got moved over here when I signed up at the forum. The difference is, I'm a lefty. :nerd_face:

1 Like

There have been even funnier constellations... so try not to get in between :see_no_evil::joy:

image

5 Likes

...FWIW, I am using node-red in a docker install.
This way I can have as many instances as i want/need, each looking like a separate host install, including individual IPs .. no need for mapping ports and everything

2 Likes