Updating a Node-RED flow from the file system

Hello,

I would like to know if it is possible to update and deploy a node-RED "flow" just by modifying files.

Let me explain: If for example I have 10 machines with Node-RED, I would like to be able to update their flow and deploy it without having to go through the Node-RED GUI, but simply by modifying a file via SSH.

The idea would be to modify 1x the flow via the Node-RED GUI and then push the new flow + deploy it via SSH on the 10 other endpoints.

Is this possible?

Thanks for your help.

1 Like

Flows are just stored as a file on disk - so you could certainly scp your flows (and credentials) files to all of the devices and then restart Node-RED on each of them to pickup the changes.

Okay. And do you know where the file contains the "Flow" Node-RED on the disk?
Thank you

Node-RED logs the full path of the flow file it is using when it starts. It will typically be in ~/.node-red

1 Like

I saw that the flows are saved in the following file: "/root/.node-red/flows_.json"

I've taken the following steps:

  1. Realization of a flow in Node-RED
  2. Deploy the Flow
  3. Copy the file "/root/.node-red/flows_.json" to a temporary directory
  4. Delete the flow in Node-RED
  5. Deploys the changes
  6. Copy the ".json" file from the temporary folder to "./node-red".

After that, I don't see the old flow in Node-RED again. How can I make Node-RED read this file and display it to me again without using the Node-RED GUI and the "import" function, but just by copying this file ?

I looked, and it seems that the "flows_.json" file is the only file that is modified when I modify a flow and click on "Deploy".

You need to restart Node-RED to load the changed flows.

Or push the flow to the running instance using node-red-admin tool or a suitable curl command. You will then still need to refresh the browser.

Umm, not an existing feature of node-red-admin.

But yes, a curl command to trigger a reload is also doable.

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