Q about backing up workspace

Hi All,

My project has grown to over 30 nodes, prolly still considered "small", but to me it represents a lot of work! I'd like to know the correct way to back up the entire project. I'm making some assumptions here:

Is it as simple as exporting the flow to a file?

Does "ctrl-a" get everything together enough to export?

I'm on a diff 'puter on my network, where does the file get saved?

Thanks!

Russ

If you have access the device running Node-RED, then a minimal backup would be to copy the files:

  • ~/.node-red/package.json
  • your flow and credential files (check the Node-RED startup log to get the exact filename)
  • your settings file: ~/.node-red/settings.js

If you have not set the credentialSecret property in your settings file (there's a big message in the log on startup telling you to if you haven't), then you'll also need to copy the value of _credentialSecret out of ~/.config.runtime.json (or .config.json if on Node-RED 1.1 or earlier).

For the majority of cases, that would get you everything you needed to restore your flows elsewhere.

If you don't have access to the device running Node-RED, then you will be able to export your flows as JSON from the editor, but it will not include an credentials. You'll also have to take a manual record of the extra nodes you have installed.

I am getting the credentials message as I've not done that. Is this considered important to do?

Right now, my flows are great. I'm afraid I'm so rookie I'll "trash the works" trying new stuff. Would like to be able to get back to a safe breakpoint on the same pi. So ctrl-a and export flow for that?

As far as making a backup restorable to a new or formatted pi, the steps you list will have all the current palette nodes and UI settings? Just replace said files with the backups once N-R has been reinstalled?

Would this feature be a worthwhile addition to a future N-R upgrade?

Thanks!

Russ

We wouldn't print out a large message in the log advising you to do it if we didn't think it was important.

If you don't set your own credentialSecret in your settings file, then you are using a randomly generated key. If anything happens to lose that generated key, you won't be able to decrypt your credentials file ever again and you'll have to re-enter any credential properties through-out your flow.

By setting your own key, you know what it is and will be able to restore things should something go awry.

In terms of restoring a system with those files, the basic process would be:

  1. copy those files back in ~/.node-red on the new device
  2. run npm install in the ~/.node-red directory in order to reinstall all of the extra nodes you had (they are all listed in the package.json file, which is why you backed that up)
  3. run Node-RED.

You may find you need to hardcode the flow file name in your settings file to ensure it picks up the right file.

1 Like

Upon reading thru my settings.js file, it appears the "credentialSecret" value can be set to false. Would this be OK for a solo'er like me who uses N-R on a the pi and writes to N-R from a Windows box on my home network? At 67, I'm trying to keep the complexity to a minimum...

Russ

It's your system and you can do whatever you want :wink:

But the advice is to set a credential secret, because if you don't, your credentials will be encrypted using an auto generated key (and you won't know what it is!).
Then if you try to restore node-RED from a backup, you will have problems de-crypting.

In the long run it will save you problems.

Even a simple plain password will do;
credentialSecret: "RASelkirk",

I'll put something in there. So, setting to "false" does nothing but turning off the nag message?

Thanks!

Russ

As I understand, setting to false stops the credentials being encrypted (and the nag messages), and therefore your credentials would be stored in plain text, which could potentially create a security risk.
It's better/safer to have them encrypted.

Paul

No, it's done. It's just so danged hard to find this stuff in the documentation section!

Here's another newbie Q: I've got N-R on my pi but am actively building on my Winbox. So far, I've "saved" a half-dozen nodes while on the Winbox, but when I try and import one, there are only two showing and both if those are on the pi. So, where are the files saved on the Winbox? I'm guessing I need to eventually transfer them to the pi, but gotta find them first...

Russ

If it's a different issue, it should be a new thread Russ.
A lot of users just scan the thread titles, and therefore you stand a better chance of a reply.
Also, it makes the information easier to find by other users in the future.

Yup, thanks!

1 Like