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

11 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

6 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