Skip to content

Node-RED on Docker with Balena-Engine need mkdir Permission on PLC Next

Hello everybody,

 

i currently have the problem that I would like to create a .csv file directly on the PLC Next in a certain directory via Nodered, unfortunately Node-Red lacks the permission to create this file on the PLC Next.
Can someone please tell me what I need to set/change so that Node-Red can create/delete/change/overwrite these files at any time?

The following error message :

"Error creating file: Error: EACCES: permission denied, mkdir '/opt/plcnext'"

Meinen Node-Red Flow :

[{"id":"687306f9.a916a","type":"file","z":"f6f2187d.f17ca8","name":"","filename":"/opt/plcnext/logger.csv","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":960,"y":100,"wires":[[]]},{"id":"91881442.f40e2","type":"inject","z":"f6f2187d.f17ca8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":100,"wires":[["6fae87cc.d45538"]]},{"id":"6fae87cc.d45538","type":"function","z":"f6f2187d.f17ca8","name":"","func":"var capa = flow.get(\"capa\") || 0;\nflow.set (\"ccapa_Ah\",capa);\n\nreturn {payload:\"Kapazität in Ah;Kapa\"};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":100,"wires":[["6b721786.23fa1","687306f9.a916a"]]},{"id":"6b721786.23fa1","type":"debug","z":"f6f2187d.f17ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":40,"wires":[]}]

 

Attached is a picture of the flow

 

Thanks for you help guys!

 

nilsbaurx

Comments

  • Hello,

    as far as I understand the flow above will store the csv-file inside the container and not on the host. If you want to store data on the host you can create a volume for docker and redirect a folder from the container to that volume which is a folder on the host.

    mkdir node-red-user-data

    docker volume create --name node-red-user-data

    docker run -it ....... -v /opt/plcnext/node-red-user-data:/data .....

     

    If you store the csv file in the data folder of the container, the file will be moved to the volume i.e. the /opt/plcnext/node-red-user-data folder in the host.

  • Hello, I have now set up the container again.
    I created the directory exactly as you wrote it to me.
    Unfortunately, the same error message still appears in Node-Red.
    See attachment.

    Can you please tell me what exactly is still wrong ?

    nilsbaurx

  • forgot it, it works now! =)

Sign In or Register to comment.