Skip to content

Commit

Permalink
Added option to fix permissions and update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinschumacher committed Dec 21, 2020
1 parent 74d7366 commit 93b3333
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
21 changes: 16 additions & 5 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -163,6 +169,7 @@ exit 1
echo '⚠️ Updating failed. Please check the repository on GitHub.'
fi
start
fix_permissions
}

check_dependencies
Expand All @@ -177,6 +184,9 @@ case "$1" in
"update")
update
;;
"fix")
fix_permissions
;;
"data")
build_data_structure
;;
Expand All @@ -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.
Expand Down

0 comments on commit 93b3333

Please sign in to comment.