Skip to content

How to backup flows and related configuration

Julian Knight edited this page Apr 28, 2017 · 5 revisions

Where are things that need backing up?

If Node-RED has been installed as standard, all user files should be contained in ~/.node-red unless the userDir setting has been changed in ~/.node-red/settings.js. ~ refers to the home folder of the user that runs Node-RED. (on Windows, ~ is available in PowerShell but in the older cmd shell, you should use %USERPROFILE% instead).

It is also possible to start Node-RED with parameters that override the location of the userDir (--userDir or -u) and/or the settings.js file (--settings or -s).

What needs backing up?

For full safety, everything in in the userDir should be backed up except the folder called node_modules.

Important files

Here is a list of the critical files to backup. However, it is not safe to assume this is all that is needed.

  • flows_*.json & flows_*_cred.json

    These define the flows and any credentials stored for the flows. The * indicates that the actual file is named after the machine name you are running on. If you have transferred from another machine name, you might have multiple files though only one set will be active. In addition, there are *.backup versions of these files. Node-RED copies the old active flow/cred files each time you deploy.

  • .config.json

    This contains the current configuration being used. Includes a list of all of the modules and node types that are being loaded with their versions.

  • settings.js

    Defines the user global settings for Node-RED.

  • package.json

    If used (will be standard from Node-RED version 0.17), defines the extra npm modules installed such as node-red-contrib-* nodes.

  • libs folder

    This contains snippets of flows and JS code saved from the Node-RED admin UI as part of the "Library" feature.

  • .sessions.json (if it exists)

    Session information

  • nodes folder (if it exists)

    Not used as much now but allows manually installed nodes.

How to restore

TBC

Firstly start by restoring the backup to ~/.node-red or your chosen userDir.

If you have maintained a package.json, you can then:

cd ~/.node-red
npm install

Then start node-red and everything should be back to where you started.

If you haven't maintained a package.json, you will need to install each required module. If you miss one that is in use in your flows, Node-RED will warn you on the console output.

You can’t perform that action at this time.