Email flows.json as a backup

I have installed Node-RED v1.1.3 using Docker and data is stored in /data

so my flows.json is stored in /data/flows.json

You have two options to take backup.

  1. You can save JSON object to your DB
  2. Email file (flows.json) to your personal email

I hope this will help you guys to backup your flows.json

Cheers,

Kunal Kamble

[{"id":"93798b59.d1e448","type":"e-mail","z":"c1aa1a88.31fcf8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"[email protected]","dname":"Email Flow","x":650,"y":180,"wires":[]},{"id":"b7188813.bae308","type":"file in","z":"c1aa1a88.31fcf8","name":"flows.json","filename":"/data/flows.json","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":310,"y":140,"wires":[["7e0bb26.04a9f4c","d9fd1fb6.e4f35"]]},{"id":"244b96f9.09b36a","type":"inject","z":"c1aa1a88.31fcf8","name":"Cron","props":[{"p":"filename","v":"/data/flows.json","vt":"str"}],"repeat":"","crontab":"00 16 * * *","once":false,"onceDelay":0.1,"topic":"","x":170,"y":140,"wires":[["b7188813.bae308"]]},{"id":"fc47dffa.12634","type":"debug","z":"c1aa1a88.31fcf8","name":"Save to DB","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":100,"wires":[]},{"id":"7e0bb26.04a9f4c","type":"json","z":"c1aa1a88.31fcf8","name":"","property":"payload","action":"","pretty":false,"x":470,"y":100,"wires":[["fc47dffa.12634"]]},{"id":"d9fd1fb6.e4f35","type":"function","z":"c1aa1a88.31fcf8","name":"Email Body","func":"const date = new Date()\nmsg.attachments = [\n        { \n            filename: `flows-${date.getTime()}.json`,\n            content: msg.payload\n        }]\nmsg.payload = `<h1>Please find attachment for flow backup</h1>`\nmsg.html = `<h1>Please find attachment for flow backup</h1>`\nmsg.topic = `Flow backup - ${date}`\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":180,"wires":[["93798b59.d1e448"]]}]

Flow Info

Created 4 years, 11 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x1)
  • file in (x1)
  • function (x1)
  • inject (x1)
  • json (x1)
Other
  • e-mail (x1)

Tags

  • backup
  • flows
  • email
  • save
  • cron
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option