Automatically import and deploy a flow

Kinda like an Automatic software update.

I have a very difficult-to-reach Pi running NR, on a sometimes very spotty IP radio connection. I want it to pull in new flows, deploy them to itself, and restart.
If it gets short windows of IP radio time, I want it to do a quick log dump to a server, then if I need to change a flow, have it ingest the new flow json and load it.

Quick example; I was on site today, found an issue I need to correct in a flow, but I had to leave (can't stay on site in the dark in cold months). Now I'm home, finding the radio connection is dropping (possibly weather related) and I can't reliably work in the flow editor. If I could load a "self-updating" flow on my next visit, I could then change flows as needed while off-site, and it would grab them when it can reach the far end server.

Security is not a big concern, everything is pretty well firewalled, and the web interfaces are not secured anyway.

Couldn't find anything in the search that didn't require human intervention.

My approach would be to create a "watchdog" - outside of node-red - that checks (twice per day or something) if the remote flows file was changed compared to the local flows file, download it, put in the right place and restart node-red.

How can/does the remote Pi connect to your local machine ?

Or indeed inside node red, though it would be a little more resilient if it were outside, in case a flow with a disastrous error in it were downloaded, which prevented node red from running correctly.

1 Like

Great idea on the watchdog, I hadn't thought too deeply about it, but just lightly figured FTP a text file and then read it's contents. Or, copy in a new flow file, which fits exactly what you're saying.
FTP can be run from a scheduled bash script, then the script can act as a watchdog itself and reload an old flow if the previous update fails to launch.

Edit: thought the suggestion through better...


Nick did write this blog post a while back - that uses the Balena free tier.. Deploying Node-RED applications to devices using Balena · knolleary

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.