Store content variables permanently

Hi everybody,

I am running node red on a raspberry pi 4 (8gb) as an instance of iobroker. That means Paths and so on are not as given in the usual installation way but different.

I noticed, that all my variables are lost after a restart, so currently I try to find a way to store them on the filesystem.
As written here I changed the settings.js file and commented-in the storage information. As mentioned, my node red installation was made by iobroker. Due to that fact there are several settings files in different paths than usual, so I searched the whole system for settings.js and changed the mentioned lines in every single of them.

Afterwards I created change nodes and entered: change->set->flow.myVar to msg.payload

This works as long as the system is running. But after a reboot, when I try: set->msg.payload to flow.myVar I receive "undefined". So the values still get lost during a reboot.

Is there any other setting that may need to be adjusted?

These are the lines that I have in my settings.js:

    contextStorage: {
        default: {
            module:"localfilesystem"
        },
    },

pi@raspberrypi:~ $ sudo find / -name settings.js
/home/pi/.config/chromium/Default/Extensions/cjpalhdlnbpafiamejdnhcphjbkeiagm/1.35.2_0/js/settings.js
/opt/iobroker/node_modules/node-red/settings.js
/opt/iobroker/node_modules/luxon/src/settings.js
/opt/iobroker/node_modules/@node-red/runtime/lib/storage/localfilesystem/settings.js
/opt/iobroker/node_modules/@node-red/runtime/lib/api/settings.js
/opt/iobroker/node_modules/@node-red/runtime/lib/settings.js
/opt/iobroker/node_modules/@node-red/editor-api/lib/admin/settings.js
/opt/iobroker/node_modules/@node-red/editor-api/lib/editor/settings.js
/opt/iobroker/node_modules/iobroker.node-red/settings.js
/opt/iobroker/iobroker-data/node-red/settings.js

Every settings.js that fits the right fomat (has the storage-lines commented out in it) was edited by me

Any ideas?

Best regards,
Pinky

And did you set the options to actually point to a location on disk ?
https://nodered.org/docs/api/context/store/localfilesystem#options

Yeah, thats it.
Turned out, I missed the correct file.

It gets deleted and recreated with every start of the instance as it seems.
The correct file can be found here in this guide: Node Red Persistence Funktion einschalten

Thanks alot!

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