Nodered I2C - Raspberry Pi 4 - PM2.5 sensor

I agree with Colin, you've not really said why you want docker there. You are putting a delay between the hardware and the software by forcing things to go through Docker. I've no idea what impact that might have on the hardware.

If you want to stick with Docker, you should probably move the I2C hardware off the Pi and onto an Arduino so that you can use USB/Serial which is likely to be a lot more reliable.

I used docker compose because it was the only method that I learnt to install applications on raspberry from command line, I learnt that could be more feasible according a security point of view because each application is inside a container , so if there will be some problems they will be closed inside the cointaner.. :slight_smile:

I said right at the start:

The link in there tells you how to do it, it is very easy. It may not fix your problem, but until you rule out Docker as a factor you are wasting a lot of time.

Can I follow your procedure and at the same time mantaining docker architecture that I built? I don't know , if I want to proceed again with docker..

The docker and native installs will be completely independent, you can startup whichever you want. Only start one at a time of course. Also your native install will be able to communicate with your docker install of influxdb and grafana.

The only thing to watch out for is the use of IP Ports. Node-RED, by default, expects to use port 1880. You can change this but would need to make some config changes.

Since your Docker version is using compose though, it is very easy to change the docker node-red instance to use 1881 instead. Where your compose YAML has something like 1880:1880 simply change it to 1881:1880 (or is it the other way around, I can never remember!). Then port 1880 will be free for a global install of Node-RED.

You will need simply to run Dave's Raspberry Pi install script and everything should get installed for you with the most appropriate versions.

However, I recommend doing this first to get your OS up-to-date:

sudo apt update && sudo apt upgrade

In fact it is probably best to run
sudo apt update && sudo apt full-upgrade
and make sure that completes without error. full-upgrade performs the function of upgrade but will remove currently installed packages if this is needed to upgrade the system as a whole.

I installed nodered with that script and I saw
DO NOT EXPOSE NODE-RED TO THE OPEN INTERNET WITHOUT SECURING IT FIRST

Even if your Node-RED doesn't have anything valuable, (automated) attacks will
happen and could provide a foothold in your local network.

I don't know how to proceed

You will find examples of Node-RED backups on this forum. I've shared some for example in the past.

The bit in capitals is making sure you understand that if you connect Node-RED to the internet (or anything else for that matter), you MUST put some suitable protection in place before you do so.

What is meant by connecting to the Internet is allowing someone/something from outside your local network access to the Node-RED Editor and/or Dashboard, uibuilder, etc (user facing stuff).

Can you suggest me a simple guide to proceed? Sorry but I am not very familiar with the IT world...
I disconnected it immediately, I hope that nothing happened :frowning:

Best to start a separate thread rather than to confuse this one.

Ok done, but I have a simple question about that script..

The guide says that " * setup Node-RED to run as a service and provide a set of commands to work with the service."

Does it mean that nodered is always active? I think that it's not true because I have to start it from node-red-start command, the problem is that when I want to close nodered I have to do node-red-stop and nothing happens , how can I understand if nodered is always on or not?

Thanks

The instructions at the link I posted tell you how to run it locally or as a service.
https://nodered.org/docs/getting-started/raspberrypi

This information relates to Node-red on a Raspberry Pi but not using Docker.
Without doubt Docker is great software but it changes many things and as you have discovered, advice for a Docker based system is harder to obtain.

If you install on a Raspberry Pi or other Debian Linux machine using the official install script, you already have the Pi setup to to allow you to specify it should always be on.
This uses the systemd process.

You can use the systemctl command to check the status:
Here "enabled" means it is set to startup automatically, "active (running)" means it is currently active.

systemctl status nodered (Note, no space or hyphen in nodered) shows you the current status.
sudo systemctl stop nodered terminates the service (identical to node-red-stop).
sudo systemctl restart nodered starts it up (identical to node-red-start)

Thanks for the answers! I think that I understood now..