GithubHelp home page GithubHelp logo

node-red / node-red-docker Goto Github PK

View Code? Open in Web Editor NEW
455.0 26.0 385.0 877 KB

Repository for all things Node-RED and Docker related

License: Apache License 2.0

Shell 95.61% JavaScript 4.39%
node-red docker hacktoberfest

node-red-docker's Introduction

Node-RED Docker

Greenkeeper badge Build Status DockerHub Pull DockerHub Stars

This project describes some of the many ways Node-RED can be run under Docker and has support for multiple architectures (amd64, arm32v6, arm32v7, arm64v8, i386 and s390x). Some basic familiarity with Docker and the Docker Command Line is assumed.

Note: In version 1.2 we removed the named VOLUME from the build. It should not affect many users - but the details are here.

As of Node-RED 1.0 this project provides the build for the nodered/node-red container on Docker Hub.

Previous 0.20.x versions are still available at https://hub.docker.com/r/nodered/node-red-docker.

Quick Start

To run in Docker in its simplest form just run:

    docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red

Let's dissect that command:

    docker run              - run this container, initially building locally if necessary
    -it                     - attach a terminal session so we can see what is going on
    -p 1880:1880            - connect local port 1880 to the exposed internal port 1880
    -v node_red_data:/data  - mount the host node_red_data directory to the container /data directory so any changes made to flows are persisted
    --name mynodered        - give this machine a friendly local name
    nodered/node-red        - the image to base it on - currently Node-RED v3.1.9

Running that command should give a terminal window with a running instance of Node-RED.

    Welcome to Node-RED
    ===================

    10 Oct 12:57:10 - [info] Node-RED version: v3.1.9
    10 Oct 12:57:10 - [info] Node.js  version: v16.14.1
    10 Oct 12:57:10 - [info] Linux 4.19.76-linuxkit x64 LE
    10 Oct 12:57:11 - [info] Loading palette nodes
    10 Oct 12:57:16 - [info] Settings file  : /data/settings.js
    10 Oct 12:57:16 - [info] Context store  : 'default' [module=memory]
    10 Oct 12:57:16 - [info] User directory : /data
    10 Oct 12:57:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
    10 Oct 12:57:16 - [info] Flows file     : /data/flows.json
    10 Oct 12:57:16 - [info] Creating new flow file
    10 Oct 12:57:17 - [warn]

    ---------------------------------------------------------------------
    Your flow credentials file is encrypted using a system-generated key.

    If the system-generated key is lost for any reason, your credentials
    file will not be recoverable, you will have to delete it and re-enter
    your credentials.

    You should set your own key using the 'credentialSecret' option in
    your settings file. Node-RED will then re-encrypt your credentials
    file using your chosen key the next time you deploy a change.
    ---------------------------------------------------------------------

    10 Oct 12:57:17 - [info] Starting flows
    10 Oct 12:57:17 - [info] Started flows
    10 Oct 12:57:17 - [info] Server now running at http://127.0.0.1:1880/

    [...]

You can then browse to http://{host-ip}:1880 to get the familiar Node-RED desktop.

The advantage of doing this is that by giving it a name (mynodered) we can manipulate it more easily, and by fixing the host port we know we are on familiar ground. Of course this does mean we can only run one instance at a time... but one step at a time folks...

If we are happy with what we see, we can detach the terminal with Ctrl-p Ctrl-q - the container will keep running in the background.

To reattach to the terminal (to see logging) run:

    $ docker attach mynodered

If you need to restart the container (e.g. after a reboot or restart of the Docker daemon):

    $ docker start mynodered

and stop it again when required:

    $ docker stop mynodered

Healthcheck: to turn off the Healthcheck add --no-healthcheck to the run command.

Image Variations

The Node-RED images come in different variations and are supported by manifest lists (auto-detect architecture). This makes it more easy to deploy in a multi architecture Docker environment. E.g. a Docker Swarm with mix of Raspberry Pi's and amd64 nodes.

The tag naming convention is <node-red-version>-<node-version>-<image-type>-<architecture>, where:

  • <node-red-version> is the Node-RED version.
  • <node-version> is the Node JS version.
  • <image-type> is type of image and is optional, can be either none or minimal.
    • none : is the default and has Python 2 & Python 3 + devtools installed
    • minimal : has no Python installed and no devtools installed
  • <architecture> is the architecture of the Docker host system, can be either amd64, arm32v6, arm32v7, arm64, s390x or i386.

The minimal versions (without python and build tools) are not able to install nodes that require any locally compiled native code.

For example - to run the latest minimal version, you would run

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red:latest-minimal

The Node-RED images are based on official Node JS Alpine Linux images to keep them as small as possible. Using Alpine Linux reduces the built image size, but removes standard dependencies that are required for native module compilation. If you want to add dependencies with native dependencies, extend the Node-RED image with the missing packages on running containers or build new images see docker-custom and the documentation on the Node-RED site here.

The following table shows the variety of provided Node-RED images.

Tag Node Arch Python Dev Base Image
3.1.9-14 14 amd64 2.x 3.x yes amd64/node:14-alpine
14 arm32v6 2.x 3.x yes arm32v6/node:14-alpine
14 arm32v7 2.x 3.x yes arm32v7/node:14-alpine
14 arm64v8 2.x 3.x yes arm64v8/node:14-alpine
14 s390x 2.x 3.x yes s390x/node:14-alpine
14 i386 2.x 3.x yes i386/node:14-alpine
3.1.9-14-minimal 14 amd64 no no amd64/node:14-alpine
14 arm32v6 no no arm32v6/node:14-alpine
14 arm32v7 no no arm32v7/node:14-alpine
14 arm64v8 no no arm64v8/node:14-alpine
14 s390x no no s390x/node:14-alpine
14 i386 no no i386/node:14-alpine
Tag Node Arch Python Dev Base Image
3.1.9-16 16 amd64 2.x 3.x yes amd64/node:16-alpine
16 arm32v6 2.x 3.x yes arm32v6/node:16-alpine
16 arm32v7 2.x 3.x yes arm32v7/node:16-alpine
16 arm64v8 2.x 3.x yes arm64v8/node:16-alpine
16 s390x 2.x 3.x yes s390x/node:16-alpine
16 i386 2.x 3.x yes i386/node:16-alpine
3.1.9-16-minimal 16 amd64 no no amd64/node:16-alpine
16 arm32v6 no no arm32v6/node:16-alpine
16 arm32v7 no no arm32v7/node:16-alpine
16 arm64v8 no no arm64v8/node:16-alpine
16 s390x no no s390x/node:16-alpine
16 i386 no no i386/node:16-alpine
Tag Node Arch Python Dev Base Image
3.1.9-18 18 amd64 2.x 3.x yes amd64/node:18-alpine
18 arm32v6 2.x 3.x yes arm32v6/node:18-alpine
18 arm32v7 2.x 3.x yes arm32v7/node:18-alpine
18 arm64v8 2.x 3.x yes arm64v8/node:18-alpine
18 s390x 2.x 3.x yes s390x/node:18-alpine
18 i386 2.x 3.x yes i386/node:18-alpine
3.1.9-18-minimal 18 amd64 no no amd64/node:18-alpine
18 arm32v6 no no arm32v6/node:18-alpine
18 arm32v7 no no arm32v7/node:18-alpine
18 arm64v8 no no arm64v8/node:18-alpine
18 s390x no no s390x/node:18-alpine
18 i386 no no i386/node:18-alpine
  • All images have bash, tzdata, nano, curl, git, openssl and openssh-client pre-installed to support Node-RED's Projects feature.

