# Automatically import and deploy a flow

**URL:** <https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295>\
**Category:** General\
**Created:** [20 October 2022 04:38 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295 "2022-10-20T04:38:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 October 2022 04:38 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295/1 "2022-10-20T04:38:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [20 October 2022 05:31 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295/2 "2022-10-20T05:31:40Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 October 2022 06:31 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295/3 "2022-10-20T06:31:50Z")

</div>

> [@bakman2](#):
>
> create a "watchdog" - outside of node-red

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.

---

<div class="post-metadata">

**Author:** ![Rgrove](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rgrove](https://discourse.nodered.org/u/Rgrove)\
**Post date:** [20 October 2022 14:28 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295/4 "2022-10-20T14:28:51Z")

</div>

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...

Thanks!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 October 2022 16:11 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295/5 "2022-10-21T16:11:16Z")

</div>

Nick did write this blog post a while back - that uses the Balena free tier.. [Deploying Node-RED applications to devices using Balena · knolleary](https://knolleary.net/2018/09/27/deploying-node-red-applications-to-devices-using-balena/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 November 2022 16:11 UTC](https://discourse.nodered.org/t/automatically-import-and-deploy-a-flow/69295/6 "2022-11-04T16:11:52Z")

</div>

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