Installing on NanoPI
1 2 3 4 5 |
apt-get -y install curl curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - apt-get install -y nodejs nodejs -v npm install -g node-red |
Starting Node-RED server
1 |
node-red |
Opening Node-RED web page
Start a webbrowser with http://localhost:1880/
Starting Node-RED automatically at boot
see https://nodered.org/docs/hardware/raspberrypi
Create a new file as root
1 |
vi /lib/systemd/system/nodered.service |
and copy the following content to it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# systemd service file to start Node-RED [Unit] Description=Node-RED graphical event wiring tool. Wants=network.target Documentation=http://nodered.org/docs/hardware/raspberrypi.html [Service] Type=simple # Run as normal pi user - feel free to change... User=fa Group=fa WorkingDirectory=/home/fa Nice=5 Environment="NODE_OPTIONS=--max_old_space_size=128" # uncomment and edit next line if you need an http proxy #Environment="HTTP_PROXY=my.httpproxy.server.address" # uncomment the next line for a more verbose log output #Environment="NODE_RED_OPTIONS=-v" #ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS # Use SIGINT to stop KillSignal=SIGINT # Auto restart on crash Restart=on-failure # Tag things in the log SyslogIdentifier=Node-RED #StandardOutput=syslog [Install] WantedBy=multi-user.targetystemd/system/nodered.service |
to activate/deactivate the starting of the service at boot use the following commands
1 2 |
sudo systemctl enable nodered.service sudo systemctl disable nodered.service |
to start/stop Node-Red use the following commands
1 2 |
service nodered start service nodered stop |
Securing Node-RED
see https://nodered.org/docs/security
1 2 3 4 5 6 7 8 9 |
npm install -g node-red-admin node-red-admin hash-pw vi ~.node-red/settings.js #copy the password string to adminAuth section and remove #the comment tag #copy the password string to httpNodeAuth and httpStaticAuth and remove #the comment tag vi /usr/lib/node_modules/node-red/settings.js #do the same |
Installing additional software
Go to menu “Manage palette”.
Switch to tab “Install”.
Search for “node-red-dashboard” and click install.
Search for “node-red-node-mysql” and click install.
Open the dashboard in a browser via http://localhost:1880/ui