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
|
|
|
|
└── node-red/
|
|
|
|
├── flows_cred.json
|
|
|
|
├── flows.json
|
|
|
|
├── lib/
|
|
|
|
│ └── flows
|
|
|
|
└── settings.js
|
|
|
|
```
|
|
|
|
|
|
|
|
> The `node-red` directory will be created after first running.
|
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
|
|
|
```
|
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:
|
|
|
|
- ./node-red:/root/.node-red
|
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
|
|
|
## settings.js
|
|
|
|
|
|
|
|
```
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
//...
|
|
|
|
|
|
|
|
flowFile: 'flows.json',
|
|
|
|
|
|
|
|
//...
|
|
|
|
|
|
|
|
adminAuth: {
|
|
|
|
type: "credentials",
|
|
|
|
users: [{
|
|
|
|
username: "admin",
|
|
|
|
password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
|
|
|
|
permissions: "*"
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
|
|
|
|
//...
|
|
|
|
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-12-04 13:23:58 +02:00
|
|
|
> Password hash can be generated by:
|
|
|
|
>> `node -e "console.log(require('bcryptjs').hashSync('password', 8))"`
|
|
|
|
|
2015-12-04 13:13:13 +02:00
|
|
|
## up and running
|
|
|
|
|
|
|
|
```
|
2016-01-08 06:16:00 +02:00
|
|
|
$ cd ~/fig/node-red/
|
2015-12-04 13:13:13 +02:00
|
|
|
$ docker-compose up -d
|
|
|
|
$ vi node-red/settings.js
|
2016-08-22 13:54:36 +02:00
|
|
|
$ docker-compose exec node-red bash
|
|
|
|
>>> cd /root/.node-red
|
|
|
|
>>> apk add -U build-base
|
|
|
|
>>> npm install node-red-node-irc
|
|
|
|
>>> npm install node-red-node-daemon
|
|
|
|
>>> exit
|
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/
|