Node-red flow for archiving to dropbox

Just been working on a new node-red flow, to perform backups to dropbox if anyone is interested.
I’ve added the flow as a gist - A node-red flow which runs an archive routine, uploading data to Dropbox for safe keeping! · GitHub

The flow was predominantly written to run a nightly archive of emoncms data directories, emoncms MYSQL database, and the entire node-red user directory, uploading them to dropbox for safe keeping, but can be easily adapted for other data sources.

The resultant tar.gz files will include the ‘day of the week’ in their title, so you can quickly identify the relevant archive to restore, and at the end of 7 days, the file will be overwritten with the current day’s data. (However Dropbox retain 30 days worth of file versions - more on paid accounts, so it’s easy to locate and restore archives up to 30 days old).

For emoncms/emonpi users - please note that by default, this flow assumes that all of your data sub-directories are included in one directory which will be archived . Also, further commands would need to be added to change the filesystem to read-write, and back to read-only (easy to do - just see examples in the Generate commands node.

Requires the library fs-extra installing & enabling
globally in settngs.js (used in Read Filenames function node).
This is a really useful library to have anyway as it makes node.js much more functional in node-red, see here.


cd ./node-red  
npm install --save fs-extra

Add fse:require('fs-extra') to the
functionGlobalContext section in NR settings.js file.

Edit the Generate commands function node with
your own;

  • Emoncms data directory path
  • Emoncms MYSQL username (default = emoncms)
  • Emoncms MYSQL password

Setup the dropbox node, (details in the node info)
Also edit the Start backup inject node with your preferred time to run.
If you want to be alerted about archive problems or failures, you can use the Report any errors node output to dispatch the message via Pushover, email, twitter or whatever. Currently, the msg.topic is the message title, and msg.payload is the error message.



Hi Paul,

I have just rebuilt my emonpi and i am trying to setup the dropbox backup, I used an old script but i am looking at your node red version, I have added the fs-extra. when i import the flow i am see an error

Any ideas?

Have you added the Dropbox node to your node-red palette?


That solved the problem. :slight_smile:

Great idea. However, I assume that the NR instance must be running on the same machine?

Yes, correct.