Manifest Lists

The following table shows the provided Manifest Lists.

Tag Node-RED Base Image
latest, 3.1.9, nodered/node-red:3.1.9-16
latest-16, 3.1.9-16
latest-minimal, 3.1.9-minimal, nodered/node-red:3.1.9-16-minimal
latest-16-minimal, 3.1.9-16-minimal
Tag Node-RED Base Image
latest-14, 3.1.9-14 nodered/node-red:3.1.9-14
latest-14-minimal, 3.1.9-14-minimal nodered/node-red:3.1.9-14-minimal
Tag Node-RED Base Image
latest-18, 3.1.9-18 nodered/node-red:3.1.9-18
latest-18-minimal, 3.1.9-18-minimal nodered/node-red:3.1.9-18-minimal

With the support of Docker manifest list, there is no need to explicitly add the tag for the architecture to use. When a docker run command or docker service command or docker stack command is executed, docker checks which architecture is required and verifies if it is available in the docker repository. If it does, docker pulls the matching image for it.

Therefore all tags regarding Raspberry PI's are dropped.

For example: suppose you are running on a Raspberry PI 3B, which has arm32v7 as architecture. Then just run the following command to pull the image (tagged by 3.1.9-16), and run the container.

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red:latest

The same command can be used for running on an amd64 system, since docker discovers its running on a amd64 host and pulls the image with the matching tag (3.1.9-16-amd64).

This gives the advantage that you don't need to know/specify which architecture you are running on and makes docker run commands and docker compose files more flexible and exchangeable across systems.

Raspberry PI - native GPIO support

v1.0 - BREAKING: Native GPIO support for Raspberry PI has been dropped
The replacement for native GPIO is node-red-node-pi-gpiod.

Disadvantages of the native GPIO support are:

  • Your Docker container needs to be deployed on the same Docker node/host on which you want to control the gpio.
  • Gain access to /dev/mem of your Docker node/host
  • privileged=true is not supported for docker stack command

node-red-node-pi-gpiod fixes all these disadvantages. With node-red-node-pi-gpiod it is possible to interact with gpio of multiple Raspberry Pi's from a single Node-RED container, and for multiple containers to access different gpio on the same Pi.

Quick Migration steps to node-red-node-pi-gpiod

  1. Install node-red-node-pi-gpiod through the Node-RED palette
  2. Install and run PiGPIOd daemon on the host Pi.
  3. Replace all native gpio nodes with pi gpiod nodes.
  4. Configure pi gpiod nodes to connect to PiGPIOd daemon. Often the host machine will have an IP 172.17.0.1 port 8888 - but not always. You can use docker exec -it mynodered ip route show default | awk '/default/ {print $3}' to check.

For detailed install instruction please refer to the node-red-node-pi-gpiod README

Note: There is a contributed gpiod project that runs the gpiod in its own container rather than on the host if required.

Managing User Data

Once you have Node-RED running with Docker, we need to ensure any added nodes or flows are not lost if the container is destroyed. This user data can be persisted by mounting a data directory to a volume outside the container. This can either be done using a bind mount or a named data volume.

Node-RED uses the /data directory inside the container to store user configuration data.

Depending on how and where you mount the user data directory you may want to turn off the built in healthcheck function by adding --no-healthcheck to the run command.

Using a Host Directory for Persistence (Bind Mount)

To save your Node-RED user directory inside the container to a host directory outside the container, you can use the command below. To allow access to this host directory, the node-red user (default uid=1000) inside the container must have the same uid as the owner of the host directory.

docker run -it -p 1880:1880 -v /home/pi/.node-red:/data --name mynodered nodered/node-red

In this example the host /home/pi/.node-red directory is bound to the container /data directory.

Note: Users migrating from version 0.20 to 1.0 will need to ensure that any existing /data directory has the correct ownership. As of 1.0 this needs to be 1000:1000. This can be forced by the command sudo chown -R 1000:1000 path/to/your/node-red/data

See the wiki for detailed information on permissions.

Using Named Data Volumes

Docker also supports using named data volumes to store persistent or shared data outside the container.

To create a new named data volume to persist our user data and run a new container using this volume.

    $ docker volume create --name node_red_data_vol
    $ docker volume ls
    DRIVER              VOLUME NAME
    local               node_red_data_vol
    $ docker run -it -p 1880:1880 -v node_red_data_vol:/data --name mynodered nodered/node-red

Using Node-RED to create and deploy some sample flows, we can now destroy the container and start a new instance without losing our user data.

    $ docker rm mynodered
    $ docker run -it -p 1880:1880 -v node_red_data_vol:/data --name mynodered nodered/node-red

Updating

As the /data is now preserved outside of the container, updating the base container image is now as simple as

    $ docker pull nodered/node-red
    $ docker stop mynodered
    $ docker start mynodered

Docker Stack / Docker Compose

Below an example of a Docker Compose file which can be run by docker stack or docker-compose. Please refer to the official Docker pages for more info about Docker stack and Docker compose.

################################################################################
# Node-RED Stack or Compose
################################################################################
# docker stack deploy node-red --compose-file docker-compose-node-red.yml
# docker-compose -f docker-compose-node-red.yml -p myNoderedProject up
################################################################################
version: "3.7"

services:
  node-red:
    image: nodered/node-red:latest
    environment:
      - TZ=Europe/Amsterdam
    ports:
      - "1880:1880"
    networks:
      - node-red-net
    volumes:
      - ~/node-red/data:/data

networks:
  node-red-net:

The above compose file:

  • creates a node-red service
  • pulls the latest node-red image
  • sets the timezone to Europe/Amsterdam
  • Maps the container port 1880 to the the host port 1880
  • creates a node-red-net network and attaches the container to this network
  • persists the /data dir inside the container to the users local node-red/data directory. The node-red/data directory must exist prior to starting the container.

Project Layout

This repository contains Dockerfiles to build the Node-RED Docker images listed above.

package.json

The package.json is a metafile that downloads and installs the required version of Node-RED and any other npms you wish to install at build time. During the Docker build process, the dependencies are installed under /usr/src/node-red.

