Node-RED in docker?
Hi,
My Firewalla Blue Plus should be arriving soon and I have been thinking on how I might be able to use its docker functionalities. One of the things I might like is to move my Node-RED based home automation to it. I was wondering if anybody has already tried this or whether there are reasons why this might not work? (If it's computing power: my internet connection is pretty slow, so I doubt it'll make the Firewalla break a sweat doing its normal things).
I'll update this topic with my experiences, but figured I'd ask before my Firewalla arrives just in case there's an opportunity to hit the ground running based on someone else's experience.
Thanks!
-
So I just followed these instructions: https://nodered.org/docs/getting-started/docker
Made a directory for the data, made it writable, then ran the suggested command and I had NodeRED up and running.
sudo docker run -it -p 1880:1880 -p 1883:1883 -v /home/pi/firewalla/docker/NodeRED/:/data --name nrc --restart unless-stopped -e TZ=Europe/Amsterdam nodered/node-red
Opened 1883 as I am likely going to need MQTT in there.I didn't yet get docker to restart on reboot, but assuming I can figure that out the nodered container did restart once I got docker going again.
-
If anybody is curious, I made a typo based on the instructions in the homebridge guide, to get it to reboot create:
/home/pi/.firewalla/config/post_main.d/start_homebridge.sh
#!/bin/bash
sudo systemctl start dockerI didn't notice the "." in .firewalla, I did change the filename to start_docker.sh. Docker now restarts and as a result so does my container.
-
Hello, has anyone been successful running Node-RED on a Firewalla Purple in Docker?
I followed these instructions: https://nodered.org/docs/getting-started/docker
The installation appears to go smoothly, indicating "Server now running at http://127.0.0.1:1880/"
However, I can't access the Node-RED interface in a browser on the LAN.
sudo docker ps shows that the image is running:
nodered/node-red:latest "./entrypoint.sh" 8 minutes ago Up 2 minutes (healthy) 0.0.0.0:1880->1880/tcp, :::1880->1880/tcp mynodered
However the <IP of LAN>:1880 in Chrome doesn't work.
-
I did get this to work. Support pointed me towards the Unifi example (thank you). Steps were as follows:
Create a folder (/home/pi/nodered/ in my case) and a docker-compose.yaml file:
version: "3.7"
services:
node-red:
container_name: noderedstatic
image: nodered/node-red:latest
environment:
- TZ=Australia/Brisbane
ports:
- "1880:1880"
networks:
default:
ipv4_address: 172.16.1.2
volumes:
- node-red-data:/data
restart: alwaysvolumes:
node-red-data:networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.16.1.0/24Then start the service using:
sudo docker-compose up
I found that the 'restart: always' does what it says. It's necessary to create routes to the instance every time the FW reboots. So far I've found cron on startup to be adequate.
Add a 'user_crontab' file to the /home/pi/.firewalla/config/ directory:
* * * * * sudo ip route add 172.16.1.0/24 dev br-$(sudo docker network ls | awk '$2 == "nodered_default" {print $1}') table lan_routable
* * * * * sudo ip route add 172.16.1.0/24 dev br-$(sudo docker network ls | awk '$2 == "nodered_default" {print $1}') table wan_routableYour bridged network may be different based on where you created the .yaml file but you can list them using 'sudo docker network ls'.
Reboot to ensure the routing is applied.
On the LAN side, you should be able to access the Node-RED interface by going to http://172.16.1.2:1880/
This is all new to me but hopefully may help someone.
-
Works for me as described in earlier posts on my Blue+. Can't really add to that.
Will probably eventually move Node-RED to a different device as I was running out of space at one point. Fixed that removing some other docker stuff, but it's likely to be a long term problem. Also wondering if I might be putting extra wear on the SD card.
Please sign in to leave a comment.
Comments
6 comments