DEV Community

Cover image for Advanced Setup Of Node-RED In Easy Steps
šŸ’» Bleeding Code-By John Jardin
šŸ’» Bleeding Code-By John Jardin

Posted on

Advanced Setup Of Node-RED In Easy Steps

In this article I'm going to show you how to install a Node-RED Server that includes optional advanced capabilities, that are not available by default with the standard installs mentioned in Node-RED's documentation.

If you're following my Up and Running with Node-RED series, you'll know that my intention is to teach you how to use Node-RED as a tool for business app development and integration, instead of just home automation and hobby-based projects. To achieve this, we cannot setup Node-RED the traditional way, which is installing it as a global module on our local machine. We need more control and flexibility. For example:

  • To run multiple instances of Node-RED
  • To containerize and deploy to various on-prem and cloud environments
  • To integrate with 3rd party services

Everything needs to be achievable from one Node-RED instance, and today's install will give us just that.

Watch Video OnĀ YouTube

Node JS and NPMĀ Required

To start, you need to have at least Node JS 12.18 or higher installed on your machine. If you have an older version or don't have Node installed, I highly recommend using a Node Version Manager to be able to install one or multiple versions of Node. There are many great Version Managers out there, but for an immediate recommendation, NVM is one that we at Agilit-e use and it works very well. Not only will you be able to easily switch between various versions of Node, but NVM also takes care of permission issues on your Operating System that sometimes occur when installing Node directly.

Find "agilite-node-red" onĀ GitHub

Now, the boilerplate Node-RED server we're going to be using can be found on GitHub and is called agilite-node-red. This repo is maintained by the team at Agilit-e and provides the control and flexibility mentioned earlier.

Download RelevantĀ Version

Once the boilerplate repo is open in your browser, switch the branch from Master to 7.3.1. This is the current boilerplate version as per the release of this article, is compatible with Node 12.18 and runs Node-RED 1.3.4. Should you be reading this article long after it was released, you can switch to newer branches which will support upgraded versions of Node and Node-RED. Reference the README file for these versions.

Once you've switched to branch 7.3.1, click on the Code button, following by clicking on download zip to download the boilerplate to your local environment. One downloaded, extract the zip file, which will extract the boilerplate to a folder called agilite-node-red-7.3.1.

Install NodeĀ Modules

Via your Terminal or Command Prompt, navigate to the boilerplate folder and run the following command npm ciā€Š-ā€Šonly=production. This installs the main project dependencies based on the package-lock.json file and ignores the dev dependencies which you don't need. This ensures the boilerplate's node modules are installed the way we intended, to avoid possible inconsistencies and problems.

Once the NPM install is complete, enter the command npm run main. This starts up the Node-RED server, which you can now access by opening your preferred web browser and entering the URL: http://localhost:6020. If all was successful, you will see the Node-RED Editor open in your browser's window. You are now ready to start using Node-RED.

Closing

As mentioned before, this boilerplate offers everything of Node-RED and more, which I'll be taking everyone through step by step in my Up and Running with Node-RED series. So if you haven't yet, be sure to subscribe to my YouTube channel, or alternatively follow me on this site. In the meantime though, I welcome you to peruse the configuration for this boilerplate, which can be found in the config/templates folder, in a file called default-config.json. This is where much of the magic happens, but more on that very soon.

Until next time thoughā€¦cheersĀ :)

Top comments (0)