Automatic flow backups to GitHub

Hi There,

I built a flow that automatically commits flow data to GitHub using their API. I needed this since I'm using a disk-less server so I couldn't use the project feature of Node-RED.

For those interested, the flow is over here - all requirements and details are described there.

Cheers!

2 Likes

Cool. :slight_smile:

The flow can be triggered whenever its required. I haven’t yet found a way of triggering it after a deploy since there isn’t an event triggered after the completion of deployment.

THere is a deploy event. Couldn't you simply track that and then add a small timeout delay? In fact, I think the function fires AFTER the deploy - though I'm not totally certain.

RED.events.on('deploy', function() {
     console.log('Deployed')
})
1 Like

Cheers, didn't see that event in the codebase but can confirm, definitely works :+1:

Based on that event, here's a flow that captures that event and can be used to trigger the GitHub backup. The only problem is that the event listener needs to be installed in the browser. For that the frontend code needs to be "deployed" to the browser - hence an inject needs to be triggered one time.

2 Likes

One more flow for the visual comparison of flow revisions. The flow provides a http endpoint for accessing the last 30 revisions of flow backups and allows comparing any number of them against each other. Comparing exactly two flow revisions activates detailed textual differs for more accurate comparisons.