I am experimenting with different node-red instances. I know that the topic is discussed muiltple times here and i read a lot about it. I hope my questions are not to dumb. I try to aks a couple of understanding questions, followed by practical turn of mine and post my experience.
When i installed node-red i followed this guide like many in here: Running on Raspberry Pi : Node-RED.
i installed node-red as a root.
So now i have a folder like "root@m65vbr:~/.node-red".
Question: Since i installed node red as root (in my root folder) node-red is now globaly installed right?
I now created a folder called "node-red-1881" (root@m65vbr:~/node-red-1881#). From my research when i am now IN the folder and run the following "node-red -u /node-red-1881 -p 1881" this should create its own instance in this folder?
Since i want the "globaly" instance ".node-red" be my master i read that the best practice to share the node_modules (where all installed nodes are stored) is to do a called "softlink" to this folder. When i now update there for example a node, this should effect evey instance. Correct?
If you really followed that, you would NOT have install as root!
You don't need to install as root or sudo to have multiple instances. Just run the node-red command with different command lines.
If you want an easier life, the ability to spin up as many node-red as you wish, then I can recommend FlowFuse - here's why: https://youtu.be/KOnQnR7yfT0?si=p3H0Ff5q_kbvEgXf
(Ps, I work for FlowFuse)
You haven't really explained WHY you want to do this and it could make quite a difference to our responses.
For example, if you need multiple instances (lets say for a group of people) but all with the same config but different flows, things will need to be slightly more complex. But there are several ways around that.
You should also note that you can install nodes outside Node-RED's userDir folder and this can still work. Along with that, you may find it helpful not to do a global install of Node-RED at all. But rather install node red locally with a pattern something like this:
# log in with the user id that will run node-red - I'll assume a UNIX-like OS here
npm install node-red --production --unsafe-perm
# ... these will become your user dir folders
# now install the nodes you want - in this folder, not the user-dir folders
npm install node-red-custom-xxxxxxxxx
# Finally create a series of startup commands (or better still systemd scripts)
# where each instance started uses this node-red but with custom port and userDir arguments
This is only one approach of course, there are others that would also work. But it saves you from having to mess with soft links.
One of the problems of using soft-linked
node_modules folders is that any of the instances you run up will still be able to install nodes which could get seriously confusing.
The install script always installs node red globally.
It depends on what you are trying to do. What are you going to do with the multiple running instances?
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.