# Flow management and backup

**URL:** <https://discourse.nodered.org/t/flow-management-and-backup/4734>\
**Category:** General\
**Created:** [10 November 2018 07:29 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734 "2018-11-10T07:29:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [10 November 2018 07:29 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/1 "2018-11-10T07:29:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [10 November 2018 09:39 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/2 "2018-11-10T09:39:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [10 November 2018 17:17 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/3 "2018-11-10T17:17:54Z")

</div>

@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 😁

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [11 November 2018 11:44 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/4 "2018-11-11T11:44:57Z")

</div>

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

> [@Sineos](#):
>
> - 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

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?

---

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [11 November 2018 21:23 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/5 "2018-11-11T21:23:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [11 November 2018 22:17 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/6 "2018-11-11T22:17:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sineos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sineos/32/3440_2.png) [@Sineos](https://discourse.nodered.org/u/Sineos)\
**Post date:** [12 November 2018 05:47 UTC](https://discourse.nodered.org/t/flow-management-and-backup/4734/7 "2018-11-12T05:47:01Z")

</div>

> [@craigcurtin](#):
>
> 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 ?

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?
