• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to save node-red flows persistent?
#1
Hello.

I’m using hilschernetpi/netpi-nodered:latest. So far everything is fine.
But now I wonder how to save my flows in a persistent way.
The official node-red documentation tells that beginning with version 1.0 
setting, user and flow directory resides within /data directory which should be mapped to a persistent volume.
By the way the documentation mentions that this directory should be owned by the user node-red (1000:1000).

I have no glue how to do this on the netPi (running Firmware Version 1.2.0.0).
 
The log of above image gives me the following output.

Welcome to Node-RED
===================
5 Nov 12:57:42 - [info] Node-RED version: v0.20.8
5 Nov 12:57:42 - [info] Node.js  version: v8.16.1
5 Nov 12:57:42 - [info] Linux 4.9.80-rt62 arm LE
5 Nov 12:57:43 - [info] Loading palette nodes
5 Nov 12:57:55 - [s7comm-Info] - Debug configuration for logLevelNodeS7:{"debug":0,"silent":true}
5 Nov 12:57:55 - [s7comm-Info] - Debug configuration for logLevelNodeRED:{"debug":2,"silent":true}
5 Nov 12:57:59 - [info] Dashboard version 2.16.3 started at /ui
5 Nov 12:58:00 - [info] Settings file  : /root/.node-red/settings.js
5 Nov 12:58:00 - [info] Context store  : 'default' [module=memory]
5 Nov 12:58:00 - [info] User directory : /root/.node-red
5 Nov 12:58:00 - [warn] Projects disabled : editorTheme.projects.enabled=false
5 Nov 12:58:00 - [info] Flows file     : /root/.node-red/flows_xxxxxxx.json
5 Nov 12:58:00 - [info] Creating new flow file
5 Nov 12:58:00 - [warn] 

 
So how to map /root/.node-red directory to any persistent volume?

Editing settings.js doesn't help either because this file is destroyed too at a container restart.


Regards
 
P.S.: I have searched the forum many times but didn’t find any answer. So I wonder again if nobody else has this problem. Maybe I missed something.
  Reply
#2
Hi there,

here is one possibility:

The Node-RED in the container has a working directory under /root/.node-red . In this folder the Node-RED will save the flow every time you do a deploy.

So what you could do is to keep the folder /root/.node-red saved to "somewhere" for those times where you do a restart/redeploy of the container.

Here is now to proceed: Use the "Volumes" function in the left menu of the Docker Web-UI. Then give your volume a name like "nodered" and click "create volume". This will then create a local volume/storage. Such a volume is mappable.

Then go to your "container create" dialog and use the possibility there to map specific folders of a container to a volume. Then as container source path use "/root/.node-red" and as volume your "nodered" volume ... then create your container as usual.

   

Whenever you now start/restart/redeploy you Node-RED container again with the same volume mapped, then this container will use the contents of the mapped volume as working directory.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Hey Armin,


thank you very much for your fast and usefull answer.
This worked out of the box for me.


One remark:
I now found the error at myself.

I shouldn't do this at all. 
There is no need for modifying & saving flows on netPi.
This should be done on the development raspi and put in the image which is downloaded by the netPi.

Sorry for the stupid question.


Best regards
hsammer
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 6 89 October-21st-2019, 10:30 AM
Last Post: Armin@netPI
  netPI Node-Red fieldbus node Error PersEE 5 53 October-8th-2019, 03:55 PM
Last Post: Armin@netPI
  EIP Node Red configurator mnieuzyla 4 29 September-10th-2019, 06:19 AM
Last Post: Armin@netPI
  [SOLVED] Help with fieldbus node Farani 5 48 August-20th-2019, 07:22 AM
Last Post: Armin@netPI
  Ready-to-deploy: full featured Node-RED container Armin@netPI 5 77 July-25th-2019, 06:16 AM
Last Post: Armin@netPI
  Official Node-RED container Armin@netPI 0 19 April-5th-2019, 10:39 AM
Last Post: Armin@netPI
  [SOLVED] node-red Dashboard Docker Image for netPI? anrodriguez 1 26 February-7th-2019, 05:35 PM
Last Post: Armin@netPI
  "node-red with NIOT-E-NPIX-EVA GPIO module" Docker image Eyad.Almolki 1 149 July-30th-2018, 06:22 PM
Last Post: Armin@netPI
  Node-Red MQTT with SSL/TLS can't connect to broker BFH_SAM2 6 243 May-18th-2018, 08:48 AM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)