openhab / openhab-docker

Repository for building Docker containers for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
212 stars 128 forks source link

Test if update requiers doesn't fit to update script #266

Closed copyrights closed 4 years ago

copyrights commented 4 years ago

I'm running openhab/openhab:latest-debian on amd64.

In https://github.com/openhab/openhab-docker/blob/c489e2a2b000d72f521a373d1ab2795d7865382f/2.5.0/debian/entrypoint.sh#L74 version.properties is tested.

My version.properties differs from dist like this.

4c4
< online-repo     : https://api.bintray.com/maven/openhab/mvn/online-repo/2.5
---
> online-repo     : https://dl.bintray.com/openhab/mvn/online-repo/2.5
12a13
> 

So the update is invoked.

But this tests a little bit different and exits. https://github.com/openhab/openhab-distro/blob/7b02719b6c597d4b725150f2c5c5d1e549701bcb/distributions/openhab/src/main/resources/bin/update#L91-L93

As result the container start fails.

copyrights commented 4 years ago

Addition info ${OPENHAB_USERDATA}/config/org/ops4j/pax/url/mvn.config and ${OPENHAB_USERDATA}/etc/org.ops4j.pax.url.mvn.cfg needs to be update with new URL.

wborn commented 4 years ago

We pushed a new container with a fix for those URLs.

So if you update the version in version.properties to 2.4.0 and recreate the container using the updated image, it will probably redo the upgrade and fix the repo URLs.

If that doesn't work try restoring the automatically generated backup.

copyrights commented 4 years ago

@wborn modify version.properties , pull, run. Works fine now, thank you.

wborn commented 4 years ago

Great! :-) Then let's also close the issue.

janwo commented 4 years ago

Somehow I still get an update loop. It constantly creates new backup files. Due to specific permissions, I am using the following environment variables inside my container: USER_ID | 1000 GROUP_ID | 995

Unfortunately this might be the problem as it somehow can't finish the operation. The backups are created as root. The version.properties file is actually created by 1000:995. (pi:docker)

Bildschirmfoto 2019-12-19 um 20 29 43 Bildschirmfoto 2019-12-19 um 20 28 26
janwo commented 4 years ago
################################################,
          openHAB Docker update script          ,
################################################,
,
You are already on openHAB 2.4.0,
++ test -t 0,
++ echo false,
+ interactive=false,
+ set -euo pipefail,
+ IFS=',
    ',
+ '[' limited = unlimited ']',
+ rm -f /openhab/runtime/instances/instance.properties,
+ rm -f /openhab/userdata/tmp/instances/instance.properties,
+ NEW_USER_ID=1000,
+ NEW_GROUP_ID=995,
+ echo 'Starting with openhab user id: 1000 and group id: 995',
Starting with openhab user id: 1000 and group id: 995,
+ id -u openhab,
+ case ${OPENHAB_VERSION} in,
+ initialize_volume /openhab/conf /openhab/dist/conf,
+ volume=/openhab/conf,
+ source=/openhab/dist/conf,
++ ls -A /openhab/conf,
+ '[' -z 'html,
icons,
items,
persistence,
rules,
scripts,
services,
sitemaps,
sounds,
.sync,
things,
transform' ']',
+ initialize_volume /openhab/userdata /openhab/dist/userdata,
+ volume=/openhab/userdata,
+ source=/openhab/dist/userdata,
++ ls -A /openhab/userdata,
+ '[' -z 'backup,
cache,
config,
etc,
jsondb,
logs,
openhabcloud,
persistence,
.sync,
tmp,
uuid,
zwave' ']',
++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties,
+ '[' '!' -z '/openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties differ: byte 182, line 4' ']',
+ echo 'Image and userdata versions differ! Starting an upgrade.',
+ tee /openhab/userdata/logs/update.log,
Image and userdata versions differ! Starting an upgrade.,
++ date +%FT%H-%M-%S,
+ backup_file=userdata-2019-12-19T20-26-46.tar,
+ '[' '!' -d /openhab/userdata/backup ']',
+ tar --exclude=/openhab/userdata/backup -c -f /openhab/userdata/backup/userdata-2019-12-19T20-26-46.tar /openhab/userdata,
tar: Removing leading `/' from member names,
+ echo 'You can find backup of userdata in /openhab/userdata/backup/userdata-2019-12-19T20-26-46.tar',
+ tee -a /openhab/userdata/logs/update.log,
You can find backup of userdata in /openhab/userdata/backup/userdata-2019-12-19T20-26-46.tar,
+ exec /openhab/runtime/bin/update,
+ tee -a /openhab/userdata/logs/update.log,
,
################################################,
          openHAB Docker update script          ,
################################################,
,
You are already on openHAB 2.4.0,