diff --git a/.VERSION b/.VERSION index 97a50b0..d4b18a1 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v4.0.2beta +v4.0.3beta diff --git a/README.md b/README.md index febfbff..395ba37 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ Feel free to ask for more architectures by opening an github-issue. The new v4 comes again with a new major node-version (node10)! If you are updating an existing Installation you have to perform some additional steps inside ioBroker! -After upgrading your iobroker-container you have to call "reinstall.sh" for recompileing your installation for the use with node10! -For Details see official ioBroker-documentation (http://www.iobroker.net/docu/?page_id=8323&lang=de). Make backup first! +After upgrading your iobroker-container you have to call "npm rebuild" or "reinstall.sh" (when js-controller > v1.5 "reinstall.js") for recompileing your installation for the use with node10! +For Details see official ioBroker-documentation: [EN](https://www.iobroker.net/#en/documentation/install/updatenode.md) | [DE](https://www.iobroker.net/#de/documentation/install/updatenode.md). Make backup first! ## Installation & usage @@ -38,7 +38,7 @@ Since v3 is possible to set some environment variables to configure a new contai |AVAHI|false|Installs and activates avahi-daemon for supporting yahka-adapter, can be "true" or "false"| |LANG|de_DE.UTF‑8|The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8| |LANGUAGE|de_DE:de|The following locales are pre-generated: de_DE:de, en_US:en| -|LC_ALL|de_DE|The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8| +|LC_ALL|de_DE.UTF-8|The following locales are pre-generated: de_DE.UTF-8, en_US.UTF-8| |PACKAGES|vi|Installs additional packages to your container, needed by some adapters, packages should be seperated by whitespace like "package1 package2 package3"| |REDIS|false|Activates redis as states-db on startup, fill with "hostname:port" to set redis connection otherwise use "false"(beta)| |SETGID|1000|For security reasons it might be useful to specify the gid of the containers iobroker user to match an existing group on the docker host| @@ -49,11 +49,13 @@ Since v3 is possible to set some environment variables to configure a new contai ### Mounting Folder/ Volume -It is now possible to mount an empty folder to /opt/iobroker during first startup of the container. The Startupscript will check this folder and restore content if it is empty. +It is possible to mount an empty folder to /opt/iobroker during first startup of the container. The Startupscript will check this folder and restore content if it is empty. +In actual beta (v4.0.3beta) it is also possible mount a folder with an iobroker backup (created with backitup-adapter) named like this: "iobroker_2020_01_06-01_09_10_backupiobroker.tar.gz". +The startup script will then detect this backup and restore it during the start of the container. Plese see logs when starting the container for more details. It is absolutely recommended to use a mounted folder or persistent volume for /opt/iobroker folder! -This also works with mounting a folder containing an existing ioBroker-installation (e.g. when moving an existing installation to docker). +You can also mount a folder containing an existing ioBroker-installation (e.g. when moving an existing installation to docker). ### Permission Fixer @@ -61,9 +63,12 @@ After some issues with permissions related to the use of a dedicated user for io ## Changelog -### v4.0.2beta (2019-12-10) -* added env for activating redis -* enhancements in startupscript and dockerfile +### v4.0.3beta (2020-01-06) +* added support to restore backup on startup +* small fixes according to "docker best practices" +* v4.0.2beta (2019-12-10) + * added env for activating redis + * enhancements in startupscript and dockerfile * v4.0.1beta (2019-11-25) * added env for iobroker admin port * added env for usb-devices (setting permissions) diff --git a/aarch64/Dockerfile b/aarch64/Dockerfile index 8dc774e..a8cde0f 100644 --- a/aarch64/Dockerfile +++ b/aarch64/Dockerfile @@ -1,11 +1,12 @@ FROM balenalib/aarch64-debian:stretch -MAINTAINER Andre Germann +LABEL maintainer="Andre Germann" \ + url="" ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (as listed in iobroker installer.sh) -RUN apt-get update && apt-get upgrade -y && apt-get install -y \ +RUN apt-get update && apt-get install -y \ acl \ apt-utils \ build-essential \ diff --git a/aarch64/scripts/iobroker_startup.sh b/aarch64/scripts/iobroker_startup.sh index 9805355..5653468 100644 --- a/aarch64/scripts/iobroker_startup.sh +++ b/aarch64/scripts/iobroker_startup.sh @@ -100,20 +100,36 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "$(printf -- '-%.0s' {1..60})" echo ' ' -if [ `ls -1a|wc -l` -lt 3 ] +if [ `find /opt/iobroker -type f | wc -l` -lt 1 ] then echo "There is no data detected in /opt/iobroker. Restoring initial ioBroker installation..." tar -xf /opt/initial_iobroker.tar -C / echo "Done." +elif [ -f /opt/iobroker/iobroker ] +then + echo "Existing installation of ioBroker detected in /opt/iobroker." +elif [ $(ls iobroker_20* 2> /dev/null | wc -l) != "0" ] && [ $(tar -ztvf /opt/iobroker/iobroker_20*.tar.gz "backup/backup.json" 2> /dev/null | wc -l) != "0" ] +then + echo "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + mv /opt/*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 + echo "Done." + echo ' ' + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!!! IMPORTANT NOTE !!!!!" + echo "!!!!! The sartup script restored iobroker from a backup file. !!!!!" + echo "!!!!! Check /opt/iobroker/log/restore.log to see if restore was successful. !!!!!" + echo "!!!!! When ioBroker now starts it will reinstall all Adapters automatically. !!!!!" + echo "!!!!! This might be take a looooong time! Please be patient! !!!!!" + echo "!!!!! You can view installation process by taking a look at ioBroker log. !!!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" else - if [ -f /opt/iobroker/iobroker ] - then - echo "Existing installation of ioBroker detected in /opt/iobroker." - else - echo "There is data detected in /opt/iobroker, but it looks like it is no instance of iobroker!" - echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." - exit 1 - fi + echo "There is data detected in /opt/iobroker but it looks like it is no instance of iobroker or a valid backup file!" + echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." + exit 1 fi echo ' ' diff --git a/amd64/Dockerfile b/amd64/Dockerfile index 1da5a9f..43dd2fe 100644 --- a/amd64/Dockerfile +++ b/amd64/Dockerfile @@ -1,11 +1,12 @@ FROM debian:stretch -MAINTAINER Andre Germann +LABEL maintainer="Andre Germann" \ + url="" ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (as listed in iobroker installer.sh) -RUN apt-get update && apt-get upgrade -y && apt-get install -y \ +RUN apt-get update && apt-get install -y \ acl \ apt-utils \ build-essential \ diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 9805355..5653468 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -100,20 +100,36 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "$(printf -- '-%.0s' {1..60})" echo ' ' -if [ `ls -1a|wc -l` -lt 3 ] +if [ `find /opt/iobroker -type f | wc -l` -lt 1 ] then echo "There is no data detected in /opt/iobroker. Restoring initial ioBroker installation..." tar -xf /opt/initial_iobroker.tar -C / echo "Done." +elif [ -f /opt/iobroker/iobroker ] +then + echo "Existing installation of ioBroker detected in /opt/iobroker." +elif [ $(ls iobroker_20* 2> /dev/null | wc -l) != "0" ] && [ $(tar -ztvf /opt/iobroker/iobroker_20*.tar.gz "backup/backup.json" 2> /dev/null | wc -l) != "0" ] +then + echo "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + mv /opt/*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 + echo "Done." + echo ' ' + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!!! IMPORTANT NOTE !!!!!" + echo "!!!!! The sartup script restored iobroker from a backup file. !!!!!" + echo "!!!!! Check /opt/iobroker/log/restore.log to see if restore was successful. !!!!!" + echo "!!!!! When ioBroker now starts it will reinstall all Adapters automatically. !!!!!" + echo "!!!!! This might be take a looooong time! Please be patient! !!!!!" + echo "!!!!! You can view installation process by taking a look at ioBroker log. !!!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" else - if [ -f /opt/iobroker/iobroker ] - then - echo "Existing installation of ioBroker detected in /opt/iobroker." - else - echo "There is data detected in /opt/iobroker, but it looks like it is no instance of iobroker!" - echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." - exit 1 - fi + echo "There is data detected in /opt/iobroker but it looks like it is no instance of iobroker or a valid backup file!" + echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." + exit 1 fi echo ' ' diff --git a/armv7hf/Dockerfile b/armv7hf/Dockerfile index 83e3f4a..3a159a9 100644 --- a/armv7hf/Dockerfile +++ b/armv7hf/Dockerfile @@ -1,11 +1,12 @@ FROM balenalib/armv7hf-debian:stretch -MAINTAINER Andre Germann - +LABEL maintainer="Andre Germann" \ + url="" + ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (as listed in iobroker installer.sh) -RUN apt-get update && apt-get upgrade -y && apt-get install -y \ +RUN apt-get update && apt-get install -y \ acl \ apt-utils \ build-essential \ diff --git a/armv7hf/scripts/iobroker_startup.sh b/armv7hf/scripts/iobroker_startup.sh index 9805355..5653468 100644 --- a/armv7hf/scripts/iobroker_startup.sh +++ b/armv7hf/scripts/iobroker_startup.sh @@ -100,20 +100,36 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "$(printf -- '-%.0s' {1..60})" echo ' ' -if [ `ls -1a|wc -l` -lt 3 ] +if [ `find /opt/iobroker -type f | wc -l` -lt 1 ] then echo "There is no data detected in /opt/iobroker. Restoring initial ioBroker installation..." tar -xf /opt/initial_iobroker.tar -C / echo "Done." +elif [ -f /opt/iobroker/iobroker ] +then + echo "Existing installation of ioBroker detected in /opt/iobroker." +elif [ $(ls iobroker_20* 2> /dev/null | wc -l) != "0" ] && [ $(tar -ztvf /opt/iobroker/iobroker_20*.tar.gz "backup/backup.json" 2> /dev/null | wc -l) != "0" ] +then + echo "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + mv /opt/*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 + echo "Done." + echo ' ' + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!!! IMPORTANT NOTE !!!!!" + echo "!!!!! The sartup script restored iobroker from a backup file. !!!!!" + echo "!!!!! Check /opt/iobroker/log/restore.log to see if restore was successful. !!!!!" + echo "!!!!! When ioBroker now starts it will reinstall all Adapters automatically. !!!!!" + echo "!!!!! This might be take a looooong time! Please be patient! !!!!!" + echo "!!!!! You can view installation process by taking a look at ioBroker log. !!!!!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" else - if [ -f /opt/iobroker/iobroker ] - then - echo "Existing installation of ioBroker detected in /opt/iobroker." - else - echo "There is data detected in /opt/iobroker, but it looks like it is no instance of iobroker!" - echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." - exit 1 - fi + echo "There is data detected in /opt/iobroker but it looks like it is no instance of iobroker or a valid backup file!" + echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." + exit 1 fi echo ' '