mirror of
https://github.com/hassio-addons/addon-node-red.git
synced 2025-05-07 04:21:31 +00:00
✨ Initial add-on code
This commit is contained in:
parent
932abdf70e
commit
866de00a83
19 changed files with 1221 additions and 0 deletions
332
.gitlab-ci.yml
Normal file
332
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,332 @@
|
|||
---
|
||||
image: docker:stable
|
||||
|
||||
variables:
|
||||
ADDON_GITHUB_REPO: hassio-addons/addon-node-red
|
||||
ADDON_SLUG: node-red
|
||||
ADDON_TARGET: node-red
|
||||
DOCKER_DRIVER: overlay2
|
||||
DOCKER_HUB_ORG: hassioaddons
|
||||
|
||||
stages:
|
||||
- preflight
|
||||
- build
|
||||
- scan
|
||||
- deploy
|
||||
- publish
|
||||
|
||||
# Generic DIND template
|
||||
.dind: &dind
|
||||
before_script:
|
||||
- docker info
|
||||
- docker login -u gitlab-ci-token -p "${CI_JOB_TOKEN}" registry.gitlab.com
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
# Generic preflight template
|
||||
.preflight: &preflight
|
||||
stage: preflight
|
||||
tags:
|
||||
- preflight
|
||||
|
||||
# Generic build template
|
||||
.build: &build
|
||||
<<: *dind
|
||||
stage: build
|
||||
script:
|
||||
- |
|
||||
docker run \
|
||||
--privileged \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--volume "$PWD":/docker \
|
||||
hassioaddons/build-env:latest \
|
||||
--image "addon" \
|
||||
--cache-from "${DOCKER_HUB_ORG}/${ADDON_SLUG}-${ADDON_ARCH}" \
|
||||
--cache-tag "test" \
|
||||
--git-url "https://github.com/${ADDON_GITHUB_REPO}" \
|
||||
--target "${ADDON_TARGET}" \
|
||||
--tag-latest \
|
||||
--git \
|
||||
--${ADDON_ARCH}
|
||||
- |
|
||||
docker tag \
|
||||
"addon:latest" \
|
||||
"registry.gitlab.com/${CI_PROJECT_PATH}/${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
||||
- |
|
||||
docker push \
|
||||
"registry.gitlab.com/${CI_PROJECT_PATH}/${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
||||
tags:
|
||||
- build
|
||||
|
||||
# Generic scan template
|
||||
.scan: &scan
|
||||
<<: *dind
|
||||
stage: scan
|
||||
allow_failure: true
|
||||
before_script:
|
||||
- docker info
|
||||
- docker run -d --name db arminc/clair-db:latest
|
||||
- docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1
|
||||
- apk add -U curl ca-certificates
|
||||
- |
|
||||
curl \
|
||||
--silent \
|
||||
--show-error \
|
||||
--location \
|
||||
--fail \
|
||||
--retry 3 \
|
||||
--output /usr/bin/clair-scanner \
|
||||
https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64
|
||||
- chmod +x /usr/bin/clair-scanner
|
||||
- touch clair-whitelist.yml
|
||||
- echo "Waiting for Clair to start"
|
||||
- |
|
||||
while ! nc -z docker 6060; do
|
||||
sleep 1
|
||||
WAIT=$((${WAIT} + 1))
|
||||
if [ "${WAIT}" -gt 30 ]; then
|
||||
echo "Error > Timeout waiting for Clair to start"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
- docker pull "registry.gitlab.com/${CI_PROJECT_PATH}/${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
||||
script:
|
||||
- |
|
||||
clair-scanner \
|
||||
-c http://docker:6060 \
|
||||
--ip $(hostname -i) \
|
||||
-w clair-whitelist.yml \
|
||||
"registry.gitlab.com/${CI_PROJECT_PATH}/${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
||||
tags:
|
||||
- scan
|
||||
|
||||
# Generic deploy template
|
||||
.deploy: &deploy
|
||||
<<: *dind
|
||||
stage: deploy
|
||||
before_script:
|
||||
- docker info
|
||||
- docker login -u gitlab-ci-token -p "${CI_JOB_TOKEN}" registry.gitlab.com
|
||||
- docker pull "registry.gitlab.com/${CI_PROJECT_PATH}/${ADDON_ARCH}:${CI_COMMIT_SHA}"
|
||||
- docker pull hassioaddons/build-env:latest
|
||||
script:
|
||||
- |
|
||||
docker run \
|
||||
--privileged \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--volume "$PWD":/docker \
|
||||
hassioaddons/build-env:latest \
|
||||
--image "${DOCKER_HUB_ORG}/${ADDON_SLUG}-${ADDON_ARCH}" \
|
||||
--cache-from "registry.gitlab.com/${CI_PROJECT_PATH}/${ADDON_ARCH}" \
|
||||
--cache-tag "${CI_COMMIT_SHA}" \
|
||||
--git-url "https://github.com/${ADDON_GITHUB_REPO}" \
|
||||
--target "${ADDON_TARGET}" \
|
||||
--login "${DOCKER_LOGIN}" \
|
||||
--password "${DOCKER_PASSWORD}" \
|
||||
--git \
|
||||
--push \
|
||||
--${ADDON_ARCH}
|
||||
tags:
|
||||
- deploy
|
||||
|
||||
# Generic publish template
|
||||
.publish: &publish
|
||||
stage: publish
|
||||
image:
|
||||
name: hassioaddons/repository-updater:latest
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- |
|
||||
repository-updater \
|
||||
--token "${GITHUB_TOKEN}" \
|
||||
--repository "${REPOSITORY}" \
|
||||
--addon "${ADDON_GITHUB_REPO}"
|
||||
tags:
|
||||
- publish
|
||||
|
||||
# Preflight jobs
|
||||
hadolint:
|
||||
<<: *preflight
|
||||
image: hadolint/hadolint:latest
|
||||
before_script:
|
||||
- hadolint --version
|
||||
script:
|
||||
- hadolint "${ADDON_TARGET}/Dockerfile"
|
||||
|
||||
shellcheck:
|
||||
<<: *preflight
|
||||
image:
|
||||
name: koalaman/shellcheck-alpine:stable
|
||||
entrypoint: [""]
|
||||
before_script:
|
||||
- shellcheck --version
|
||||
- apk --no-cache add grep
|
||||
- |
|
||||
find . -type f -print0 | \
|
||||
xargs -0 sed -i 's:#!/usr/bin/with-contenv bash:#!/bin/bash:g'
|
||||
script:
|
||||
- |
|
||||
for file in $(grep -IRl "#\!\(/usr/bin/env \|/bin/\)" --exclude-dir ".git" "${ADDON_TARGET}"); do
|
||||
if ! shellcheck $file; then
|
||||
export FAILED=1
|
||||
else
|
||||
echo "$file OK"
|
||||
fi
|
||||
done
|
||||
if [ "${FAILED}" = "1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
yamllint:
|
||||
<<: *preflight
|
||||
image: sdesbure/yamllint
|
||||
before_script:
|
||||
- yamllint --version
|
||||
script:
|
||||
- yamllint .
|
||||
|
||||
jsonlint:
|
||||
<<: *preflight
|
||||
image: sahsu/docker-jsonlint
|
||||
before_script:
|
||||
- jsonlint --version || true
|
||||
script:
|
||||
- |
|
||||
for file in $(find . -type f -name "*.json"); do
|
||||
if ! jsonlint -q $file; then
|
||||
export FAILED=1
|
||||
else
|
||||
echo "$file OK"
|
||||
fi
|
||||
done
|
||||
if [ "${FAILED}" = "1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
markdownlint:
|
||||
<<: *preflight
|
||||
image:
|
||||
name: ruby:alpine
|
||||
entrypoint: [""]
|
||||
before_script:
|
||||
- gem install mdl
|
||||
- mdl --version
|
||||
script:
|
||||
- mdl --style all --warnings .
|
||||
|
||||
# Build jobs
|
||||
build:armhf:
|
||||
<<: *build
|
||||
variables:
|
||||
ADDON_ARCH: armhf
|
||||
|
||||
build:aarch64:
|
||||
<<: *build
|
||||
variables:
|
||||
ADDON_ARCH: aarch64
|
||||
|
||||
build:i386:
|
||||
<<: *build
|
||||
variables:
|
||||
ADDON_ARCH: i386
|
||||
|
||||
build:amd64:
|
||||
<<: *build
|
||||
variables:
|
||||
ADDON_ARCH: amd64
|
||||
|
||||
# Scan jobs
|
||||
clair:armhf:
|
||||
<<: *scan
|
||||
variables:
|
||||
ADDON_ARCH: armhf
|
||||
|
||||
clair:aarch64:
|
||||
<<: *scan
|
||||
variables:
|
||||
ADDON_ARCH: aarch64
|
||||
|
||||
clair:i386:
|
||||
<<: *scan
|
||||
variables:
|
||||
ADDON_ARCH: i386
|
||||
|
||||
clair:amd64:
|
||||
<<: *scan
|
||||
variables:
|
||||
ADDON_ARCH: amd64
|
||||
|
||||
# Deploy jobs
|
||||
deploy:armhf:
|
||||
<<: *deploy
|
||||
variables:
|
||||
ADDON_ARCH: armhf
|
||||
only:
|
||||
- master
|
||||
- /^v\d+\.\d+\.\d+(?:-(?:beta|rc)(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?)?$/
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
|
||||
deploy:aarch64:
|
||||
<<: *deploy
|
||||
variables:
|
||||
ADDON_ARCH: aarch64
|
||||
only:
|
||||
- master
|
||||
- /^v\d+\.\d+\.\d+(?:-(?:beta|rc)(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?)?$/
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
|
||||
deploy:i386:
|
||||
<<: *deploy
|
||||
variables:
|
||||
ADDON_ARCH: i386
|
||||
only:
|
||||
- master
|
||||
- /^v\d+\.\d+\.\d+(?:-(?:beta|rc)(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?)?$/
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
|
||||
deploy:amd64:
|
||||
<<: *deploy
|
||||
variables:
|
||||
ADDON_ARCH: amd64
|
||||
only:
|
||||
- master
|
||||
- /^v\d+\.\d+\.\d+(?:-(?:beta|rc)(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?)?$/
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
|
||||
# Publish jobs
|
||||
stable:
|
||||
<<: *publish
|
||||
variables:
|
||||
REPOSITORY: hassio-addons/repository
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?$/
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
environment:
|
||||
name: stable
|
||||
|
||||
beta:
|
||||
<<: *publish
|
||||
variables:
|
||||
REPOSITORY: hassio-addons/repository-beta
|
||||
only:
|
||||
- /^v\d+\.\d+\.\d+(?:-(?:beta|rc)(?:(?:(?:\+|\.)?[a-zA-Z0-9]+)*)?)?$/
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
environment:
|
||||
name: beta
|
||||
|
||||
edge:
|
||||
<<: *publish
|
||||
variables:
|
||||
REPOSITORY: hassio-addons/repository-edge
|
||||
only:
|
||||
- master
|
||||
except:
|
||||
- /^(?!master).+@/
|
||||
environment:
|
||||
name: edge
|
234
README.md
Normal file
234
README.md
Normal file
|
@ -0,0 +1,234 @@
|
|||
# Community Hass.io Add-ons: Node-RED
|
||||
|
||||
[![GitHub Release][releases-shield]][releases]
|
||||
![Project Stage][project-stage-shield]
|
||||
[![License][license-shield]](LICENSE.md)
|
||||
|
||||
[![GitLab CI][gitlabci-shield]][gitlabci]
|
||||
![Project Maintenance][maintenance-shield]
|
||||
[![GitHub Activity][commits-shield]][commits]
|
||||
|
||||
[![Bountysource][bountysource-shield]][bountysource]
|
||||
[![Discord][discord-shield]][discord]
|
||||
[![Community Forum][forum-shield]][forum]
|
||||
|
||||
[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
|
||||
|
||||
Flow-based programming for the Internet of Things.
|
||||
|
||||
## About
|
||||
|
||||
Node-RED is a programming tool for wiring together hardware devices,
|
||||
APIs and online services in new and interesting ways.
|
||||
|
||||
It provides a browser-based editor that makes it easy to wire together flows
|
||||
using the wide range of nodes in the palette that can be deployed to its
|
||||
runtime in a single-click.
|
||||
|
||||
## Installation
|
||||
|
||||
The installation of this add-on is pretty straightforward and not different in
|
||||
comparison to installing any other Hass.io add-on.
|
||||
|
||||
1. [Add our Hass.io add-ons repository][repository] to your Hass.io instance.
|
||||
1. Install the "Node-RED" add-on.
|
||||
1. Start the "Node-RED" add-on.
|
||||
1. Check the logs of "Node-RED" to see if everything went well.
|
||||
|
||||
Please read the rest of this document further instructions.
|
||||
|
||||
**NOTE**: Do not add this repository to Hass.io, please use:
|
||||
`https://github.com/hassio-addons/repository`.
|
||||
|
||||
## Docker status
|
||||
|
||||
[![Docker Architecture][armhf-arch-shield]][armhf-dockerhub]
|
||||
[![Docker Version][armhf-version-shield]][armhf-microbadger]
|
||||
[![Docker Layers][armhf-layers-shield]][armhf-microbadger]
|
||||
[![Docker Pulls][armhf-pulls-shield]][armhf-dockerhub]
|
||||
|
||||
[![Docker Architecture][aarch64-arch-shield]][aarch64-dockerhub]
|
||||
[![Docker Version][aarch64-version-shield]][aarch64-microbadger]
|
||||
[![Docker Layers][aarch64-layers-shield]][aarch64-microbadger]
|
||||
[![Docker Pulls][aarch64-pulls-shield]][aarch64-dockerhub]
|
||||
|
||||
[![Docker Architecture][amd64-arch-shield]][amd64-dockerhub]
|
||||
[![Docker Version][amd64-version-shield]][amd64-microbadger]
|
||||
[![Docker Layers][amd64-layers-shield]][amd64-microbadger]
|
||||
[![Docker Pulls][amd64-pulls-shield]][amd64-dockerhub]
|
||||
|
||||
[![Docker Architecture][i386-arch-shield]][i386-dockerhub]
|
||||
[![Docker Version][i386-version-shield]][i386-microbadger]
|
||||
[![Docker Layers][i386-layers-shield]][i386-microbadger]
|
||||
[![Docker Pulls][i386-pulls-shield]][i386-dockerhub]
|
||||
|
||||
## Configuration
|
||||
|
||||
**Note**: _Remember to restart the add-on when the configuration is changed.
|
||||
|
||||
Example add-on configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"log_level": "info"
|
||||
}
|
||||
```
|
||||
|
||||
**Note**: _This is just an example, don't copy and past it! Create your own!_
|
||||
|
||||
### Option: `log_level`
|
||||
|
||||
The `log_level` option controls the level of log output by the addon and can
|
||||
be changed to be more or less verbose, which might be useful when you are
|
||||
dealing with an unknown issue. Possible values are:
|
||||
|
||||
- `trace`: Show every detail, like all called internal functions.
|
||||
- `debug`: Shows detailed debug information.
|
||||
- `info`: Normal (usually) interesting events.
|
||||
- `warning`: Exceptional occurrences that are not errors.
|
||||
- `error`: Runtime errors that do not require immediate action.
|
||||
- `fatal`: Something went terribly wrong. Add-on becomes unusable.
|
||||
|
||||
Please note that each level automatically includes log messages from a
|
||||
more severe level, e.g., `debug` also shows `info` messages. By default,
|
||||
the `log_level` is set to `info`, which is the recommended setting unless
|
||||
you are troubleshooting.
|
||||
|
||||
## Known issues and limitations
|
||||
|
||||
- Lorem ipsum
|
||||
|
||||
## Changelog & Releases
|
||||
|
||||
This repository keeps a change log using [GitHub's releases][releases]
|
||||
functionality. The format of the log is based on
|
||||
[Keep a Changelog][keepchangelog].
|
||||
|
||||
Releases are based on [Semantic Versioning][semver], and use the format
|
||||
of ``MAJOR.MINOR.PATCH``. In a nutshell, the version will be incremented
|
||||
based on the following:
|
||||
|
||||
- ``MAJOR``: Incompatible or major changes.
|
||||
- ``MINOR``: Backwards-compatible new features and enhancements.
|
||||
- ``PATCH``: Backwards-compatible bugfixes and package updates.
|
||||
|
||||
## Support
|
||||
|
||||
Got questions?
|
||||
|
||||
You have several options to get them answered:
|
||||
|
||||
- The Home Assistant [Community Forum][forum], we have a
|
||||
[dedicated topic][forum] on that forum regarding this add-on.
|
||||
- The Home Assistant [Discord Chat Server][discord] for general Home Assistant
|
||||
discussions and questions.
|
||||
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
|
||||
|
||||
You could also [open an issue here][issue] GitHub.
|
||||
|
||||
## Contributing
|
||||
|
||||
This is an active open-source project. We are always open to people who want to
|
||||
use the code or contribute to it.
|
||||
|
||||
We have set up a separate document containing our
|
||||
[contribution guidelines](CONTRIBUTING.md).
|
||||
|
||||
Thank you for being involved! :heart_eyes:
|
||||
|
||||
## Authors & contributors
|
||||
|
||||
The original setup of this repository is by [Franck Nijhof][frenck].
|
||||
|
||||
For a full list of all authors and contributors,
|
||||
check [the contributor's page][contributors].
|
||||
|
||||
## We have got some Hass.io add-ons for you
|
||||
|
||||
Want some more functionality to your Hass.io Home Assistant instance?
|
||||
|
||||
We have created multiple add-ons for Hass.io. For a full list, check out
|
||||
our [GitHub Repository][repository].
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Franck Nijhof
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
[aarch64-anchore-shield]: https://anchore.io/service/badges/image/e1fe7eff6060158fd4f39bb33fd9cf79cff0d6f15cbbbdb748288c14af47098c
|
||||
[aarch64-anchore]: https://anchore.io/image/dockerhub/hassioaddons%2Fnode-red-aarch64%3Alatest
|
||||
[aarch64-arch-shield]: https://img.shields.io/badge/architecture-aarch64-blue.svg
|
||||
[aarch64-dockerhub]: https://hub.docker.com/r/hassioaddons/node-red-aarch64
|
||||
[aarch64-layers-shield]: https://images.microbadger.com/badges/image/hassioaddons/node-red-aarch64.svg
|
||||
[aarch64-microbadger]: https://microbadger.com/images/hassioaddons/node-red-aarch64
|
||||
[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/node-red-aarch64.svg
|
||||
[aarch64-version-shield]: https://images.microbadger.com/badges/version/hassioaddons/node-red-aarch64.svg
|
||||
[alpine-packages]: https://pkgs.alpinelinux.org/
|
||||
[amd64-anchore-shield]: https://anchore.io/service/badges/image/2b9a78e147678b80fc0e8c63537c669b803f605555d055fba8fe5bd01a5ea60c
|
||||
[amd64-anchore]: https://anchore.io/image/dockerhub/hassioaddons%2Fnode-red-amd64%3Alatest
|
||||
[amd64-arch-shield]: https://img.shields.io/badge/architecture-amd64-blue.svg
|
||||
[amd64-dockerhub]: https://hub.docker.com/r/hassioaddons/node-red-amd64
|
||||
[amd64-layers-shield]: https://images.microbadger.com/badges/image/hassioaddons/node-red-amd64.svg
|
||||
[amd64-microbadger]: https://microbadger.com/images/hassioaddons/node-red-amd64
|
||||
[amd64-pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/node-red-amd64.svg
|
||||
[amd64-version-shield]: https://images.microbadger.com/badges/version/hassioaddons/node-red-amd64.svg
|
||||
[armhf-anchore-shield]: https://anchore.io/service/badges/image/7a31261290489f95ff24e504a87b93d5d852f4f81b403a3de2f55db908e1e782
|
||||
[armhf-anchore]: https://anchore.io/image/dockerhub/hassioaddons%2Fnode-red-armhf%3Alatest
|
||||
[armhf-arch-shield]: https://img.shields.io/badge/architecture-armhf-blue.svg
|
||||
[armhf-dockerhub]: https://hub.docker.com/r/hassioaddons/node-red-armhf
|
||||
[armhf-layers-shield]: https://images.microbadger.com/badges/image/hassioaddons/node-red-armhf.svg
|
||||
[armhf-microbadger]: https://microbadger.com/images/hassioaddons/node-red-armhf
|
||||
[armhf-pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/node-red-armhf.svg
|
||||
[armhf-version-shield]: https://images.microbadger.com/badges/version/hassioaddons/node-red-armhf.svg
|
||||
[bountysource-shield]: https://img.shields.io/bountysource/team/hassio-addons/activity.svg
|
||||
[bountysource]: https://www.bountysource.com/teams/hassio-addons/issues
|
||||
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg
|
||||
[buymeacoffee]: https://www.buymeacoffee.com/frenck
|
||||
[commits-shield]: https://img.shields.io/github/commit-activity/y/hassio-addons/addon-node-red.svg
|
||||
[commits]: https://github.com/hassio-addons/addon-node-red/commits/master
|
||||
[contributors]: https://github.com/hassio-addons/addon-node-red/graphs/contributors
|
||||
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg
|
||||
[discord]: https://discord.gg/c5DvZ4e
|
||||
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
|
||||
[forum]: https://community.home-assistant.io/?u=frenck
|
||||
[frenck]: https://github.com/frenck
|
||||
[gitlabci-shield]: https://gitlab.com/hassio-addons/addon-node-red/badges/master/pipeline.svg
|
||||
[gitlabci]: https://gitlab.com/hassio-addons/addon-node-red/pipelines
|
||||
[home-assistant]: https://home-assistant.io
|
||||
[i386-anchore-shield]: https://anchore.io/service/badges/image/4f3282de1b844e95b246ad7271392feee3bff81abbdbdedc8357f306b705ae75
|
||||
[i386-anchore]: https://anchore.io/image/dockerhub/hassioaddons%2Fnode-red-i386%3Alatest
|
||||
[i386-arch-shield]: https://img.shields.io/badge/architecture-i386-blue.svg
|
||||
[i386-dockerhub]: https://hub.docker.com/r/hassioaddons/node-red-i386
|
||||
[i386-layers-shield]: https://images.microbadger.com/badges/image/hassioaddons/node-red-i386.svg
|
||||
[i386-microbadger]: https://microbadger.com/images/hassioaddons/node-red-i386
|
||||
[i386-pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/node-red-i386.svg
|
||||
[i386-version-shield]: https://images.microbadger.com/badges/version/hassioaddons/node-red-i386.svg
|
||||
[issue]: https://github.com/hassio-addons/addon-node-red/issues
|
||||
[keepchangelog]: http://keepachangelog.com/en/1.0.0/
|
||||
[license-shield]: https://img.shields.io/github/license/hassio-addons/addon-node-red.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2018.svg
|
||||
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
||||
[reddit]: https://reddit.com/r/homeassistant
|
||||
[releases-shield]: https://img.shields.io/github/release/hassio-addons/addon-node-red.svg
|
||||
[releases]: https://github.com/hassio-addons/addon-node-red/releases
|
||||
[repository]: https://github.com/hassio-addons/repository
|
||||
[semver]: http://semver.org/spec/v2.0.0.htm
|
71
node-red/.README.j2
Normal file
71
node-red/.README.j2
Normal file
|
@ -0,0 +1,71 @@
|
|||
# Community Hass.io Add-ons: Example
|
||||
|
||||
[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield]
|
||||
|
||||
[![Discord][discord-shield]][discord] [![Community Forum][forum-shield]][forum]
|
||||
|
||||
[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
|
||||
|
||||
Flow-based programming for the Internet of Things.
|
||||
|
||||
## About
|
||||
|
||||
Node-RED is a programming tool for wiring together hardware devices,
|
||||
APIs and online services in new and interesting ways.
|
||||
|
||||
It provides a browser-based editor that makes it easy to wire together flows
|
||||
using the wide range of nodes in the palette that can be deployed to its
|
||||
runtime in a single-click.
|
||||
|
||||
[Click here for the full documentation][docs]
|
||||
|
||||
{% if channel == "edge" %}
|
||||
## WARNING! THIS IS AN EDGE VERSION!
|
||||
|
||||
This Hass.io Add-ons repository contains edge builds of add-ons. Edge builds
|
||||
add-ons are based upon the latest development version.
|
||||
|
||||
- They may not work at all.
|
||||
- They might stop working at any time.
|
||||
- They could have a negative impact on your system.
|
||||
|
||||
This repository was created for:
|
||||
|
||||
- Anybody willing to test.
|
||||
- Anybody interested in trying out upcoming add-ons or add-on features.
|
||||
- Developers.
|
||||
|
||||
If you are more interested in stable releases of our add-ons:
|
||||
|
||||
<https://github.com/hassio-addons/repository>
|
||||
|
||||
{% endif %}
|
||||
{% if channel == "beta" %}
|
||||
## WARNING! THIS IS A BETA VERSION!
|
||||
|
||||
This Hass.io Add-ons repository contains beta releases of add-ons.
|
||||
|
||||
- They might stop working at any time.
|
||||
- They could have a negative impact on your system.
|
||||
|
||||
This repository was created for:
|
||||
|
||||
- Anybody willing to test.
|
||||
- Anybody interested in trying out upcoming add-ons or add-on features.
|
||||
|
||||
If you are more interested in stable releases of our add-ons:
|
||||
|
||||
<https://github.com/hassio-addons/repository>
|
||||
|
||||
{% endif %}
|
||||
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
||||
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
|
||||
[forum]: https://community.home-assistant.io/t/?u=frenck
|
||||
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg
|
||||
[discord]: https://discord.gg/c5DvZ4e
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2018.svg
|
||||
[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg
|
||||
[release]: {{ repo }}/tree/{{ version }}
|
||||
[docs]: {{ repo }}/blob/{{ version }}/README.md
|
||||
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg
|
||||
[buymeacoffee]: https://www.buymeacoffee.com/frenck
|
60
node-red/Dockerfile
Normal file
60
node-red/Dockerfile
Normal file
|
@ -0,0 +1,60 @@
|
|||
ARG BUILD_FROM=hassioaddons/base-amd64:1.4.1
|
||||
# hadolint ignore=DL3006
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
# Copy Node-RED package.json
|
||||
COPY package.json /opt/
|
||||
|
||||
# Set workdir
|
||||
WORKDIR /opt
|
||||
|
||||
# Setup base
|
||||
RUN \
|
||||
apk add --no-cache \
|
||||
git=2.15.2-r0 \
|
||||
nodejs=8.9.3-r1 \
|
||||
nodejs-npm=8.9.3-r1 \
|
||||
\
|
||||
&& npm install \
|
||||
--no-optional \
|
||||
--only=production \
|
||||
\
|
||||
&& npm -g install \
|
||||
--no-optional \
|
||||
modclean@3.0.0-beta.1 \
|
||||
\
|
||||
&& modclean \
|
||||
--path /opt \
|
||||
--no-progress \
|
||||
--keep-empty \
|
||||
--run \
|
||||
\
|
||||
&& npm -g uninstall modclean \
|
||||
&& npm cache clear --force
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
|
||||
# Build arugments
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_REF
|
||||
ARG BUILD_VERSION
|
||||
|
||||
# Labels
|
||||
LABEL \
|
||||
io.hass.name="Node-RED" \
|
||||
io.hass.description="Flow-based programming for the Internet of Things" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="Franck Nijhof <frenck@addons.community>" \
|
||||
org.label-schema.description="Flow-based programming for the Internet of Things." \
|
||||
org.label-schema.build-date=${BUILD_DATE} \
|
||||
org.label-schema.name="Node-RED" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.url="https://community.home-assistant.io/?u=frenck" \
|
||||
org.label-schema.usage="https://github.com/hassio-addons/addon-node-red/tree/master/README.md" \
|
||||
org.label-schema.vcs-ref=${BUILD_REF} \
|
||||
org.label-schema.vcs-url="https://github.com/hassio-addons/addon-node-red" \
|
||||
org.label-schema.vendor="Community Hass.io Add-ons"
|
10
node-red/build.json
Normal file
10
node-red/build.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"squash": false,
|
||||
"build_from": {
|
||||
"aarch64": "hassioaddons/base-aarch64:1.4.1",
|
||||
"amd64": "hassioaddons/base-amd64:1.4.1",
|
||||
"armhf": "hassioaddons/base-armhf:1.4.1",
|
||||
"i386": "hassioaddons/base-i386:1.4.1"
|
||||
},
|
||||
"args": {}
|
||||
}
|
77
node-red/config.json
Normal file
77
node-red/config.json
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"name": "Node-RED",
|
||||
"version": "dev",
|
||||
"slug": "nodered",
|
||||
"description": "Flow-based programming for the Internet of Things",
|
||||
"url": "https://community.home-assistant.io/?u=frenck",
|
||||
"startup": "application",
|
||||
"arch": [
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"armhf",
|
||||
"i386"
|
||||
],
|
||||
"boot": "auto",
|
||||
"hassio_api": true,
|
||||
"homeassistant_api": true,
|
||||
"host_network": true,
|
||||
"privileged": [],
|
||||
"map": [
|
||||
"config:rw",
|
||||
"ssl"
|
||||
],
|
||||
"options": {
|
||||
"log_level": "info",
|
||||
"port": 1880,
|
||||
"ssl": false,
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem",
|
||||
"require_ssl": true,
|
||||
"users": [
|
||||
{
|
||||
"username": "MarryPoppins",
|
||||
"password": "Supercalifragilisticexpialidocious",
|
||||
"permissions": "*"
|
||||
}
|
||||
],
|
||||
"http_node": {
|
||||
"username": "MarryPoppins",
|
||||
"password": "Supercalifragilisticexpialidocious"
|
||||
},
|
||||
"http_static": {
|
||||
"username": "MarryPoppins",
|
||||
"password": "Supercalifragilisticexpialidocious"
|
||||
},
|
||||
"system_packages": [],
|
||||
"node_packages": [],
|
||||
"init_commands": []
|
||||
},
|
||||
"schema": {
|
||||
"log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)",
|
||||
"port": "port",
|
||||
"ssl": "bool",
|
||||
"certfile": "str",
|
||||
"keyfile": "str",
|
||||
"users": [
|
||||
{
|
||||
"username": "str",
|
||||
"password": "str",
|
||||
"permissions": "str"
|
||||
}
|
||||
],
|
||||
"http_node": {
|
||||
"username": "str",
|
||||
"password": "str"
|
||||
},
|
||||
"http_static": {
|
||||
"username": "str",
|
||||
"password": "str"
|
||||
},
|
||||
"system_packages": ["str"],
|
||||
"npm_packages": ["str"],
|
||||
"init_commands": ["str"]
|
||||
},
|
||||
"environment": {
|
||||
"LOG_FORMAT": "{LEVEL}: {MESSAGE}"
|
||||
}
|
||||
}
|
BIN
node-red/icon.png
Normal file
BIN
node-red/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
node-red/logo.png
Normal file
BIN
node-red/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
48
node-red/package.json
Normal file
48
node-red/package.json
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "hassio-addon-node-red",
|
||||
"version": "1.0.0",
|
||||
"description": "A visual tool for wiring the Internet of Things",
|
||||
"homepage": "https://addons.community",
|
||||
"license": "MIT",
|
||||
"main": "node_modules/node-red/red/red.js",
|
||||
"scripts": {
|
||||
"start": "node $NODE_OPTIONS node_modules/node-red/red.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcryptjs": "2.4.3",
|
||||
"node-red": "0.18.7",
|
||||
"node-red-admin": "0.1.3",
|
||||
"node-red-contrib-actionflows": "2.0.0",
|
||||
"node-red-contrib-alexa-home-skill": "0.1.17",
|
||||
"node-red-contrib-bigtimer": "1.9.1",
|
||||
"node-red-contrib-change-detect": "0.2.0",
|
||||
"node-red-contrib-counter": "0.1.5",
|
||||
"node-red-contrib-google-home-notify": "0.0.6",
|
||||
"node-red-contrib-home-assistant": "0.3.2",
|
||||
"node-red-contrib-http-request": "0.1.13",
|
||||
"node-red-contrib-influxdb": "0.2.1",
|
||||
"node-red-contrib-interval-length": "0.0.2",
|
||||
"node-red-contrib-join": "0.9.0",
|
||||
"node-red-contrib-looptimer": "0.0.8",
|
||||
"node-red-contrib-moment": "2.0.7",
|
||||
"node-red-contrib-state-machine": "1.2.0",
|
||||
"node-red-contrib-statistics": "2.2.2",
|
||||
"node-red-contrib-stoptimer": "0.0.7",
|
||||
"node-red-contrib-sunevents": "0.0.5",
|
||||
"node-red-contrib-time-range-switch": "0.5.1",
|
||||
"node-red-contrib-timecheck": "1.1.0",
|
||||
"node-red-contrib-traffic": "0.2.1",
|
||||
"node-red-contrib-web-worldmap": "1.1.13",
|
||||
"node-red-dashboard": "2.9.4",
|
||||
"node-red-node-base64": "0.1.3",
|
||||
"node-red-node-geofence": "0.1.0",
|
||||
"node-red-node-msgpack": "1.1.3",
|
||||
"node-red-node-ping": "0.0.15",
|
||||
"node-red-node-random": "0.1.0",
|
||||
"node-red-node-smooth": "0.1.0",
|
||||
"node-red-node-suncalc": "0.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.*.*"
|
||||
}
|
||||
}
|
26
node-red/rootfs/etc/cont-init.d/10-requirements.sh
Normal file
26
node-red/rootfs/etc/cont-init.d/10-requirements.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# This files check if all user configuration requirements are met
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
# Check SSL requirements, if enabled
|
||||
if hass.config.true 'ssl'; then
|
||||
if ! hass.config.has_value 'certfile'; then
|
||||
hass.die 'SSL is enabled, but no certfile was specified'
|
||||
fi
|
||||
|
||||
if ! hass.config.has_value 'keyfile'; then
|
||||
hass.die 'SSL is enabled, but no keyfile was specified'
|
||||
fi
|
||||
|
||||
if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then
|
||||
hass.die 'The configured certfile is not found'
|
||||
fi
|
||||
|
||||
if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then
|
||||
hass.die 'The configured keyfile is not found'
|
||||
fi
|
||||
fi
|
24
node-red/rootfs/etc/cont-init.d/20-config.sh
Normal file
24
node-red/rootfs/etc/cont-init.d/20-config.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# Ensures the configuration for the user exists
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
# Ensure configuration exists
|
||||
if ! hass.directory_exists '/config/node-red/'; then
|
||||
mkdir -p /config/node-red/nodes \
|
||||
|| hass.die "Failed to create node-red configuration directory"
|
||||
|
||||
# Copy in template files
|
||||
cp /etc/node-red/flows.json /config/node-red/
|
||||
cp /etc/node-red/settings.js /config/node-red/
|
||||
|
||||
# Create random flow id
|
||||
id=$(node -e "console.log((1+Math.random()*4294967295).toString(16));")
|
||||
sed -i "s/%%ID%%/${id}/" "/config/node-red/flows.json"
|
||||
|
||||
# Set hass.io token on created flow file
|
||||
sed -i "s/%%TOKEN%%/${HASSIO_TOKEN}/" "/config/node-red/flows.json"
|
||||
fi
|
17
node-red/rootfs/etc/cont-init.d/80-system-packages.sh
Normal file
17
node-red/rootfs/etc/cont-init.d/80-system-packages.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# Install user configured/requested packages
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
if hass.config.has_value 'system_packages'; then
|
||||
apk update \
|
||||
|| hass.die 'Failed updating Alpine packages repository indexes'
|
||||
|
||||
for package in $(hass.config.get 'system_packages'); do
|
||||
apk add "$package" \
|
||||
|| hass.die "Failed installing system package ${package}"
|
||||
done
|
||||
fi
|
17
node-red/rootfs/etc/cont-init.d/81-npm-packages.sh
Normal file
17
node-red/rootfs/etc/cont-init.d/81-npm-packages.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# Install user configured/requested packages
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
if hass.config.has_value 'npm_packages'; then
|
||||
apk update \
|
||||
|| hass.die 'Failed updating Alpine packages repository indexes'
|
||||
|
||||
for package in $(hass.config.get 'npm_packages'); do
|
||||
npm install "$package" \
|
||||
|| hass.die "Failed installing npm package ${package}"
|
||||
done
|
||||
fi
|
14
node-red/rootfs/etc/cont-init.d/82-user-scripts.sh
Normal file
14
node-red/rootfs/etc/cont-init.d/82-user-scripts.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# Executes user configured/requested commands on startup
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
if hass.config.has_value 'init_commands'; then
|
||||
while read -r cmd; do
|
||||
eval "${cmd}" \
|
||||
|| hass.die "Failed executing init command: ${cmd}"
|
||||
done <<< "$(hass.config.get 'init_commands')"
|
||||
fi
|
64
node-red/rootfs/etc/node-red/config.js
Normal file
64
node-red/rootfs/etc/node-red/config.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
const config = require('/config/node-red/settings.js');
|
||||
const fs = require('fs');
|
||||
const options = JSON.parse(fs.readFileSync('/data/options.json', 'utf8'));
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
// Sane and required defaults for the add-on
|
||||
config.uiHost = '0.0.0.0';
|
||||
config.debugUseColors = false;
|
||||
config.flowFile = 'flows.json';
|
||||
config.userDir = '/config/node-red/';
|
||||
config.nodesDir = '/config/node-red/nodes';
|
||||
|
||||
// Several settings
|
||||
config.uiPort = options.port;
|
||||
config.credentialSecret = options.credential_secret;
|
||||
|
||||
// Set SSL if enabled
|
||||
if (options.ssl === true) {
|
||||
config.https = {
|
||||
key: `/ssl/${options.keyfile}`,
|
||||
cert: `/ssl/${options.certfile}`,
|
||||
};
|
||||
config.requireHttps = options.require_ssl;
|
||||
}
|
||||
|
||||
// Create admin users
|
||||
if (options.users.length !== 0) {
|
||||
config.adminAuth = {
|
||||
type: "credentials",
|
||||
users: [],
|
||||
};
|
||||
|
||||
options.users.forEach((user, index) => {
|
||||
config.adminAuth.users.push({
|
||||
username: user.username,
|
||||
password: bcrypt.hashSync(user.password),
|
||||
permissions: user.permissions,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Secure HTTP node
|
||||
if (options.http_node.username) {
|
||||
config.httpNodeAuth = {
|
||||
user: options.http_node.username,
|
||||
pass: bcrypt.hashSync(options.http_node.password),
|
||||
};
|
||||
}
|
||||
|
||||
// Secure static HTTP
|
||||
if (options.http_static.username) {
|
||||
config.httpStaticAuth = {
|
||||
user: options.http_static.username,
|
||||
pass: bcrypt.hashSync(options.http_static.password),
|
||||
}
|
||||
}
|
||||
|
||||
// Set debug level
|
||||
config.logging.console.level = options.log_level.toLowerCase();
|
||||
if (config.logging.console.level === 'warning') {
|
||||
config.logging.console.level = 'warn';
|
||||
}
|
||||
|
||||
module.exports = config;
|
1
node-red/rootfs/etc/node-red/flows.json
Normal file
1
node-red/rootfs/etc/node-red/flows.json
Normal file
|
@ -0,0 +1 @@
|
|||
[{"id":"%%ID%%","type":"server","z":"","name":"Home Assistant","url":"http://hassio/homeassistant","pass":"%%TOKEN%%"}]
|
201
node-red/rootfs/etc/node-red/settings.js
Normal file
201
node-red/rootfs/etc/node-red/settings.js
Normal file
|
@ -0,0 +1,201 @@
|
|||
/**
|
||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* PLEASE NOTE! IMPORTANT! READ!
|
||||
*
|
||||
* This is a modified version of the settings file. Some parts of the
|
||||
* settings are actually controlled by the Hass.io add-on.
|
||||
*
|
||||
* Parts that are handled by it, are removed from this settings template.
|
||||
* The following configuration keys are controlled by the add-on and removed.
|
||||
*
|
||||
* - uiPort (port setting in the add-on log)
|
||||
* - uiHost (no need to manually configure this in the add-on)
|
||||
* - debugUseColors (disabled, won't work in the add-on)
|
||||
* - flowFile (fixed to flows.json)
|
||||
* - credentialSecret (credentials_secret in the add-on configuration)
|
||||
* - userDir (is set fixed to `/config/node-red`)
|
||||
* - nodesDir (is set fixed to `/config/node-red/nodes`)
|
||||
* - adminAuth (known as users in the add-on configuration)
|
||||
* - https (ssl settings in the add-on configuration)
|
||||
* - logging.console.level (log_level in the add-on configuration)
|
||||
* - httpNodeAuth (http_node settings in the add-on configuration)
|
||||
* - httpStaticAuth (http_static settings in the add-on configuration)
|
||||
* - requireHttps (require_ssl setting in the add-on configuration)
|
||||
*
|
||||
* If you like to change those settings, some are available via the add-on
|
||||
* settings/option in the Hass.io panel in Home Assistant.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
// Retry time in milliseconds for MQTT connections
|
||||
mqttReconnectTime: 15000,
|
||||
|
||||
// Retry time in milliseconds for Serial port connections
|
||||
serialReconnectTime: 15000,
|
||||
|
||||
// Retry time in milliseconds for TCP socket connections
|
||||
//socketReconnectTime: 10000,
|
||||
|
||||
// Timeout in milliseconds for TCP server socket connections
|
||||
// defaults to no timeout
|
||||
//socketTimeout: 120000,
|
||||
|
||||
// Timeout in milliseconds for HTTP request connections
|
||||
// defaults to 120 seconds
|
||||
//httpRequestTimeout: 120000,
|
||||
|
||||
// The maximum length, in characters, of any message sent to the debug sidebar tab
|
||||
debugMaxLength: 1000,
|
||||
|
||||
// The maximum number of messages nodes will buffer internally as part of their
|
||||
// operation. This applies across a range of nodes that operate on message sequences.
|
||||
// defaults to no limit. A value of 0 also means no limit is applied.
|
||||
//nodeMaxMessageBufferLength: 0,
|
||||
|
||||
// To disable the option for using local files for storing keys and certificates in the TLS configuration
|
||||
// node, set this to true
|
||||
//tlsConfigDisableLocalFiles: true,
|
||||
|
||||
// By default, the Node-RED UI is available at http://localhost:1880/
|
||||
// The following property can be used to specify a different root path.
|
||||
// If set to false, this is disabled.
|
||||
//httpAdminRoot: '/admin',
|
||||
|
||||
// Some nodes, such as HTTP In, can be used to listen for incoming http requests.
|
||||
// By default, these are served relative to '/'. The following property
|
||||
// can be used to specifiy a different root path. If set to false, this is
|
||||
// disabled.
|
||||
//httpNodeRoot: '/red-nodes',
|
||||
|
||||
// The following property can be used in place of 'httpAdminRoot' and 'httpNodeRoot',
|
||||
// to apply the same root to both parts.
|
||||
//httpRoot: '/red',
|
||||
|
||||
// When httpAdminRoot is used to move the UI to a different root path, the
|
||||
// following property can be used to identify a directory of static content
|
||||
// that should be served at http://localhost:1880/.
|
||||
//httpStatic: '/home/nol/node-red-static/',
|
||||
|
||||
// The maximum size of HTTP request that will be accepted by the runtime api.
|
||||
// Default: 5mb
|
||||
//apiMaxLength: '5mb',
|
||||
|
||||
// If you installed the optional node-red-dashboard you can set it's path
|
||||
// relative to httpRoot
|
||||
//ui: { path: "ui" },
|
||||
|
||||
// The following property can be used to disable the editor. The admin API
|
||||
// is not affected by this option. To disable both the editor and the admin
|
||||
// API, use either the httpRoot or httpAdminRoot properties
|
||||
//disableEditor: false,
|
||||
|
||||
// The following property can be used to configure cross-origin resource sharing
|
||||
// in the HTTP nodes.
|
||||
// See https://github.com/troygoode/node-cors#configuration-options for
|
||||
// details on its contents. The following is a basic permissive set of options:
|
||||
//httpNodeCors: {
|
||||
// origin: "*",
|
||||
// methods: "GET,PUT,POST,DELETE"
|
||||
//},
|
||||
|
||||
// If you need to set an http proxy please set an environment variable
|
||||
// called http_proxy (or HTTP_PROXY) outside of Node-RED in the operating system.
|
||||
// For example - http_proxy=http://myproxy.com:8080
|
||||
// (Setting it here will have no effect)
|
||||
// You may also specify no_proxy (or NO_PROXY) to supply a comma separated
|
||||
// list of domains to not proxy, eg - no_proxy=.acme.co,.acme.co.uk
|
||||
|
||||
// The following property can be used to add a custom middleware function
|
||||
// in front of all http in nodes. This allows custom authentication to be
|
||||
// applied to all http in nodes, or any other sort of common request processing.
|
||||
//httpNodeMiddleware: function(req,res,next) {
|
||||
// // Handle/reject the request, or pass it on to the http in node by calling next();
|
||||
// // Optionally skip our rawBodyParser by setting this to true;
|
||||
// //req.skipRawBodyParser = true;
|
||||
// next();
|
||||
//},
|
||||
|
||||
// The following property can be used to verify websocket connection attempts.
|
||||
// This allows, for example, the HTTP request headers to be checked to ensure
|
||||
// they include valid authentication information.
|
||||
//webSocketNodeVerifyClient: function(info) {
|
||||
// // 'info' has three properties:
|
||||
// // - origin : the value in the Origin header
|
||||
// // - req : the HTTP request
|
||||
// // - secure : true if req.connection.authorized or req.connection.encrypted is set
|
||||
// //
|
||||
// // The function should return true if the connection should be accepted, false otherwise.
|
||||
// //
|
||||
// // Alternatively, if this function is defined to accept a second argument, callback,
|
||||
// // it can be used to verify the client asynchronously.
|
||||
// // The callback takes three arguments:
|
||||
// // - result : boolean, whether to accept the connection or not
|
||||
// // - code : if result is false, the HTTP error status to return
|
||||
// // - reason: if result is false, the HTTP reason string to return
|
||||
//},
|
||||
|
||||
// Anything in this hash is globally available to all functions.
|
||||
// It is accessed as context.global.
|
||||
// eg:
|
||||
// functionGlobalContext: { os:require('os') }
|
||||
// can be accessed in a function block as:
|
||||
// context.global.os
|
||||
|
||||
functionGlobalContext: {
|
||||
// os:require('os'),
|
||||
// jfive:require("johnny-five"),
|
||||
// j5board:require("johnny-five").Board({repl:false})
|
||||
},
|
||||
|
||||
// The following property can be used to order the categories in the editor
|
||||
// palette. If a node's category is not in the list, the category will get
|
||||
// added to the end of the palette.
|
||||
// If not set, the following default order is used:
|
||||
paletteCategories: [
|
||||
'home_assistant',
|
||||
'subflows',
|
||||
'input',
|
||||
'output',
|
||||
'function',
|
||||
'social',
|
||||
'mobile',
|
||||
'storage',
|
||||
'analysis',
|
||||
'advanced'
|
||||
],
|
||||
|
||||
// Configure the logging output
|
||||
logging: {
|
||||
// Only console logging is currently supported
|
||||
console: {
|
||||
// Whether or not to include metric events in the log output
|
||||
metrics: false,
|
||||
// Whether or not to include audit events in the log output
|
||||
audit: false
|
||||
}
|
||||
},
|
||||
|
||||
// Customising the editor
|
||||
editorTheme: {
|
||||
projects: {
|
||||
// To disable the Projects feature, set this value to false
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
}
|
9
node-red/rootfs/etc/services.d/nodered/finish
Normal file
9
node-red/rootfs/etc/services.d/nodered/finish
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# Take down the S6 supervision tree when Node-RED fails
|
||||
# ==============================================================================
|
||||
if -n { s6-test $# -ne 0 }
|
||||
if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
16
node-red/rootfs/etc/services.d/nodered/run
Normal file
16
node-red/rootfs/etc/services.d/nodered/run
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Node-RED
|
||||
# Starts Node-RED
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
export NODE_PATH=/opt/node_modules:/data/node_modules
|
||||
declare -a options
|
||||
|
||||
options+=(--settings "/etc/node-red/config.js")
|
||||
|
||||
cd /opt || hass.die "Could not change directory to Node-RED"
|
||||
|
||||
exec npm start -- "${options[@]}"
|
Loading…
Add table
Add a link
Reference in a new issue