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.
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?
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
cd ~
mkdir nodered
cd nodered
npm install node-red --production --unsafe-perm
mkdir data1
mkdir data2
# ... 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.