New project template for easy multi-instance installations

170 views
Skip to first unread message

Julian Knight

unread,
May 11, 2016, 4:16:59 PM5/11/16
to Node-RED
Hi all,

Earlier today, Dave pointed out Nat's interesting template for running in "local mode" which makes it easier to run multiple instances.

This prompted me to do something I should have done ages ago and that is turn my own installation and project approach into a template and publish it.

Whereas Nat's approach runs a sub-process, I use a very standard node.js approach.

I follow the "embedded" install approach outlined in the Node-Red docs which I find a simpler and more logical method of installation that, while possibly initially slightly more complex, in the long run seems simpler and more consistent to me.

The main advantage to the embedded method is that you can run entirely independent instances of Node-Red that can even be at totally different version levels. All of your nodes and other modules can also be at different levels. You can also take more control of the Express server. It is also very easy to clone your installation, something I do regularly before updating node-red or key nodes or even before making significant changes to the flows.

More information in the readme. Please feel free to raise issues and suggest improvements, pull requests as always welcome.


Please note that this initial version is as yet untested as I ripped it out of a live installation and then tweaked it heavily - as usual never enough time to do things properly. I'll be testing as soon as I can and when I'm happy, I'll bump the version to v1.0.0 - if you are able to test, that would be great.

Assuming it works, it is really easy to get going, simply clone the github repository, full instructions and guide to tweaking in the readme.

If you are not using git, simply download the zip file and unpack to a location of your choice.

Regards, Julian.

Nicholas O'Leary

unread,
May 11, 2016, 4:29:42 PM5/11/16
to Node-RED Mailing List
Julian,

being able to run different versions of node-red is by no means unique to the embedded version.

Personally, I just use the following package.json and nothing more:

{
    "name"         : "my-node-red-project",
    "version"      : "0.0.1",
    "dependencies": {
        "node-red": "~0.13.4",
    },
    "scripts": {
      "start": "node node_modules/node-red/red.js --userDir ./data"
    },
}

Change the node-red version to whatever you want, add any additional nodes you want and all just works.

But still, all examples are useful - I just don't want to give the impression that it takes any more than it really does.

Nick

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Dave C-J

unread,
May 11, 2016, 4:53:39 PM5/11/16
to node...@googlegroups.com
Julian,

can you document how you get the serialport (that needs root access) to install and work as well ?
Thanks

Julian Knight

unread,
May 11, 2016, 4:58:04 PM5/11/16
to Node-RED
Thanks Nick, I've updated the readme to reflect this, I've also added a reference to Nat's approach as well. There are always many ways to do things with node!

For reference, I've already updated the readme as I've now run some quick tests to confirm everything is working.

Julian Knight

unread,
May 11, 2016, 4:59:28 PM5/11/16
to Node-RED
Good point - I think I have some docs buried in my notebook, I'll check.

Julian Knight

unread,
May 11, 2016, 5:20:54 PM5/11/16
to Node-RED
I've added an "issue" for now to remind me to add to the docs when I get a chance. 

For people's reference, generally adding the user running Node-Red to the dialout group is sufficient to give access to the serial ports in Linux. Windows doesn't have that problem (or security!).

Some parts of Bluetooth are slightly trickier I seem to remember, I'll have to dig that one out.

Marko S

unread,
Jun 6, 2016, 4:46:43 AM6/6/16
to Node-RED
Emmm, so here with this package.json this is the way for running multiple versions of node-red and stuff.,...what about if I had installed node-red previous in a global way (-g) and the nodes also...what will happen if I'd try to install another one... And will node-red then be installed in some folder where I would run this command with the package.json file. (whats the correct command to do it).

Dne sreda, 11. maj 2016 23.20.54 UTC+2 je oseba Julian Knight napisala:

Julian Knight

unread,
Jun 6, 2016, 11:32:23 AM6/6/16
to Node-RED
Hi Marko,

There shouldn't be any problems doing both. I've done so on Windows.

Yes, a copy of NR would be installed in each project folder. This is normal for Node.js apps. Moving to Node.js v5 and npm 3 will help reduce the size of node.js apps and you don't need, of course, to back up or copy the node_modules folder since that can simply be reinstated with an npm install. The advantage is that you are free to have multiple different versions of node-red running side-by-side.

Nick's amendment - which I've added to the project information - provides a simpler method if you don't want to take control of node/express - but that still gives you the ability to have multiple versions installed in parallel.

Seb D

unread,
Sep 29, 2017, 6:24:00 AM9/29/17
to Node-RED
Hello. Just a few words to thanks Julian for this template.

I've paused my node-red project a couple of months ago and I'm going back to it. When I discovered node-red I asked myself this question about having a template repo to work on my node-red project, and I just found this thread and the Julian's repo
I'm pretty sure this is gonna achieve what I want and I'll probably add a Dockerfile in there.

Since it took me sometime to find this template, I wish there was a section on the node-red website that references some external template/tools from the node-red community. It's a just a suggestion not a complaint. But may be it's already there or on the github and I jsut missed it.

I'm also aware that Nick and his team are actively thinking about the project and version control aspect of node-red:

Thanks again
Reply all
Reply to author
Forward
0 new messages