2016-01-08 06:16:00 +02:00
|
|
|
node-red
|
|
|
|
========
|
2015-12-04 11:49:45 +02:00
|
|
|
|
2016-01-08 06:16:00 +02:00
|
|
|
![](https://badge.imagelayers.io/vimagick/node-red:latest.svg)
|
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
|
|
|
|
|
|
|
|
```
|
2016-01-08 06:16:00 +02:00
|
|
|
~/fig/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
|
|
|
|
```
|
|
|
|
|
|
|
|
> The `node-red` directory will be created after first running.
|
|
|
|
|
|
|
|
## 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
|
|
|
|
```
|
|
|
|
|
|
|
|
## settings.js
|
|
|
|
|
2016-09-22 05:40:47 +02:00
|
|
|
```javascript
|
2015-12-04 13:13:13 +02:00
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
adminAuth: {
|
|
|
|
type: "credentials",
|
|
|
|
users: [{
|
|
|
|
username: "admin",
|
|
|
|
password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
|
|
|
|
permissions: "*"
|
2016-09-24 02:49:48 +02:00
|
|
|
}],
|
|
|
|
default: {
|
|
|
|
permissions: "read"
|
|
|
|
}
|
2015-12-04 13:13:13 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-03-16 10:37:35 +02:00
|
|
|
> Password hash can be generated by running `node-red-admin hash-pw`
|
|
|
|
> <https://nodered.org/docs/security>
|
2015-12-04 13:23:58 +02:00
|
|
|
|
2015-12-04 13:13:13 +02:00
|
|
|
## up and running
|
|
|
|
|
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.
|
|
|
|
|
2016-09-22 05:40:47 +02:00
|
|
|
$ 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/
|