Can i run two instance of NR on the one machine?

#1

Guys,

Starting to get quite a lot of stuff on my dashboard now (not exacrtly asthetic yet !) but lets say i want to give access to only a certain portion of the dashboard to someone else (for instance the control of the home theatre lights, projector etc) i know NR is only single user, so would it be possible to run a 2nd instance on a different port/username/directory on the same system to present a minimal system to my kids - or is there a better approach ?

Essentially a Single page with say 8 to 10 widgets to control lighting, projector on/off, raising and lowering of the projector and for putting the home theatre into different modes (party, movie, etc etc)

Craig

#2

I run up to 6 different instances at once, depending on the projects I have going... so "yes". Each one has its own userdir and port number, so they can be running at the same time. Using separate directories for each project also allows me to have different 3rd party nodes installed just where I need them (or not), and even allows me to have different versions of node-red or dashboard running.

The only tricky part is keeping track of which port # is assigned to each project! Since I'm running on Windows, I created a little 1-line node-red-run.cmd script that takes the name of the project as the first arg --

node node-red\red.js -v -u node_red_%1 --title red-%1

Next to that I have all the project folders, named node_red_proj1, node_red_proj2, etc. Then I can drop a short-cut to that script onto the desktop with the project name argument.

I keep thinking about setting up an Nginx reverse proxy to map each project url to its port (so typing http://localhost:1880/proj1 would actually go to http://localhost:18801/admin) -- not hard, but I have not accomplished that yet :*(

#3

Excellentt thanks Steve.

I am tossing up with doing a live install or running a couple of docker instances - have you tried the docker method ?

Craig

#4

Personally, I have not used docker, but I've seen many people mention it here and on slack... I'm sure one of them will help you out soon!

#5

Not sure if this is possible or not, but as each page of your dashboard has a number e.g

192.168.1.234:1880/ui/#/1
192.168.1.234:1880/ui/#/2

Maybe there is a way to create a dedicated dashboard page for your kids, and see if you can embed / that page via a different URL/address

#6

I think that Docker is only worth it if you are already into it as a technology. It does come with considerable overheads so you may start to struggle on a limited device.

I've described in a few places, my own installation of NR which easily facilitates multiple installations and the port numbers are the only minor issue and easily handled by including the port as an environment variable picked up by settings.js. Again, I posted an example recently. Let me know if you need me to redo it.

You can even have different NR versions quite easily which can make migration to new major versions easier.

#7

Will check it out thanks Julian - will dig back in the recent posts.

I am in into Docker for a whole heap of things - looks like it would be brilliant for this application, so may start there and see how i go

I am not resoource constrained (i operate a VMware cluster at home) so these are all good on a Ubuntu VM - or i could even spin up a second one to play on - so many options

Craig

#8

I may be able to do something with Nginx/Reverse Proxy to rewrite the address and obfuscate - may be enough to keep them away

Will play with that as an option

Craig

#9

OK, so Docker might be good for you then. Especially as you could have NR in a main file then reuse it as long as you have your data in separate files.

Yep, NGINX or HAproxy are great ways to manage the addresses and ports if you need to. I've done that with other Node.JS microservices. You can even use Phusion Passenger to keep everything efficient and running. NGINX is also good for adding a TLS endpoint rather than trying to do it in Node-RED itself. You can add other security too at that layer.

#10

Hi Steve,
I see by your description you are running Node-RED on Windows.
How do you think your set-up would work on a Raspberry Pi ??
i.e. Would a RPi-3+ have enough processing capacity to run multiple instances of Node-RED?

I tutor an after-school IoT Computer club where we have a random collection of six Raspberry Pi(es) [ RPi-Bs, RPi-2s, RPi-3+ and RPi-Z-Ws) with two students sharing a Pi (so I can handle a maximum of 12 students).

Your idea would make things a bit simplier to handle (I'm sure the students could handle different IP and Port numbers).

Cheers from David.

#11

Normally, if pair-programming, I'd have 2 students working on the same code and sharing ideas

This is particularly true if working with physical computing on a Pi as they'd both be accessing the same GPIO pins so generally couldn't program them simultaneously

If you wanted them to take turns then 2 separate tabs for their flows would be sufficient rather than go to trouble of 2 Node-RED instances I'd thought

Simon

1 Like
#12

Hi Simon,
Thanks for your suggestions.
The Raspberry Pi(es) are just used as "servers" for Node-RED and MQTT,
the students each have a WeMos D1 Mini (WiFi-based ESP8266) that
communicate with Node-RED via a PC.
What I do is insert WiFi dongles in 6 PCs in the IT room, so the
students can use Node-RED in a browser in the PC.

I think I'll stick with your suggestion of 2 students per PC rather
than trying to run multiple instances.

Thanks again for your input.

Regards, David

#13

Solid point. Sounds like running multiple instances on one Pi is not worth the effort or time... and could increase the time it takes to upgrade to new sw versions.