The main sections to modify are

"dependencies": {
    "node-red": "^3.1.9",           <-- set the version of Node-RED here
    "node-red-dashboard": "*"        <-- add any extra npm packages here
},

This is where you can pre-define any extra nodes you want installed every time by default, and then

"scripts"      : {
    "start": "node-red -v $FLOWS"
},

This is the command that starts Node-RED when the container is run.

Startup

Node-RED is started using NPM start from this /usr/src/node-red, with the --userDir parameter pointing to the /data directory on the container.

The flows configuration file is set using an environment parameter (FLOWS), which defaults to 'flows.json'. This can be changed at runtime using the following command-line flag.

docker run -it -p 1880:1880 -e FLOWS=my_flows.json -v node_red_data:/data nodered/node-red

Note: If you set -e FLOWS="" then the flow file can be set via the flowFile property in the settings.js file.

Node.js runtime arguments can be passed to the container using an environment parameter (NODE_OPTIONS). For example, to fix the heap size used by the Node.js garbage collector you would use the following command.

docker run -it -p 1880:1880 -e NODE_OPTIONS="--max_old_space_size=128" -v node_red_data:/data nodered/node-red

Other useful environment variables include

  • -e NODE_RED_ENABLE_SAFE_MODE=false # setting to true starts Node-RED in safe (not running) mode
  • -e NODE_RED_ENABLE_PROJECTS=false # setting to true starts Node-RED with the projects feature enabled

Node-RED Admin Tool

Using the administration tool, with port forwarding on the container to the host system, extra nodes can be installed without leaving the host system.

    $ npm install -g node-red-admin
    $ node-red-admin install node-red-node-openwhisk

This tool assumes Node-RED is available at the following address http://localhost:1880.

Refreshing the browser page should now reveal the newly added node in the palette.

Node-RED Commands from the host

Admin commands can also be accessed without installing npm or the node-red-admin tool on the host machine. Simply prepend your command with "npx" and apply it to the container - e.g

    $ docker exec -it mynodered npx node-red admin hash-pw

Container Shell

    $ docker exec -it mynodered /bin/bash

Will give a command line inside the container - where you can then run the npm install command you wish - e.g.

    $ cd /data
    $ npm install node-red-node-smooth
    $ exit
    $ docker stop mynodered
    $ docker start mynodered

Refreshing the browser page should now reveal the newly added node in the palette.

Building Custom Image

Creating a new Docker image, using the public Node-RED images as the base image, allows you to install extra nodes during the build process.

This Dockerfile builds a custom Node-RED image with the flightaware module installed from NPM.

FROM nodered/node-red
RUN npm install node-red-contrib-flightaware

Alternatively, you can modify the package.json in this repository and re-build the images from scratch. This will also allow you to modify the version of Node-RED that is installed. See README in the docker-custom directory.

Running headless

The barest minimum we need to just run Node-RED is

$ docker run -d -p 1880:1880 nodered/node-red

This will create a local running instance of a machine - that will have some docker id number and be running on a random port... to find out run

$ docker ps
CONTAINER ID        IMAGE                            COMMAND             CREATED             STATUS                     PORTS                     NAMES
4bbeb39dc8dc        nodered/node-red:latest          "npm start"         4 seconds ago       Up 4 seconds               0.0.0.0:49154->1880/tcp   furious_yalow
$

You can now point a browser to the host machine on the tcp port reported back, so in the example above browse to http://{host ip}:49154

NOTE: as this does not mount the /data volume externally any changes to flows will not be saved and if the container is redeployed or upgraded these will be lost. The volume may persist on the host filing sysem and can probably be retrieved and remounted if required.

Linking Containers

You can link containers "internally" within the docker runtime by using Docker user-defined bridges.

Before using a bridge, it needs to be created. The command below will create a new bridge called iot

docker network create iot

Then all containers that need to communicate need to be added to the same bridge using the --network command line option

docker run -itd --network iot --name mybroker eclipse-mosquitto mosquitto -c /mosquitto-no-auth.conf

(no need to expose the port 1883 globally unless you want to... as we do magic below)

Then run nodered docker, also added to the same bridge

docker run -itd -p 1880:1880 --network iot --name mynodered nodered/node-red

containers on the same user-defined bridge can take advantage of the built in name resolution provided by the bridge and use the container name (specified using the --name option) as the target hostname.

In the above example the broker can be reached from the Node-RED application using hostname mybroker.

Then a simple flow like below show the mqtt nodes connecting to the broker

    [{"id":"c51cbf73.d90738","type":"mqtt in","z":"3fa278ec.8cbaf","name":"","topic":"test","broker":"5673f1d5.dd5f1","x":290,"y":240,"wires":[["7781c73.639b8b8"]]},{"id":"7008d6ef.b6ee38","type":"mqtt out","z":"3fa278ec.8cbaf","name":"","topic":"test","qos":"","retain":"","broker":"5673f1d5.dd5f1","x":517,"y":131,"wires":[]},{"id":"ef5b970c.7c864","type":"inject","z":"3fa278ec.8cbaf","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":290,"y":153,"wires":[["7008d6ef.b6ee38"]]},{"id":"7781c73.639b8b8","type":"debug","z":"3fa278ec.8cbaf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":505,"y":257,"wires":[]},{"id":"5673f1d5.dd5f1","type":"mqtt-broker","z":"","name":"","broker":"mybroker","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

This way the internal broker is not exposed outside of the docker host - of course you may add -p 1883:1883 etc to the broker run command if you want other systems outside your computer to be able to use the broker.

Docker-Compose linking example

Another way to link containers is by using docker-compose. The following docker-compose.yml file creates a Node-RED instance, and a local MQTT broker instance. In the Node-RED flow the broker can be addressed simply as mybroker at its default port 1883.

version: "3.7"

services:
  mynodered:
    image: nodered/node-red
    restart: unless-stopped
    volumes:
      - /home/pi/.node-red:/data
    ports:
      - 1880:1880
  mybroker:
    image: eclipse-mosquitto
    restart: unless-stopped
    command: mosquitto -c /mosquitto-no-auth.conf

Debugging containers

Sometimes it is useful to debug the code which is running inside the container. Two scripts ('debug' and 'debug_brk' in the package.json file) are available to start NodeJs in debug mode, which means that NodeJs will start listening (to port 9229) for a debug client. Various remote debugger tools (like Visual Code, Chrome Developer Tools ...) can be used to debug a Node-RED application. A wiki page has been provided, to explain step-by-step how to use the Chrome Developer Tools debugger.

  1. In most cases the 'debug' script will be sufficient, to debug a Node-RED application that is fully up-and-running (i.e. when the application startup code is not relevant). The NodeJs server can be started in debug mode using following command:

    docker run -it -p 1880:1880 -p 9229:9229 -v node_red_data:/data --name mynodered --entrypoint npm nodered/node-red run debug -- --userDir /data
    
  2. In case debugging of the Node-RED startup code is required, the 'debug_brk' script will instruct NodeJs to break at the first statement of the Node-RED application. The NodeJs server can be started in debug mode using following command:

    docker run -it -p 1880:1880 -p 9229:9229 -v node_red_data:/data --name mynodered --entrypoint npm nodered/node-red run debug_brk -- --userDir /data
    

    Note that in this case NodeJs will wait - at the first statement of the Node-RED application - until a debugger client connects...

As soon as NodeJs is listening to the debug port, this will be shown in the startup log:

Debugger listening on ws://0.0.0.0:9229/...

Let's dissect both commands:

    docker run              - run this container, initially building locally if necessary
    -it                     - attach a terminal session so we can see what is going on
    -p 1880:1880            - connect local port 1880 to the exposed internal port 1880
    -p 9229:9229            - connect local port 9229 to the exposed internal port 9229 (for debugger communication)
    -v node_red_data:/data  - mount the internal /data to the host mode_red_data directory
    --name mynodered        - give this machine a friendly local name
    --entrypoint npm        - overwrite the default entrypoint (which would run the *'start'* script)
    nodered/node-red        - the image to base it on - currently Node-RED v1.1.0
    run debug(_brk)         - (npm) arguments for the custom endpoint (which must be added AFTER the image name!)
    --                      - the arguments that will follow are not npm arguments, but need to be passed to the script
    --userDir /data         - instruct the script where the Node-RED data needs to be stored

Common Issues and Hints

Here is a list of common issues users have reported with possible solutions.


User Permission Errors

See the wiki for detailed information on permissions.

If you are seeing permission denied errors opening files or accessing host devices, try running the container as the root user.

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered -u root nodered/node-red

References:

node-red/node-red#15

node-red/node-red#8


Accessing Host Devices

If you want to access a device from the host inside the container, e.g. serial port, use the following command-line flag to pass access through.

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered --device=/dev/ttyACM0 nodered/node-red

References:

node-red/node-red#15


Setting Timezone

If you want to modify the default timezone, use the TZ environment variable with the relevant timezone.

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered -e TZ=America/New_York nodered/node-red

or within a docker-compose file

  node-red:
    environment:
      - TZ=America/New_York

References:

https://groups.google.com/forum/#!topic/node-red/ieo5IVFAo2o


node-red-docker's People

Contributors

dceejay avatar dschmidt avatar etienne-goumet avatar garethcmurphy avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hardillb avatar jthomas avatar knolleary avatar maxvram avatar michaelleehobbs avatar moolbits avatar natcl avatar noderedbot avatar raymondmouthaan avatar takuya-o avatar vielmetti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-red-docker's Issues

Builtin twitter node is outdated

Respecting Twitter's recent API changes/limitations, node-red-node-twitter has published version 1.0.1 lately. https://www.npmjs.com/package/node-red-node-twitter
The node-red docker container still installs version 0.1.15, which cannot be upgraded via the "Manage palette" menu, since it is builtin.

What are the steps to reproduce?

Download the image, start the container. Look in the "Manage Palette" menu, the twitter node shows up as 0.1.15

What do you expect to happen?

Two possible solutions:

  • The docker image is updated with Twitter node 1.0.1 or
  • completely remove the Twitter node, so it is installable and upgradeable via the "Manage Palette" menu

Please tell us about your environment:

I am using the latest image by the time of writing this issue. This is node-red v0.18.7. OS is Arch Linux, Browser is Google Chrome.

Can't see all tags on Synology

I'm not sure if it's a bug with the Synology OS or a quirk with Docker's registry hub but I can only see the 0.14.5 and 0.14.5-slim tags when I try to install Node-RED from Synology, see image:
capture

Container created from latest image does not start

The problem

Running the command docker run -it -p 1880:1880 --name node-red nodered/node-red-docker does not start the application, but fails with the following error message:

Actual output

Error response from daemon: shim error: json: cannot unmarshal array into Go struct field processState.capabilities of type specs.LinuxCapabilities

Expected output

Welcome to Node-RED
===================

Environment

Docker image ID: 435384cc1753
Node Red version: 0.17.4
Docker version: 17.06.0-ce, build 3dfb8343
Linux kernel version: 4.11.9-1-ARCH
OS: Arch Linux

'Input:inject' of type 'Repeat - at a specific time' not working

I think, in order for 'Input:inject' of type 'Repeat - at a specific time' (Time-of-Day) to work, 'cron' needed to be installed inside the docker.
I had to add in the Dockerfile the following line
'RUN apt-get install -y cron'

I'm using the Node-RED container to control many switches at specific times; for eg:- turn on/off FishTank light.

$ docker run -it --rm hypriot/rpi-node:4 bash
root@44b3c8a909c0:/# cron
bash: cron: command not found
root@44b3c8a909c0:/#

Docker volume mapped /data volume uses irritating UID/GID

I have a server with a few containers, most I can configure the UID/GID of the container's run user using environment variables PUID and PGID (or advertise another variable for this purpose).

The node-red container runs as a user with UID 1001 which maps on my host to a user with another purpose. Docker seems to have little support for addressing this issue.

Is there a method to force the UID of the container to another number?

Running in AWS, best practise for settings.js changes?

This is not solely for AWS I guess but what would be the best approach for changing server settings(.js) after deployment in runtime?

  1. Change settings locally, rebuild Docker container and redeploy?
  2. Access running server(s) and change in "runtime" and change in local Docker container for next deploy?

#2 is, of course, better from a downtime perspective but it doesn't feel "right" to change in a running container/server...

Also, is there any "runtime change" API/SDK planned for node-red that you would know of (to be able to change settings without changing settings.js)?

User data not being stored in mounted /data directory

What are the steps to reproduce?

Mount /data directory to external volume.
Use the --user myLocalUserName parameter so that container has permission to read/write to the external volume. (Container will not launch without this)

From the log the command lines used are;

[email protected] start /usr/src/node-red
node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--user" "myLocalUserName"

Where the environment variable $FLOWS is just the default flows.json

What happens?

See in the log that a user directory is created and my settings and flows are stored there;
4 Apr 06:34:50 - [info] Settings file : /usr/src/node-red/myLocalUserName/settings.js
4 Apr 06:34:50 - [info] User directory : /usr/src/node-red/myLocalUserName
4 Apr 06:34:50 - [info] Flows file : /usr/src/node-red/myLocalUserName/flows.json
However there is nothing stored in the mounted /data directory.

What do you expect to happen?

That the user directory and/or data would appear in the mounted /data directory and therefore my settings and flows would be external to the container, so could be backed up and survive container upgrades etc.

Please tell us about your environment:

  • Node-RED version: 4 Apr 06:34:48 - [info] Node-RED version: v0.18.4
  • node.js version: 4 Apr 06:34:48 - [info] Node.js version: v8.10.0
  • npm version: unknown
  • Platform/OS: Synology Docker (DSM 6.1.6-15266)
  • Browser: Chrome (latest)

issue with following the instructions in the README.md and using the `USER` command in the Dockerfile

Hi.

I wanted to start using node-red with extra custom "contrib" nodes via Docker.
Initially I followed the instructions in the README for the "Host Directory As Volume" mode, but was unable to get this working.
Specifically, node-red loaded correctly but I got a runtime error when clicking "Deploy" because node-red was unable to persist to the flows.json file due to a linux permission issue.

ctuvqqqwiaap2dw

Eventually I was able to get this working correctly and persisting flows.json by using the docker run --user flag (see relevant Docker docs).
I thought I'd open an issue because maybe other users encountered this problem and perhaps this clarification should be a part of the README.

I'm just starting out with Docker, but here's my understanding of the problem & fix:

  • When you use the USER command in the Dockerfile (as the case in this project) it creates a new user with a new userid and performs the remaining instructions as that user
  • If there was no prior USER command, the userid will probably be 1000 but Docker doesn't guarantee what the generated userid would be so it's discouraged to rely on this
  • The /data folder will be owned by the user with that userid
  • If you try to map the container's /data directory to a directory on the host, that external directory and its contents will probably be owned by a user with a different userid than the one used by the container
  • Only if by some chance it's the same userid (which could happen if both users are the first users created on the server and both have userid 1000) then this would work correctly.
  • In other cases where the userid does not match, a permission issue would prevent node-red from successfully persisting flows.json
  • You can fix this by using the --user flag of the docker run command (or the user property if you're using docker-compose) that lets you pass the host's userid so that the USER command will use that userid instead of creating a new one. This will make the userids match and will fix the permission issue.

Would be happy to send a PR but figured I'd first reach out to get feedback, and to have one else verify this is not just a local issue caused by my configuration.

Thanks.

Unable to install node-red-admin

I cannot install node-red-admin because node-red user is not owner of /usr/local/lib/node_modules :

npm ERR! Linux 4.9.35-v7+ npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "node-red-admin" npm ERR! node v6.11.0 npm ERR! npm v3.10.10 npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! at Error (native) npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! Please include the following file with any support request: npm ERR! /usr/src/node-red/.node-gyp/6.11.0/npm-debug.log

and the directory is owned by 1001:1001

$ ls -ltra /usr/local/lib/node_modules total 12 drwxr-xr-x 3 1001 1001 4096 Jul 18 20:33 . drwxr-xr-x 11 1001 1001 4096 Jul 18 20:33 npm drwxr-xr-x 4 1001 1001 4096 Jul 18 20:33 ..

but node-red user is 1000:1000

$ id node-red uid=1000(node-red) gid=1000(node-red) groups=1000(node-red)

and I cannot sudo because it asks for a password that I don't know.

$ sudo su - We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for node-red: Sorry, try again.

I'm using nodered/node-red-docker:rpi

Timezones

I am running the image in Docker on a Synology Diskstation and it shows UTC timezone instead of the local one. Unlike the internet suggests, setting the environment variable TZ does not change anything. Is TZ not supported?

Use of USER prevents installation of additional tools

The use of the USER directive prevents extending the image to install additional tools.

I would like a Dockerfile that looks like this:

FROM nodered/node-red-docker:0.17.5

RUN apt-get install some-extra-tools

But this fails because the apt command is run as the node-red user which doesn't have permissions to install new software.

I notice also #9 which details other issues with the use of the USER directive. In my experience, unless there's a very good reason, it's more usual to not include a USER directive, instead allowing the system administrator to specify what user they want the container processes to run as using the --user command line switch to docker run.

This can be worked around by adding USER root before the apt-get, but that's a bit nasty and just adds more noise and layers.

suggestion: install CLI text editor

I'd like to suggest installing a CLI text editor like nano or vim as part of this docker image.
This would make it more straight-forward to change the settings.js file inside the container e.g.

Noob question about how to install extra modules when start a fresh docker container.

Hi guys, I would like to install some modules when creating a brand new docker container, I try to follow the github readme process but seems like nothing happen when I modify package.json file(in this case just a bigtimer node)

"dependencies": {
        "node-red": "0.18.4",
        "node-red-node-msgpack": "*",
        "node-red-node-base64": "*",
        "node-red-node-suncalc": "*",
        "node-red-node-random": "*",
        "node-red-contrib-bigtimer": "*"
    },

here is the docker command:

docker run --name=nodered --net=host --user=root --restart=always -d -v /opt/nodered:/data -v /opt/nodered/package.json:/usr/src/node-red/package.json -v /opt/nodered/settings.js:/data/settings.js nodered/node-red-docker:rpi 

what have I done something wrong here?
How am I suppose to create the new container and it auto install some modules for me?
Can I run some custom command when a container is created? like this in the beginning?
apt-get install libavahi-compat-libdnssd-dev

So sorry for the noob question, thanks

MQTT node connection error since version 0.17

I've had a Node-Red instance deployed with Docker for months now, and a separate Mosquitto Docker container. All the node-red-docker versions since 0.17 give me a persistent error on Node-Red's MQTTnodes when it tries to connect to Mosquitto. It doesn't work with neither my deployed container, nor the the public iot.eclipse.org one. This error does not exist when I roll back to version 0.16.2. The configuration of the mqtt nodes, the Mosquitto container and the Node-Red container on my part are the same.

Node-Red's output when it tries to connect to Mosquitto:

10 Jul 06:57:17 - [info] Starting flows
10 Jul 06:57:17 - [debug] red/nodes/flows.start : starting flow : global
10 Jul 06:57:17 - [debug] red/nodes/flows.start : starting flow : b8183da5.b7a0d
10 Jul 06:57:17 - [debug] red/nodes/flows.start : starting flow : 74a79f12.b7e46
10 Jul 06:57:17 - [debug] red/nodes/flows.start : starting flow : 97581168.06c34
10 Jul 06:57:17 - [debug] red/nodes/flows.start : starting flow : 778ebfa1.31277
10 Jul 06:57:17 - [info] [inject:6c5e27a3.74c0f8] repeat = 6000
10 Jul 06:57:17 - [info] [inject:Check Gateway status] repeat = 31000
10 Jul 06:57:17 - [info] [python-function:c7430adf.cbdd58] Python function '' running on PID 32
10 Jul 06:57:17 - [info] Started flows

Mosquitto's output when it receives the connection:

10 Jul 06:57:17 - New connection from 100.64.144.1 on port 8883.
10 Jul 06:57:17 - New connection from 172.17.0.1 on port 8883.
10 Jul 06:57:17 - Socket error on client <unknown>, disconnecting.
10 Jul 06:57:17 - Socket error on client <unknown>, disconnecting.

As you can see, I don't have much to go on with, and the error is version dependent, so I'm counting on getting some help from you.

Thank you for your time.

Unable to install/use node-red-admin

What are the steps to reproduce?

Install the NodeRED docker image on a Synology DS718+ (NAS) using the Docker-application that comes with the Synology NAS. Open a bash-terminal from within the container and try running "npm install -g node-red-admin"

What happens?

It will output some errors because it doesn't have sufficient rights to /usr/local/lib/node_modules.
When trying to sudo the npm install command it cannot find sudo.
My data-folder is located and accessible on the NAS, NodeRED is able to read/write from/in this location.

What do you expect to happen?

I would expect it to install node-red-admin on my docker NodeRED installation.

Please tell us about your environment:

  • Node-RED version: v. 0.19.4
  • node.js version: v. 6.14.4
  • npm version: v. 3.10.10
  • Platform/OS: Synology DSM 6.2.1-23824
  • Browser: Firefox 62.0.3 (64-bit), running on Windows 10

node-red-admin blocked by proxy

Hi

As per your README I've installed node-red-admin on the host OS using npm with proxy config and it can see the container's nodes fine on localhost:1880

The issue is when I go to search or install, it comes up with:

$ node-red-admin target
Target: http://localhost:1880

$ node-red-admin search node-red-contrib-soap
Error: tunneling socket could not be established, cause=write EPROTO 140418686146624:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:```

Raspberry install breaks

I'm trying to get this running on my Raspberry Pi 3 running OSMC.
It took me literally hours to get here (You guys should really improve the README. If you don't have docker experience you don't understand what $ docker build -f <version>/Dockerfile -t mynodered:<version> . should be!). What I've done now:

  • git clone this repo, cd into it and run docker build -f rpi/Dockerfile -t nodered/node-red-docker:rpi .
    But now I'm getting:

npm info lifecycle [email protected]~install: [email protected]

[email protected] install /usr/src/node-red/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

The command '/bin/sh -c npm install' returned a non-zero code: 1

broaken link in README.md

Minor issue, here's a patch:

--- README.md   2017-11-15 15:48:31.900360101 +0000
+++ newREADME.md        2017-11-15 15:55:26.536865287 +0000
@@ -4,7 +4,7 @@

 This project describes some of the many ways Node-RED can be run under Docker.
 Some basic familiarity with Docker and the
-[Docker Command Line](https://docs.docker.com/reference/commandline/cli/)
+[Docker Command Line](https://docs.docker.com/engine/reference/commandline/cli/)
 is assumed.

 This project also provides the build for the `nodered/node-red-docker`

HTTPS

How do I enable https option as well as secure node-red with username and password from within a node-red docker instance?

Password for the node-red user

Hi, When trying to install the Rpi-GPIO python library within the container, it needs access to be able to a sudo within the container. Can you tell me what the 'root' password is so I can do a sudo from the node-red user. Thanks

S.

Image architecture for Pi is incorrect

I am having trouble using the rpi Docker image in a Docker Stack deployment. When running as a stack, the service reports that the container is trying to run as amd64. However, when running as a standalone service, it works fine.

I did a bit of digging and found that the results of docker image inspect --format '{{.Architecture}}' nodered/node-red-docker:rpi report amd64 instead of arm as I'd expect. After some research, I think the only way to avoid this and to properly annotate the image as arm is to build the rpi image on an ARM device and push it to Docker Hub.

Is it possible that the rpi image can be pushed via a ARM-based device to properly tag the arch for the image as arm?

Copy flows.json and settings.js directly into the container

Hi everyone,

I would like to know if it's possible to COPY directly the flows.json and settins.js files during build time. In this way, I'm not dependent on the file system and the container self-hosts all the files needed.

Is there a way to do it?

Many thanks,
Diego

Container attachment gets interrupted.

I was attached to my Node-RED container using docker attach --sig-proxy=false when the following error printed out and the attachment broke, returning me to prompt:

/usr/local/bin/node[17]: ../src/node_buffer.cc:752:void node::Buffer::ReadFloatGeneric(const v8::FunctionCallbackInfov8::Value&) [with T = float; node::Endianness endianness = (node::Endianness)0u]: Assertion `(offset + sizeof(T)) <= (ts_obj_length)' failed.
1: node::Abort() [node-red]
2: node::Assert(char const* const () [4]) [node-red]
3: void node::Buffer::ReadFloatGeneric<float, (node::Endianness)0>(v8::FunctionCallbackInfov8::Value const&) [node-red]
4: v8::internal::FunctionCallbackArguments::Call(void (
)(v8::FunctionCallbackInfov8::Value const&)) [node-red]
5: 0x9ec66e [node-red]
6: 0x9ecf0e [node-red]
7: 0x28ed6a8060c7
Aborted (core dumped)

npm info lifecycle [email protected]~start: Failed to exec start script
npm ERR! Linux 4.4.0-81-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] start script 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-red-docker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-red-docker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-red-docker
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/node-red/npm-debug.log

At first I thought the container had crashed, but after checking I saw it was still running, I could connect to it and all the flows were working properly. After some more testing I discovered this only happens after being attached to the container for three to four minutes. This doesn't impact the performance of the container at all and is only mildly inconvenient, but I have absolutely no idea what's going on and I'd like to fix it if possible.

Thank you for the help.

npm install in network_mode host not working in node-red image with docker-compose

I am running mode-red module of nodejs with docker-compose in following way:

version: "3"
services:
    node-red:
        build: node-red/.
        container_name: mynodered
        network_mode: "host"
        volumes:
         - $PWD/data/node:/data
        ports:
         - "1880:1880"

I have placed the following docker file in folder node-red:

FROM nodered/node-red-docker:v8
RUN npm i -S basic-auth bcryptjs body-parser cheerio clone cookie cookie-parser cors cron express express-session follow-redirects fs-extra fs.notify hash-sum i18next is-utf8 js-yaml json-stringify-safe jsonata media-typer memorystore mqtt multer mustache node-red-contrib-cloudera node-red-contrib-confluent node-red-contrib-ksql node-red-contrib-python-function node-red-contrib-rdkafka node-red-contrib-s3 node-red-node-email node-red-node-feedparser node-red-node-rbe node-red-node-twitter nopt oauth2orize on-headers passport passport-http-bearer passport-oauth2-client-password raw-body semver sentiment uglify-js when ws xml2js && npm i -D chromedriver grunt grunt-chmod grunt-cli grunt-concurrent grunt-contrib-clean grunt-contrib-compress grunt-contrib-concat grunt-contrib-copy grunt-contrib-jshint grunt-contrib-uglify grunt-contrib-watch grunt-jsonlint grunt-mocha-istanbul grunt-nodemon grunt-sass grunt-simple-mocha grunt-webdriver istanbul mocha should sinon supertest wdio-chromedriver-service wdio-mocha-framework wdio-spec-reporter webdriverio && npm i -O bcrypt


When i am building image explicitly from this docker file in following way,its working fine
docker build --network host -t dvnode .

But when i am using docker-compose,it gives following error:

docker-compose up
Building node-red
Step 1/2 : FROM nodered/node-red-docker:v8
 ---> 8d6fdff59c2c
Step 2/2 : RUN npm i -S basic-auth bcryptjs body-parser cheerio clone cookie cookie-parser cors cron express express-session follow-redirects fs-extra fs.notify hash-sum i18next is-utf8 js-yaml json-stringify-safe jsonata media-typer memorystore mqtt multer mustache node-red-contrib-cloudera node-red-contrib-confluent node-red-contrib-ksql node-red-contrib-python-function node-red-contrib-rdkafka node-red-contrib-s3 node-red-node-email node-red-node-feedparser node-red-node-rbe node-red-node-twitter nopt oauth2orize on-headers passport passport-http-bearer passport-oauth2-client-password raw-body semver sentiment uglify-js when ws xml2js && npm i -D chromedriver grunt grunt-chmod grunt-cli grunt-concurrent grunt-contrib-clean grunt-contrib-compress grunt-contrib-concat grunt-contrib-copy grunt-contrib-jshint grunt-contrib-uglify grunt-contrib-watch grunt-jsonlint grunt-mocha-istanbul grunt-nodemon grunt-sass grunt-simple-mocha grunt-webdriver istanbul mocha should sinon supertest wdio-chromedriver-service wdio-mocha-framework wdio-spec-reporter webdriverio && npm i -O bcrypt
 ---> Running in a69e76805cc1
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EAI_AGAIN: request to https://registry.npmjs.org/basic-auth failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/node-red-contrib-cloudera failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443

npm ERR! A complete log of this run can be found in:
npm ERR!     /usr/src/node-red/.npm/_logs/2018-05-03T08_10_08_489Z-debug.log
ERROR: Service 'node-red' failed to build: The command '/bin/sh -c npm i -S basic-auth bcryptjs body-parser cheerio clone cookie cookie-parser cors cron express express-session follow-redirects fs-extra fs.notify hash-sum i18next is-utf8 js-yaml json-stringify-safe jsonata media-typer memorystore mqtt multer mustache node-red-contrib-cloudera node-red-contrib-confluent node-red-contrib-ksql node-red-contrib-python-function node-red-contrib-rdkafka node-red-contrib-s3 node-red-node-email node-red-node-feedparser node-red-node-rbe node-red-node-twitter nopt oauth2orize on-headers passport passport-http-bearer passport-oauth2-client-password raw-body semver sentiment uglify-js when ws xml2js && npm i -D chromedriver grunt grunt-chmod grunt-cli grunt-concurrent grunt-contrib-clean grunt-contrib-compress grunt-contrib-concat grunt-contrib-copy grunt-contrib-jshint grunt-contrib-uglify grunt-contrib-watch grunt-jsonlint grunt-mocha-istanbul grunt-nodemon grunt-sass grunt-simple-mocha grunt-webdriver istanbul mocha should sinon supertest wdio-chromedriver-service wdio-mocha-framework wdio-spec-reporter webdriverio && npm i -O bcrypt' returned a non-zero code: 1

[warn] Cannot find Pi RPi.GPIO python library

Hi,

when I try to run the node-red-docker rpi image, there's the following warning in the log:

18 Jun 18:07:18 - [warn] Cannot find Pi RPi.GPIO python library
18 Jun 18:07:21 - [warn] ------------------------------------------------------
18 Jun 18:07:21 - [warn] [rpi-gpio] Warning : Cannot find Pi RPi.GPIO python library
18 Jun 18:07:21 - [warn] ------------------------------------------------------

How is it possible to enable GPIO library, as I want to use node-red to interact with the gpio of the raspberry?

Thanks,
Diego

Wrong timezone

Greetings!
I have problem with node-red.
I have tried to change timezone in node red but nothing works.
I am running node red on synology NAS.

can not pass through /dev/tty* to docker image

using --device=/dev/ttyACM0 on docker commandline....
the "serial in" node cannot connect due to Permisson error - from the log in th edocker:

[error] serial port /dev/ttyACM0 error: Error: Error: Permission denied, cannot open /dev/ttyACM0

It may be due to user node-red not having access to /dev/
I have tried editing the Dockerfile to remove USER node-red (to run Node-Red as root but serial then produces these errors (on LATEST docker - not RPI):

[warn] [serialport] Error: Could not locate the bindings file. Tried:
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/build/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/build/Debug/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/build/Release/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/out/Debug/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/Debug/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/out/Release/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/Release/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/build/default/serialport.node
→ /usr/src/node-red/node_modules/node-red/node_modules/node-red-node-serialport/node_modules/serialport/compiled/4.6.0/linux/x64/serialport.node

Any idea how I can get a serial pass through to work on the official Docker image (it works on my unofficial version)

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Hi everyone,

I'm experiencing the "JavaScript heap out of memory" on my flow when I try to receive a HTTP post request.

This is the logging:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

<--- Last few GCs --->

185405 ms: Mark-sweep 486.4 (529.0) -> 485.7 (529.0) MB, 7368.5 / 0.0 ms [allocation failure] [GC in old space requested].
192804 ms: Mark-sweep 485.7 (529.0) -> 485.3 (529.0) MB, 7398.4 / 0.0 ms [allocation failure] [GC in old space requested].
200205 ms: Mark-sweep 485.3 (529.0) -> 495.3 (518.0) MB, 7400.4 / 0.0 ms [last resort gc].
207616 ms: Mark-sweep 495.3 (518.0) -> 505.4 (518.0) MB, 7411.3 / 0.0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x29c7c36d
1: setTimeout(aka setTimeout) [/usr/src/node-red/node_modules/node-red/nodes/core/core/80-function.js:~146] [pc=0x70e333d4] (this=0x29c081d9 )
2: arguments adaptor frame: 2->0
3: /* anonymous / [evalmachine.:~1] [pc=0x3c1c99e4] (this=0x712e4659 ,msg=0x5eeaf835 <an Object with map 0x71cdd7fd>)
4: /
anonymous */ [evalmachine.:28] [p...

Aborted (core dumped)

npm info lifecycle [email protected]~start: Failed to exec start script
npm ERR! Linux 4.9.35-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data" "--setting" "/data/settings.js"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] start script 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-red-docker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-red-docker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-red-docker
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/node-red/npm-debug.log

This is the content of npm-debug.log :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'start',
1 verbose cli '--',
1 verbose cli '--userDir',
1 verbose cli '/data',
1 verbose cli '--setting',
1 verbose cli '/data/settings.js' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 silly lifecycle [email protected]
prestart: no script for prestart, continuing
7 info lifecycle [email protected]start: [email protected]
8 verbose lifecycle [email protected]
start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/src/node-red/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle [email protected]
start: CWD: /usr/src/node-red
11 silly lifecycle [email protected]start: Args: [ '-c',
11 silly lifecycle 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"' ]
12 silly lifecycle [email protected]
start: Returned: code: 134 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"
14 verbose stack Exit status 134
14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:891:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /usr/src/node-red
17 error Linux 4.9.35-v7+
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data" "--setting" "/data/settings.js"
19 error node v6.11.0
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] start: node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"
22 error Exit status 134
23 error Failed at the [email protected] start script 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the node-red-docker package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data" "--setting" "/data/settings.js"
23 error You can get information on how to open an issue for this project with:
23 error npm bugs node-red-docker
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls node-red-docker
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

This is how I run my container:

docker run -d -p 1881:1880 --name mynodered --device=/dev/serial0 --user=root -e NODE_OPTIONS="--max_old_space_size=512" --log-opt max-file=2 --log-opt max-size=2k braghettos/node-red-docker:0.17.5-rpi

I've enabled HTTPS in settings.js file .

Many thanks in advance,

Diego

Latest still using node 4.x on docker hub

Hey didn't the node 6.x update in the DockerFiles make it to docker hub? Seemed to have been updated at the same time as node-red update but I'm always getting node 4.x with the slim version.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • The engines config in 1 of your package.json files was updated to the new Node.js version

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Update Node to v6 (or 8 ???) on aarch64

On aarch64, the version provided still pulls in Node 4, instead of Node 6 like all the rest.

It should be a simple one-line fix to the FROM line in the Dockerfile, but there's a small snag in Node version naming at Docker hub. I don't want to pull in some specific point release of Node, just whatever is latest for 6.

See tianon/jenkins-groovy#21 for the naming issue on Docker hub, and when it gets resolved this will be very easy to resolve as well.

Node-RED Admin Tool installation.

Hi,
When trying to install the Admin Tool (npm install -g node-red-admin) root required, but sudo is not working.
Can you tell me please, what Im doing wrong.

synology folder mount problem

hi,
i am very new to docker world
I run docker on my Synology and I deploy this image without mounting folder in Synology and it works.
But I don't have access to the files in the container and any problem I have I need to reinstall.

i want to use, the Synology to mount option and link the folder in my nas so it will be the /data folder.
If I put /data as the mount path the container dosent start.

Any help on what to do?

Use adminAuth; login failed

Hi,

(I am new to docker and node red so forgive me f I ask stupid questions)

I am running nodered/node-red-docker:latest within container station on a Qnap-253

It is running and I can access it via HTTP. But there is no login.

I updated the settings.je file and uncommented the adminAuth part. After reading up I see I need to use a hashed pwd which can be generated with node-red-admin. This is not by default installed so tried to install by running the following within the container (on qnap you can execute a command from the container station GUI):

npm install -g node-red-admin

This gave an error:

npm ERR! Linux 3.19.8                                                                                                                                                               
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "node-red-admin"                                                                                            
npm ERR! node v6.9.4                                                                                                                                                                
npm ERR! npm  v3.10.10                                                                                                                                                              
npm ERR! path /usr/local/lib/node_modules                                                                                                                                           
npm ERR! code EACCES                                                                                                                                                                
npm ERR! errno -13                                                                                                                                                                  
npm ERR! syscall access                                                                                                                                                             
                                                                                                                                                                                    
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'                                                                                                     
npm ERR!     at Error (native)                                                                                                                                                      
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'                                                                                                  
npm ERR!     at Error (native)                                                                                                                                                      
npm ERR!   errno: -13,                                                                                                                                                              
npm ERR!   code: 'EACCES',                                                                                                                                                          
npm ERR!   syscall: 'access',                                                                                                                                                       
npm ERR!   path: '/usr/local/lib/node_modules' }                                                                                                                                    
npm ERR!                                                                                                                                                                            
npm ERR! Please try running this command again as root/Administrator.  

I am not sure how to change my credentials within the container so now I am stuck, any hints/tips are welcome. Or maybe another way to update the settings.js file correctly...

Thx!

EACCES: permission denied, open '/data/.config.json'

Trying to get node-red up and running on my Raspberry Pi. The docker command I am using is:

docker run -it -p 1880:1880 --restart=always --name="nodered" -v /media/data/node-red/:/data -e FLOWS=flows.json nodered/node-red-docker:rpi

Full log output is:

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info prestart [email protected]
npm info start [email protected]

> [email protected] start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"



Welcome to Node-RED
===================

12 Sep 21:00:37 - [info] Node-RED version: v0.14.6
12 Sep 21:00:37 - [info] Node.js  version: v4.4.4
12 Sep 21:00:37 - [info] Linux 4.4.13-v7+ arm LE
12 Sep 21:00:37 - [info] Loading palette nodes
{ [Error: EACCES: permission denied, open '/data/.config.json']
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/data/.config.json' }
12 Sep 21:00:45 - [info] Server now running at http://127.0.0.1:1880/
12 Sep 21:01:59 - [error] Node-RED runtime not started
^C12 Sep 21:02:18 - [info] Stopping flows

/media/data/node-red contains a settings.js file and a flows.json file too, any ideas what might be causing this permissions problem?

Different installation of Node-RED on Raspbian Jessie

Hi everyone,

I'm trying to understand why the Node-RED installation that comes with the Raspbian Jessie OS has differences with the version you ship on Docker.
The first difference I can see is that on Raspbian there are more nodes available, i.e. "Watson IoT", "serial", "play audio", "smooth", but it doesn't have "base64", "msgpack", "sunrise" nodes that are available on the Docker version
For the Raspberry Pi specific nodes, the version on Raspbian has "ledborg" and "sensehat" that are not available on Docker.
Also the network node "ping" is available only on Raspbian.

Is it possible to provide the same user experience that is available on the base Raspbian?

Also the paths are different, the flows file is different and so on.

I would like to have also an interface for XBee, but my requirement maybe works just for me.

Thanks,

Diego

Unable to login from domain

  • Node-RED version: 0.19.4
  • node.js version: 6.14.4
  • npm version: 3.10.10
  • Platform/OS: Synology DSM 6.2-23739 update 2
  • Browser: Firefox (latest), Google Chrome, Safari mobile, Microsoft Edge

Dear community, developers,

I’ve installed the Docker image of NodeRED on my Synology DS 718+, I’ve enabled login. Whenever I’m using my local IP-address, I’ll get a login screen and can login. Whenever I enable port forwarding and try to login from my domain (domain.xxx:1880), I’ll get the login-screen but after each login attempt I’m transferred to the login again. This behavior is on all mentioned browsers (Windows 10) except Safari mobile that is running on my iPhone. With login disabled NodeRED is running fine locally and from the domain. Any idea or suggestion?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.