Note: Working Notes
Node red uses a settings file called settings.js located in in the user .node-red folder in their home directory.
You can create your own settings file and customise it either by copying the existing file or using the file available from Github here.
On Linux the settings.js file is copied from the /usr/lib/node-modules/node-red/ folder to your .node-red folder in your home directory when you start node-red and there is no settings.js file is present.
On windows if no settings.js file is present in the home folder then the node-red start process stops with an error.
To use your own settings file use the -s switch when starting node-red e.g.
node-red -s mysettingsfile.js
If you place a settings.js in the .node-red folder that will be used by default.
The documentation here takes your through the settings file in detail.
Other Command line Options
Node red has a very limited number of command line options. use:
The -p switch will let you change the port the node-red admin interface uses.
Flow File Storage
Flows that you create are stored by default in a file in the .node-red directory of your home folder in a file called flows_seevername.json.
The file is created when you run node-red for the first time and is loaded when you run node-red.
EG. for my raspberry pi the file is flows_raspberrypi.json.
You will also see these files.
flows_raspberrypi.json.backup – This is a backup of the flows_raspberrypi.json file, and functions like a word backup.
When you do a deploy the old flows_raspberrypi.json file is moved to the backup file and the flows_raspberrypi.json is overwritten.
This means that you can recover from a mistake if you notice it after 1 deploy by using the flows_raspberrypi.json.backup file.
flows_raspberrypi_cred.json. – This file contains login data used by some nodes. If it is not present the flows will still work but you will need to add the information back in to any nodes that need it.
flows_raspberrypi_cred.json.backup – Backup of flows_raspberrypi_cred.json and functions the same way as the other backup.
All of the flows in your workspace are stored in the flows file.
Moving Your Flows to Another Machine
You can copy all of the flows by copying the flows_newmachinebane.json. file.
To use them on another machine change the file name to flows_newmachinebane.json.
The only file you really need is the flows_raspberrypi.json file however you should also copy the flows_raspberrypi_cred.json file.
See this github page for other important files and folders.
Creating New Flow Files
You can created additional flow files for storing different workspaces. In order to do that you will need to create a new settings file and edit it.
As an example if I wanted to create a separate flows file to store client flows I would :
- copy the old settings file to a new one called client_settings.js
- Edit the settings file to point to the new flows file and remove the two forward slashes.
// flowFile: client’flows.json’,
- Start node-red using
node-red -s client_settings.js
Command Line Admin
You can administer node-red from the command line by installing the node-red-admin tools.
sudo npm install -g node-red-admin
Even though you may not want to administer node-red this way you will need the tools if you need to create passwords for node-red users.
Security Settings- Requiring Username and Password Authentication
There are three places were you can configure authentication.
- The Admin console- Node red editor
- Static Pages
This is covered in this tutorial
You can add additional nodes to your node-red dashboard using
- Node-Red editor
npm install -g package-name
Or to install for your user i.e.locally. Go to your home directory and type
npm install package-name
In the node-red editor go to menu>manage palette and click the install tab and then type the package name or type in the search box to search for a package.
The node should appear in the node list
Related Tutorials and Resources:
- How to copy Node-Red Nodes and Flows
- How to safely expose Node_red to the Internet–
- Understanding the Node-Red Message Object
- Storing Data in Node-Red Variables