Node-RED in docker?

Comments

6 comments

  • Avatar
    Niels Rietkerk

    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.

    1
    Comment actions Permalink
  • Avatar
    Niels Rietkerk

    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 docker

    I 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.

    1
    Comment actions Permalink
  • Avatar
    Luke Salter

    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. 

    0
    Comment actions Permalink
  • Avatar
    David Koppenhofer

    I have had no luck with port forwarding and docker. I gave up and used host networking, which works for me.

    0
    Comment actions Permalink
  • Avatar
    Luke Salter

    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: always

    volumes:
      node-red-data:

    networks:
      default:
        driver: bridge
        ipam:
          config:
            - subnet: 172.16.1.0/24

    Then 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_routable

     

    Your 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. 

     

     

    0
    Comment actions Permalink
  • Avatar
    Niels Rietkerk

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.