=====nodered=====
https://nodered.org/docs/getting-started/docker
Creating a nodered hash if runnning nodered on docker:
docker exec -it node-red npx node-red admin hash-pw
Quickstart:
docker run -it -p 1880:1880 --name mynodered nodered/node-red
docker run -d -p 1880:1880 -v /data/nodered:/data --name mynodered nodered/node-red #run in daemon mode
====Password====
node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" my_PW #create hash from "my_PW"
/data/nodered/settings.js #search for "adminAuth" and edit "username" and "password" (enter hash from previous comand)
**Hint:** Restart service to activate!
Example:
adminAuth: {
sessionExpiryTime: 86400,
type: "credentials",
users: [{
username: "admin",
password: "$24dwhrstjjgmfz,b8nhqY519XHwMStfh3456rdsbn",
permissions: "*"
}]
},
====Function====
Trigger action if payload > 70:
var payload=msg.payload;
if (payload>70)
return msg;
====Required nodes====
Examples:
{{:iot:pasted:20240205-194239.png}}
====Dashboard====
Run
npm install node-red-dashboard
inside container, to install dashboard. Update:
npm install -g npm@8.19.2
====Compose====
docker-compose -f docker-compose.yml up -d
################################################################################
# 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: '2'
#version: "3.7"
services:
node-red:
image: nodered/node-red:latest
environment:
- TZ=Europe/Berlin
ports:
- "1880:1880"
networks:
- node-red-net
volumes:
- /data/nodered:/data
user: "0:0"
restart: always
volumes:
node-red-data:
networks:
node-red-net: