Context file not written when using multiple localfilesystem entries

By the way, this turned out to be incorrect. After I rebooted the server I noticed that the stored data appeared in ALL of the localfilesystems. It seems that the physical files don't really exist, it is some kind logical reference and everything is still getting stored in the same file.

Seems so ...

So the command to get the logs would be ?
What are my stop/stop commands?

I must admit I haven't used pm2 in a long time - I think the docs you've followed should be updated to use a more standard install script that sets things up as a proper service (Running on Raspberry Pi : Node-RED)

To get the logs: pm2 logs node-red
To stop pm2 stop node-red
To start... possibly pm2 start node-red, if not, use the pm2 start command in the original doc you following.

Ok, the log is running - I see basically same notifications as from the debug nodes on the front end? No information regarding the context stores - they are taking placing continuously and I just did a few manually.

We need to see the start of the log from when node-red starts

This is what going on as shown the context menu. Unfortunately this issue is somehow preventing my app from working properly. It starts working properly when I change (for testing purposes) to context.set (but I need permanent storage).

Ok ... pm2 stop/start node-red works. I opened another terminal to stop/start it while keeping log running. Here is what I got after start.

If you make a simple flow with three inject nodes and change nodes writing simple data to the three file contexts and monitor them in the sidebar do they work correctly?

Everything "looks" correct ... saved three strings (with matching names) to three different file contexts .. problem is the actual files don't exist ..

This is the context directory ... in each of those numbered dir (i.e. 096aa389d3b3c08b) there is a flow.json file; in global there is global.json

So are there two problems you are describing? Firstly that you can't find the files, and secondly that your real flow writes the same data to all stores?

In your test flow, if you restart node-red does it pick up the previous values without pressing inject?

Also have a look in /home/ubuntu/node-red (not .node-red)

If they are not there show us that section of the settings file again.

Ok, restarted, this is odd ... the string "history" (that I saved in "history" file) after the restart is supposedly in all three of the contexts

Also, I took look inside those flow.json files - it seems those are in fact the context saves, is that correct? I was searching for actual names. However, the content doesn't make sense - two of them contain the duplicated record sets that I am seeing in the context menu

and the third one is referencing the history string (only thing that's there)

image

/home/ubuntu/node-red is empty

Can you export those seven nodes and paste them here please, also copy/paste the section of settings.js. Then we can test it. It is looking as if there may be an issue there.

nodes

[
    {
        "id": "e960b1e1d199e066",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "4c776138a2b4ec29",
        "type": "change",
        "z": "e960b1e1d199e066",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::file",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 280,
        "wires": [
            [
                "4a58933f3e3e4857"
            ]
        ]
    },
    {
        "id": "b53de7d1e1ec0fbf",
        "type": "inject",
        "z": "e960b1e1d199e066",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "file",
        "payloadType": "str",
        "x": 270,
        "y": 280,
        "wires": [
            [
                "4c776138a2b4ec29"
            ]
        ]
    },
    {
        "id": "52b31e0090c6cb2b",
        "type": "inject",
        "z": "e960b1e1d199e066",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "transact",
        "payloadType": "str",
        "x": 270,
        "y": 340,
        "wires": [
            [
                "b5a893a38da97580"
            ]
        ]
    },
    {
        "id": "85cec3a4c6b47ad3",
        "type": "inject",
        "z": "e960b1e1d199e066",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "history",
        "payloadType": "str",
        "x": 250,
        "y": 420,
        "wires": [
            [
                "c6b1349207913bc8"
            ]
        ]
    },
    {
        "id": "b5a893a38da97580",
        "type": "change",
        "z": "e960b1e1d199e066",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(transact)::transact",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 340,
        "wires": [
            [
                "4a58933f3e3e4857"
            ]
        ]
    },
    {
        "id": "c6b1349207913bc8",
        "type": "change",
        "z": "e960b1e1d199e066",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(history)::history",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 504.01300048828125,
        "y": 414.01043701171875,
        "wires": [
            [
                "4a58933f3e3e4857"
            ]
        ]
    },
    {
        "id": "4a58933f3e3e4857",
        "type": "debug",
        "z": "e960b1e1d199e066",
        "name": "debug 31",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 360,
        "wires": []
    }
]

from settings.js

     /** Context Storage
      * The following property can be used to enable context storage. The configuration
      * provided here will enable file-based context that flushes to disk every 30 seconds.
      * Refer to the documentation for further options: https://nodered.org/docs/api/context/
      */
     //contextStorage: {
     //    default: {
     //        module:"localfilesystem"
     //    },
     //},

contextStorage: {
   default: "memoryOnly",
   memoryOnly: { module: 'memory' },
   file: { module: 'localfilesystem' },
   transact: { module: 'localfilesystem', dir: '/home/ubuntu/node-red/transact' },
   history: { module: 'localfilesystem', dir: '/home/ubuntu/node-red/history' }
},

     /** `global.keys()` returns a list of all properties set in global context.
      * This allows them to be displayed in the Context Sidebar within the editor.
      * In some circumstances it is not desirable to expose them to the editor. The
      * following property can be used to hide any property set in `functionGlobalContext`
      * from being list by `global.keys()`.
      * By default, the property is set to false to avoid accidental exposure of
      *

What user have you told pm2 to run node red as?

I am not sure what takes place on load (whatever was set on install), If you're asking about today's start/stop tests, then ubuntu. If the question relates to write permissions, I have various node in the applications that are writing files in the /home/ubuntu directory.