-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Location of Files created in Node Red or Node Red Reading a File #36
Comments
Containers run in a sandbox that don't have access to the host file system. For nodred the host can see the contents of the "/data" folder by means of the volume mapping but as far as nodered is concerned the host is a totally different computer. If you want to share files between nodered and the host then you will need to save it in the "bridge" of |
Thank you Graham it makes sence and will have to look at the bridge option. Just one more thing on the tpoic. Where would the file be store if created in Node red? |
Have a look at the screenshot below. And let me know if this makes it clearer. I just made a wiki entry on this. wiki link The file name i specified was anything that gets created in the container in the Have a look at the docker-compose.yml file, it shows for each container (service) where the host file system is mapped to the container file system. |
Here is another two ways: 2 using the volume command)
the next time you run docker-compose up -d it will create a new directory in nodered called /share and any files that were in ~/myfolder would be visible in the container |
Thank you Graham for the explanation the wiki cleared it up quite well. I guess one is getting near attempting to cater for "personal needs" and that would not be feasible. |
I think you hit the nail on the head with "personal needs" getting one solution that will fit everyone is very tricky. And so does sharing volumes between containers. Its quite easy to do the link but to make sure everyone has the correct read and write permissions is tricky. And the whole point about containers are they are supposed to be separate from the host and each other for security... |
I agree but as Openhab / Home Assistant in quite a lot of cases use node-red as rules engine it could be a useful addition else maybe an alternative install. |
I'm not familiar with hassio, what would be a typical use case where you would need to share files between it and nodered? I can always find a way to get it working |
I use Openhab so with node-red I do most of my custom rules. The one way is that I have a network scan app that scans the network every x time. It then logs the Ip's extra. Once all is done I use node-red to write a simple index file to Openhab via Node red with MQTT. That way I keep track of all "custom" stuff. I also use a couple of TXT files to keep track of important soft switches. So should the Pi Restart it will read the last command status from the txt file (These used to be in Openhab so I moved it to the data file.). As a note the more I think about it the more I think we could hold for a moment, at least until someone else also ask for the same thing, There quite a bit of other work that can take precedence over this. |
I think working in containers have some limitations. A quick look on the web and i found this on persistent variables in nodered. But for keeping logs a SQL database would work. That is just another thing to learn unfortunately as you are familiar with your workflow. If another request comes in then it will be worth while making something available |
Doing some more Testing I have found the Node Red does not seem to be able to read files within the home file. I have created a quick flow to test and if you select Create the directory if it doesn't exist it seems to create the new file but I cannot find it in the location where I added it.
Where do I locate a file that is written in Node-Red and how can I link a file in Node-Red?
The text was updated successfully, but these errors were encountered: