2016-01-08 06:16:00 +02:00
|
|
|
node-red
|
|
|
|
========
|
2015-12-04 11:49:45 +02:00
|
|
|
|
2020-04-16 16:47:53 +02:00
|
|
|
<img src="https://nodered.org/about/resources/media/node-red-icon-2.png" width="100">
|
2015-12-04 11:49:45 +02:00
|
|
|
|
|
|
|
[Node-RED][1] is a tool for wiring together hardware devices, APIs and online
|
|
|
|
services in new and interesting ways.
|
|
|
|
|
2016-08-22 07:51:06 +02:00
|
|
|
![](screenshot.png)
|
|
|
|
|
2015-12-04 13:13:13 +02:00
|
|
|
## directory tree
|
2020-04-16 16:47:53 +02:00
|
|
|
> The `data` directory will be created after first running.
|
2015-12-04 13:13:13 +02:00
|
|
|
|
|
|
|
```
|
2020-04-16 16:47:53 +02:00
|
|
|
~./node-red/
|
2015-12-04 13:13:13 +02:00
|
|
|
├── docker-compose.yml
|
2019-03-13 07:38:16 +02:00
|
|
|
└── data/
|
2015-12-04 13:13:13 +02:00
|
|
|
├── flows_cred.json
|
|
|
|
├── flows.json
|
|
|
|
├── lib/
|
|
|
|
│ └── flows
|
|
|
|
└── settings.js
|
|
|
|
```
|
2020-04-16 16:47:53 +02:00
|
|
|
> The `arm` directory is only needed for ARM deployments, delete it if
|
|
|
|
> you are not using `arm`.
|
2015-12-04 13:13:13 +02:00
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
2016-09-22 05:40:47 +02:00
|
|
|
```yaml
|
2016-01-08 06:16:00 +02:00
|
|
|
node-red:
|
|
|
|
image: vimagick/node-red
|
2015-12-04 13:13:13 +02:00
|
|
|
ports:
|
|
|
|
- "1880:1880"
|
|
|
|
volumes:
|
2019-03-13 07:38:16 +02:00
|
|
|
- ./data:/data
|
2015-12-04 13:13:13 +02:00
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
2020-04-16 16:47:53 +02:00
|
|
|
## set-up
|
2015-12-04 13:23:58 +02:00
|
|
|
|
2020-04-16 16:47:53 +02:00
|
|
|
Copy only the `docker-compose.yml` to your desired installation folder.
|
|
|
|
And follow these steps:
|
2015-12-04 13:13:13 +02:00
|
|
|
|
2019-03-16 10:37:35 +02:00
|
|
|
```bash
|
2015-12-04 13:13:13 +02:00
|
|
|
$ docker-compose up -d
|
2019-03-16 10:37:35 +02:00
|
|
|
|
2016-09-24 02:49:48 +02:00
|
|
|
$ docker-compose exec node-red node-red-admin hash-pw
|
2019-03-16 10:37:35 +02:00
|
|
|
>>> Password: ******
|
|
|
|
... $2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.
|
|
|
|
|
2020-04-16 16:47:53 +02:00
|
|
|
# Uncomment the adminAuth section and add your hashed password
|
|
|
|
$ sudo vi data/settings.js
|
2019-03-16 10:37:35 +02:00
|
|
|
|
2016-08-22 13:54:36 +02:00
|
|
|
$ docker-compose exec node-red bash
|
2019-03-13 07:38:16 +02:00
|
|
|
>>> cd /data
|
2016-08-22 13:54:36 +02:00
|
|
|
>>> apk add -U build-base
|
|
|
|
>>> npm install node-red-node-irc
|
|
|
|
>>> npm install node-red-node-daemon
|
|
|
|
>>> exit
|
2019-03-16 10:37:35 +02:00
|
|
|
|
2015-12-04 13:13:13 +02:00
|
|
|
$ docker-compose restart
|
|
|
|
```
|
|
|
|
|
2016-08-22 13:54:36 +02:00
|
|
|
> Install nodes from [node-red-nodes](https://github.com/node-red/node-red-nodes).
|
|
|
|
|
2015-12-04 11:49:45 +02:00
|
|
|
[1]: http://nodered.org/
|
2020-04-16 16:47:53 +02:00
|
|
|
|
|
|
|
## settings.js
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
module.exports = {
|
|
|
|
...
|
|
|
|
adminAuth: {
|
|
|
|
type: "credentials",
|
|
|
|
users: [{
|
|
|
|
username: "admin",
|
|
|
|
password: "ADD_HERE_YOUR_HASH_PASSWORD",
|
|
|
|
permissions: "*"
|
|
|
|
}],
|
|
|
|
default: {
|
|
|
|
permissions: "read"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
...
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
> Password hash can be generated by running `node-red-admin hash-pw`
|
|
|
|
> <https://nodered.org/docs/security>
|