Instalación y configuración de Node-RED

Fecha publicación
#
18
Dificultad
Básico
3 more properties
Publicado
tags
i40sys, industry 4.0, industry40.systems, industrial, remote access, acceso remoto, plc, siemens, omron, ubuntu, linux, iot gateway, gateway, iot, internet of things, docker, container, ubuntu, node-red, programming, nodered, node_red


NodeRED es la herramienta ideal para gestionar la lógica de nuestros proyectos. Recolectar datos de sensores y otros dispositivos, procesarlos y enviarlos hacia la BBDD u otros servicios centrales ya sea en local o en la nube.

Directorio

/docker-data/node-red
/docker-data/node-red/data
Shell
drwxr-xr-x 3 1000 1000 4096 Mar 24 14:15 data

Bash
mkdir -p /docker-data/node-red/data
chown 1000.1000 /docker-data/node-red/data

/docker/node-red/docker-compose.yml

YAML
version: "3.7"

services:
  node-red:
    container_name: node-red
    image: nodered/node-red:latest
    environment:
      - TZ=Europe/Madrid
    volumes:
      - /dev:/host/dev
      - /etc/localtime:/etc/localtime:ro
      - ./data:/data
    network_mode: host
    healthcheck:
        test: ["CMD-SHELL","node /healthcheck.js"]
        interval: 60s
        timeout: 3s
        retries: 3
        start_period: 30s
    restart: unless-stopped
    privileged: true

Añadir usuario para acceder a Node-Red

Crear un nuevo password

Shell
docker run -it --rm --entrypoint /bin/sh nodered/node-red
node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" your-password-here
exit

/docker-data/data/settings.js

YAML
adminAuth: {
       type: "credentials",
       users: [{
           username: "admin",
           password: "$2b$08$HaTrfkNeGlpFwOShiFL3V.49VzdgGXdNqRe7hO1Omh/LbsjTP0x16",
           permissions: "*"
       }]
   },

Habilitar proyectos en node-red

/docker-data/data/settings.js
YAML
// Customising the editor
    editorTheme: {
        projects: {
            // To enable the Projects feature, set this value to true
            enabled: true
        }
    }

Personalizar NodeRED

/docker-data/data/settings.js
YAML
editorTheme: {
        page: {
            title: "i40sys flows"
        },
        header: {
            title: "Industry 4.0 Systems - Flows",
            image: "", // or null to remove image
            url: "http://nodered.org" // optional url to make the header text/image a link to this url
        },
        projects: {
            // To enable the Projects feature, set this value to true
            enabled: true
        }
    }