Flow management and backup

Is there a way to:

  1. Get a flows name
  2. Export a flow's json within a flow
  3. Catch a deploy event, i.e. do something on / after each deploy?

I know about the projects feature (which is great btw.) but I would like to do without.

Have a look here:
https://github.com/cflurin/node-red-contrib-dsm/wiki/Backup

1 Like

@cflurin this is a very interesting concept. Many thanks for developing this and for sharing. I think I might rework my blind controls with this, because this seems like a nice fit for following states:

  • manually opened or closed
  • currently opening / closing
  • automatically opened / closed by weather conditions

For my current intent (if I'm not misinterpreting it) it will not exactly do what I want:

  1. General time triggered backup of the flow.json files and settings: Already done using exec nodes
  2. Deleting old backups once more than x days or y backup files: Also already done with exec and shell commands
  3. I would like to create a backup of a given flow, once / after this flow is deployed. My intended workflow would be:
  • trigger after deploy
    • get the deployed flow's name
    • export this flow as json to file, just like the menu export to clipboard
  • limit number of backups either by count or date

So I'm currently stuck on the flow's name, flow export, catch deploy event.

Background for this is simply my chaotic editing style. Hitting deploy and then having changed a lot of things that would just not work and have to reverted :grin:

That's right, it's just the way I'm using it for my backup.

What do you mean by flow's name, the node-red flow (flow_xxx.json in the user dir) or just the flow you modified?

Just the flow I modified. I typically use to deploy only the modified flow and I would like to get the name as shown in the flow's tab

But all the flows live in the same file - so arent you going to be backing that one file up - or are you going to strip the flow out and storw it seperately ? - Can this even be done ?

I would suggest you would be better off backing up the whole flow file and then putting it into a dated subdirectory, then including a descriptive text file (generated by a node) that would include the info on what had changed in that backup

Craig

This is exactly part of the question. Via the "Export to Clipboard" menu it is possible to grab just the current flow. Is this possible from e.g. a function node as well?