1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00

Merge pull request #132 from LaQuay/master

[node-red] Improve explanation and readability
This commit is contained in:
Kevin He 2021-07-22 10:52:37 +08:00 committed by GitHub
commit 770bb4c671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
node-red
========
![](https://badge.imagelayers.io/vimagick/node-red:latest.svg)
<img src="https://nodered.org/about/resources/media/node-red-icon-2.png" width="100">
[Node-RED][1] is a tool for wiring together hardware devices, APIs and online
services in new and interesting ways.
@ -9,9 +9,10 @@ services in new and interesting ways.
![](screenshot.png)
## directory tree
> The `data` directory will be created after first running.
```
~/fig/node-red/
~./node-red/
├── docker-compose.yml
└── data/
├── flows_cred.json
@ -20,8 +21,8 @@ services in new and interesting ways.
│ └── flows
└── settings.js
```
> The `node-red` directory will be created after first running.
> The `arm` directory is only needed for ARM deployments, delete it if
> you are not using `arm`.
## docker-compose.yml
@ -35,30 +36,10 @@ node-red:
restart: always
```
## settings.js
## set-up
```javascript
module.exports = {
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
permissions: "*"
}],
default: {
permissions: "read"
}
},
}
```
> Password hash can be generated by running `node-red-admin hash-pw`
> <https://nodered.org/docs/security>
## up and running
Copy only the `docker-compose.yml` to your desired installation folder.
And follow these steps:
```bash
$ docker-compose up -d
@ -67,7 +48,8 @@ $ docker-compose exec node-red node-red-admin hash-pw
>>> Password: ******
... $2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.
$ vi data/settings.js
# Uncomment the adminAuth section and add your hashed password
$ sudo vi data/settings.js
$ docker-compose exec node-red bash
>>> cd /data
@ -82,3 +64,26 @@ $ docker-compose restart
> Install nodes from [node-red-nodes](https://github.com/node-red/node-red-nodes).
[1]: http://nodered.org/
## 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>