From 84c31002f45817f30ff74af97150e6af2b996b2b Mon Sep 17 00:00:00 2001 From: duffbeer2000 Date: Fri, 27 Dec 2019 14:23:58 +0100 Subject: [PATCH 01/13] Update README.md Correct the default value of LC_ALL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index febfbff..0fd2c8a 100644 --- a/README.md +++ b/README.md @@ -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| From 1492a15871ba1314096db10e69b5d702dfb8bcff Mon Sep 17 00:00:00 2001 From: duffbeer2000 Date: Fri, 27 Dec 2019 14:40:26 +0100 Subject: [PATCH 02/13] Include automatic restore to iobroker_startup.sh Integration of automatic restore of an iobroker backup file. It detects if /opt/iobroker contains a single file and if so if it contains a "backup.json" and restores it. --- aarch64/scripts/iobroker_startup.sh | 24 +++++++++++++++++++++--- amd64/scripts/iobroker_startup.sh | 24 +++++++++++++++++++++--- armv7hf/scripts/iobroker_startup.sh | 24 +++++++++++++++++++++--- 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/aarch64/scripts/iobroker_startup.sh b/aarch64/scripts/iobroker_startup.sh index 9805355..359f110 100644 --- a/aarch64/scripts/iobroker_startup.sh +++ b/aarch64/scripts/iobroker_startup.sh @@ -110,9 +110,27 @@ else 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 + files=(/opt/iobroker/*) + if [ ${#files[@]} -lt 2 ]; then + if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null; then + echo "ioBroker Backup detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/iobroker_20*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + rm -r /opt/iobroker/backups/* + mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 + echo "Done." + else + 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 + 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 fi fi echo ' ' diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 9805355..359f110 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -110,9 +110,27 @@ else 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 + files=(/opt/iobroker/*) + if [ ${#files[@]} -lt 2 ]; then + if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null; then + echo "ioBroker Backup detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/iobroker_20*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + rm -r /opt/iobroker/backups/* + mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 + echo "Done." + else + 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 + 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 fi fi echo ' ' diff --git a/armv7hf/scripts/iobroker_startup.sh b/armv7hf/scripts/iobroker_startup.sh index 9805355..359f110 100644 --- a/armv7hf/scripts/iobroker_startup.sh +++ b/armv7hf/scripts/iobroker_startup.sh @@ -110,9 +110,27 @@ else 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 + files=(/opt/iobroker/*) + if [ ${#files[@]} -lt 2 ]; then + if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null; then + echo "ioBroker Backup detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/iobroker_20*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + rm -r /opt/iobroker/backups/* + mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 + echo "Done." + else + 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 + 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 fi fi echo ' ' From 0c1f8ed867d202eb55f0966f8b5deb7a9bc74ea2 Mon Sep 17 00:00:00 2001 From: duffbeer2000 Date: Fri, 27 Dec 2019 15:01:53 +0100 Subject: [PATCH 03/13] MAINTAINER is deprecated, switch to LABEL instead As https://docs.docker.com/engine/reference/builder/ says MAINTAINER instruction is deprecated. Switching to LABEL instruction. --- aarch64/Dockerfile | 3 ++- amd64/Dockerfile | 3 ++- armv7hf/Dockerfile | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/aarch64/Dockerfile b/aarch64/Dockerfile index 8dc774e..abd1720 100644 --- a/aarch64/Dockerfile +++ b/aarch64/Dockerfile @@ -1,6 +1,7 @@ FROM balenalib/aarch64-debian:stretch -MAINTAINER Andre Germann +LABEL maintainer="Andre Germann" \ + url="" ENV DEBIAN_FRONTEND noninteractive diff --git a/amd64/Dockerfile b/amd64/Dockerfile index 1da5a9f..9eec8a6 100644 --- a/amd64/Dockerfile +++ b/amd64/Dockerfile @@ -1,6 +1,7 @@ FROM debian:stretch -MAINTAINER Andre Germann +LABEL maintainer="Andre Germann" \ + url="" ENV DEBIAN_FRONTEND noninteractive diff --git a/armv7hf/Dockerfile b/armv7hf/Dockerfile index 83e3f4a..9ce6797 100644 --- a/armv7hf/Dockerfile +++ b/armv7hf/Dockerfile @@ -1,7 +1,8 @@ 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) From f1b1360264f7f3e4400268e15211bff9c0c94fc1 Mon Sep 17 00:00:00 2001 From: duffbeer2000 Date: Fri, 27 Dec 2019 15:03:21 +0100 Subject: [PATCH 04/13] removed apt-get upgrade -y apt-get upgrade -y shouldn't be used in a Dockerfile --- aarch64/Dockerfile | 2 +- amd64/Dockerfile | 2 +- armv7hf/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aarch64/Dockerfile b/aarch64/Dockerfile index abd1720..a8cde0f 100644 --- a/aarch64/Dockerfile +++ b/aarch64/Dockerfile @@ -6,7 +6,7 @@ LABEL maintainer="Andre Germann" \ 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/Dockerfile b/amd64/Dockerfile index 9eec8a6..43dd2fe 100644 --- a/amd64/Dockerfile +++ b/amd64/Dockerfile @@ -6,7 +6,7 @@ LABEL maintainer="Andre Germann" \ 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/Dockerfile b/armv7hf/Dockerfile index 9ce6797..3a159a9 100644 --- a/armv7hf/Dockerfile +++ b/armv7hf/Dockerfile @@ -6,7 +6,7 @@ LABEL maintainer="Andre Germann" \ 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 \ From 37c9046077808f3332dbf9c8764dc9ad8efc9406 Mon Sep 17 00:00:00 2001 From: duffbeer2000 Date: Fri, 27 Dec 2019 15:13:46 +0100 Subject: [PATCH 05/13] Small Bugfix for restore --- aarch64/scripts/iobroker_startup.sh | 2 +- amd64/scripts/iobroker_startup.sh | 2 +- armv7hf/scripts/iobroker_startup.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aarch64/scripts/iobroker_startup.sh b/aarch64/scripts/iobroker_startup.sh index 359f110..8b60eca 100644 --- a/aarch64/scripts/iobroker_startup.sh +++ b/aarch64/scripts/iobroker_startup.sh @@ -117,7 +117,7 @@ else mv /opt/iobroker/iobroker_20*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / mkdir /opt/iobroker/backups - rm -r /opt/iobroker/backups/* + rm -r /opt/iobroker/backups/* &> /dev/null mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ iobroker restore 0 echo "Done." diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 359f110..8b60eca 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -117,7 +117,7 @@ else mv /opt/iobroker/iobroker_20*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / mkdir /opt/iobroker/backups - rm -r /opt/iobroker/backups/* + rm -r /opt/iobroker/backups/* &> /dev/null mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ iobroker restore 0 echo "Done." diff --git a/armv7hf/scripts/iobroker_startup.sh b/armv7hf/scripts/iobroker_startup.sh index 359f110..8b60eca 100644 --- a/armv7hf/scripts/iobroker_startup.sh +++ b/armv7hf/scripts/iobroker_startup.sh @@ -117,7 +117,7 @@ else mv /opt/iobroker/iobroker_20*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / mkdir /opt/iobroker/backups - rm -r /opt/iobroker/backups/* + rm -r /opt/iobroker/backups/* &> /dev/null mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ iobroker restore 0 echo "Done." From 22d6b0158c4383c37d62f9e6ae80ff441e7abcac Mon Sep 17 00:00:00 2001 From: duffbeer2000 Date: Sun, 29 Dec 2019 19:56:21 +0100 Subject: [PATCH 06/13] Small fix backup folder is always empty in this if case so not necessary to empty it --- aarch64/scripts/iobroker_startup.sh | 1 - amd64/scripts/iobroker_startup.sh | 1 - armv7hf/scripts/iobroker_startup.sh | 1 - 3 files changed, 3 deletions(-) diff --git a/aarch64/scripts/iobroker_startup.sh b/aarch64/scripts/iobroker_startup.sh index 8b60eca..93b690f 100644 --- a/aarch64/scripts/iobroker_startup.sh +++ b/aarch64/scripts/iobroker_startup.sh @@ -117,7 +117,6 @@ else mv /opt/iobroker/iobroker_20*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / mkdir /opt/iobroker/backups - rm -r /opt/iobroker/backups/* &> /dev/null mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ iobroker restore 0 echo "Done." diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 8b60eca..93b690f 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -117,7 +117,6 @@ else mv /opt/iobroker/iobroker_20*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / mkdir /opt/iobroker/backups - rm -r /opt/iobroker/backups/* &> /dev/null mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ iobroker restore 0 echo "Done." diff --git a/armv7hf/scripts/iobroker_startup.sh b/armv7hf/scripts/iobroker_startup.sh index 8b60eca..93b690f 100644 --- a/armv7hf/scripts/iobroker_startup.sh +++ b/armv7hf/scripts/iobroker_startup.sh @@ -117,7 +117,6 @@ else mv /opt/iobroker/iobroker_20*.tar.gz /opt/ tar -xf /opt/initial_iobroker.tar -C / mkdir /opt/iobroker/backups - rm -r /opt/iobroker/backups/* &> /dev/null mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ iobroker restore 0 echo "Done." From fef9271eb4a7c94f8d6a9545164637cc046b5cbe Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 31 Dec 2019 18:31:58 +0100 Subject: [PATCH 07/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index febfbff..8a7dd84 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ 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! +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 From c3f901f04e1410b3c94b846911334ba48437131a Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 31 Dec 2019 18:36:46 +0100 Subject: [PATCH 08/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a7dd84..9a9fcaa 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ 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! +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 From d5a1bda9b4599d56dd971c4a34931242110f767e Mon Sep 17 00:00:00 2001 From: buanet Date: Sat, 4 Jan 2020 21:00:23 +0100 Subject: [PATCH 09/13] improve restore and logging --- amd64/scripts/iobroker_startup.sh | 50 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 93b690f..a55c9f6 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -100,37 +100,37 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "$(printf -- '-%.0s' {1..60})" echo ' ' -if [ `ls -1a|wc -l` -lt 3 ] +files=(/opt/iobroker/*) +if [ ${#files[@]} -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." -else - if [ -f /opt/iobroker/iobroker ] +elif [ -f /opt/iobroker/iobroker ] +then + echo "Existing installation of ioBroker detected in /opt/iobroker." +elif [ ${#files[@]} -lt 2 ] +then + if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null then - echo "Existing installation of ioBroker detected in /opt/iobroker." - else - files=(/opt/iobroker/*) - if [ ${#files[@]} -lt 2 ]; then - if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null; then - echo "ioBroker Backup detected in /opt/iobroker. Restoring ioBroker..." - mv /opt/iobroker/iobroker_20*.tar.gz /opt/ - tar -xf /opt/initial_iobroker.tar -C / - mkdir /opt/iobroker/backups - mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ - iobroker restore 0 - echo "Done." - else - 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 - 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 "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..." + mv /opt/iobroker/iobroker_20*.tar.gz /opt/ + tar -xf /opt/initial_iobroker.tar -C / + mkdir /opt/iobroker/backups + mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ + iobroker restore 0 + echo "Done." + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!!! Please note: The sartup script restored iobroker from a backup file. !!!!!" + echo "!!!!! When ioBroker will be started 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 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" fi +else + 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 ' ' From 27b6c93a172a7ef8b80aaaa09169c03f405bcd63 Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 5 Jan 2020 03:05:13 +0100 Subject: [PATCH 10/13] testing --- amd64/scripts/iobroker_startup.sh | 34 ++++++++++++++----------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index a55c9f6..1cc7045 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -100,8 +100,7 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "$(printf -- '-%.0s' {1..60})" echo ' ' -files=(/opt/iobroker/*) -if [ ${#files[@]} -lt 1 ] +if [ `ls -1a|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 / @@ -109,24 +108,21 @@ then elif [ -f /opt/iobroker/iobroker ] then echo "Existing installation of ioBroker detected in /opt/iobroker." -elif [ ${#files[@]} -lt 2 ] +elif [ -f /opt/iobroker/*.tar.gz ] && [ tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null ] #ACTUALLY BROKEN!!! then - if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null - then - echo "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..." - mv /opt/iobroker/iobroker_20*.tar.gz /opt/ - tar -xf /opt/initial_iobroker.tar -C / - mkdir /opt/iobroker/backups - mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ - iobroker restore 0 - echo "Done." - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - echo "!!!!! Please note: The sartup script restored iobroker from a backup file. !!!!!" - echo "!!!!! When ioBroker will be started 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 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - fi + 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 + echo "Done." + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "!!!!! Please note: The sartup script restored iobroker from a backup file. !!!!!" + echo "!!!!! When ioBroker will be started 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 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." From 4101fc1cab84f0de76e4d02ec8469edb0652f309 Mon Sep 17 00:00:00 2001 From: buanet Date: Sun, 5 Jan 2020 16:06:10 +0100 Subject: [PATCH 11/13] fixing restore --- amd64/scripts/iobroker_startup.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/amd64/scripts/iobroker_startup.sh b/amd64/scripts/iobroker_startup.sh index 1cc7045..5653468 100644 --- a/amd64/scripts/iobroker_startup.sh +++ b/amd64/scripts/iobroker_startup.sh @@ -100,7 +100,7 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----" echo "$(printf -- '-%.0s' {1..60})" echo ' ' -if [ `ls -1a|wc -l` -lt 1 ] +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 / @@ -108,21 +108,24 @@ then elif [ -f /opt/iobroker/iobroker ] then echo "Existing installation of ioBroker detected in /opt/iobroker." -elif [ -f /opt/iobroker/*.tar.gz ] && [ tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null ] #ACTUALLY BROKEN!!! +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 + iobroker restore 0 > /opt/iobroker/log/restore.log 2>&1 echo "Done." - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - echo "!!!!! Please note: The sartup script restored iobroker from a backup file. !!!!!" - echo "!!!!! When ioBroker will be started 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 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + 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 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." From 7d4eba91a125eb90cc4c9535b4c7e3124dbc3d73 Mon Sep 17 00:00:00 2001 From: buanet Date: Mon, 6 Jan 2020 00:36:46 +0100 Subject: [PATCH 12/13] preparing new beta --- README.md | 15 ++++++--- aarch64/scripts/iobroker_startup.sh | 51 ++++++++++++++--------------- armv7hf/scripts/iobroker_startup.sh | 51 ++++++++++++++--------------- 3 files changed, 60 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 794aeb8..395ba37 100644 --- a/README.md +++ b/README.md @@ -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/scripts/iobroker_startup.sh b/aarch64/scripts/iobroker_startup.sh index 93b690f..5653468 100644 --- a/aarch64/scripts/iobroker_startup.sh +++ b/aarch64/scripts/iobroker_startup.sh @@ -100,37 +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 - files=(/opt/iobroker/*) - if [ ${#files[@]} -lt 2 ]; then - if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null; then - echo "ioBroker Backup detected in /opt/iobroker. Restoring ioBroker..." - mv /opt/iobroker/iobroker_20*.tar.gz /opt/ - tar -xf /opt/initial_iobroker.tar -C / - mkdir /opt/iobroker/backups - mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ - iobroker restore 0 - echo "Done." - else - 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 - 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 - 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/scripts/iobroker_startup.sh b/armv7hf/scripts/iobroker_startup.sh index 93b690f..5653468 100644 --- a/armv7hf/scripts/iobroker_startup.sh +++ b/armv7hf/scripts/iobroker_startup.sh @@ -100,37 +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 - files=(/opt/iobroker/*) - if [ ${#files[@]} -lt 2 ]; then - if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null; then - echo "ioBroker Backup detected in /opt/iobroker. Restoring ioBroker..." - mv /opt/iobroker/iobroker_20*.tar.gz /opt/ - tar -xf /opt/initial_iobroker.tar -C / - mkdir /opt/iobroker/backups - mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ - iobroker restore 0 - echo "Done." - else - 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 - 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 - 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 ' ' From e9481bae9ff4a0ae4fffe08ff5d38a6e37ed05cc Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 6 Jan 2020 00:38:48 +0100 Subject: [PATCH 13/13] Update .VERSION --- .VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.VERSION b/.VERSION index 97a50b0..d4b18a1 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v4.0.2beta +v4.0.3beta