From 93b33334bafef09b7346a9ea3553bcd8ce452020 Mon Sep 17 00:00:00 2001 From: Merlin Schumacher Date: Mon, 21 Dec 2020 19:25:36 +0100 Subject: [PATCH] Added option to fix permissions and update Readme --- README.md | 5 +++++ start.sh | 21 ++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7343e6f..d7df9ba 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Additionally you should run c't-Smart-Home behind a reverse proxy like [Traefik] ————————————————————————————— Usage: start.sh update – to update this copy of the repo +start.sh fix – correct the permissions in the data folder start.sh start – run all containers start.sh stop – stop all containers start.sh data – set up the data folder needed for the containers, but run none of them. Useful for personalized setups. @@ -134,6 +135,10 @@ You could try, but we don't support it on a Mac. We probably removed some unnecessary or outdated nodes. Check which are missing and look in the palette for them. Most likely you can reinstall them from there. +### Node-RED won't start after an update. The logs show permission errors. How do I fix this? + +For security reasons the Node-RED service won't run as root anymore. It now runs with the GID and UID 1000. To fix this issue you must set the GID and UID of data/nodered and all of its content to 1000. You can use `start.sh fix` to correct those issues. + ## Container images and Versions The Node-RED container image is a variation on [the official one](https://hub.docker.com/r/nodered/node-red) provided by the Node-RED project. We provide versions based on Node.js versions 10 (Maintenance LTS), 12 (Maintenance LTS) and 14 (Active LTS). See Node.js [releases page](https://nodejs.org/en/about/releases/) for support cycles. The container image based on Active LTS will always be the default. You can freely modify your copy of the compose file to use a different container image or even create your own image. diff --git a/start.sh b/start.sh index 99bbe2a..9ca4adf 100755 --- a/start.sh +++ b/start.sh @@ -74,6 +74,15 @@ echo '⚠️ Disable permit_join in data/zigbee/configuration.yaml or the Zigbe } +function fix_permissions { + echo '📄 Setting the permissions of the configurations in the data folder.' + sudo chown 1883:1883 data/mqtt + sudo chown -Rf 1883:1883 data/mqtt/* + sudo chown 1000:1000 data/nodered + sudo chown -Rf 1000:1000 data/nodered/* +} + + function build_data_structure { echo '📄 Configuration folder ./data is missing. Creating it from scratch.' mkdir -p data/mqtt/config @@ -88,10 +97,7 @@ function build_data_structure { create_zigbee2mqtt_config fi - sudo chown 1883:1883 data/mqtt - sudo chown -R 1883:1883 data/mqtt/* - sudo chown 1000:1000 data/nodered - sudo chown -Rf 1000:1000 data/nodered/* + fix_permissions } function check_dependencies { @@ -143,7 +149,7 @@ Then copy the current version from GitHub to this folder and run ./start.sh start. Alternatively create a Git clone of the repository." -exit 1 + exit 1 fi echo '☠️ Shutting down all running containers and removing them.' docker-compose down --remove-orphans @@ -163,6 +169,7 @@ exit 1 echo '⚠️ Updating failed. Please check the repository on GitHub.' fi start + fix_permissions } check_dependencies @@ -177,6 +184,9 @@ case "$1" in "update") update ;; + "fix") + fix_permissions + ;; "data") build_data_structure ;; @@ -186,6 +196,7 @@ case "$1" in ————————————————————————————— Usage: start.sh update – update to the latest release version +start.sh fix – correct the permissions in the data folder start.sh start – run all containers start.sh stop – stop all containers start.sh data – set up the data folder needed for the containers, but run none of them. Useful for personalized setups.