[OH in docker] how to manage updates/rollback

Hi all,

quick question. How to go back to the previous image if a new image has an issue with your setup?

I usually start openhab via compose, and I regularly update the image automatically with ouroboros.

Any suggestion?
thanks
Andrea

It will create a backup before performing an update which is stored in userdata/backups.

So typically you’d then want to:

  1. stop the container
  2. replace your data with that of the backup
  3. recreate the container that runs an older openHAB version
1 Like

All releases are tagged. You need to modify your docker-compose.yml file to change the tag used.

1 Like

At the moment I’m using

image: "openhab/openhab:milestone-debian"

So every day I receive a new snapshot. The question is: how to rollback to previous snapshot if something goes wrong with the new one?

:slight_smile:

nested question: what is the best way to perform a backup? just copy the entire directory? Consider I need to copy also my PaperUI configs

My questions are

  1. Why are you running snapshots? Are you developing bindings?
  2. What are you using Docker Compose without knowing about image tags? Instruction on that is off-topic for this forum.

The Linux install instructions give some information but you would need a knowledge of Docker to use that.

Since you’re on the milestone tag you only receive milestone or stable release and not snapshots. The rebuilds of the milestone images are actually a side effect of the snapshot images being build. That is because all images are build in the same job. So the only updates you get in between milestone/stable releases are (security) updates of packages in the base Debian image.

See also:

1 Like

oh wow … sorry … I did a mistake. My version would be ‘snapshot’ :slight_smile:

Question is: how to move to previous snapshot if the latest is broken for me?

thanks
Andrea

Individual snapshots aren’t tagged on Docker Hub. But you could tag/backup it yourself locally before updating using:

docker tag openhab/openhab:2.5.4-snapshot openhab/openhab:my-latest-working-version

Then you can restore it by removing the broken image and tagging it the other way around:

docker rmi openhab/openhab:2.5.4-snapshot
docker tag openhab/openhab:my-latest-working-version openhab/openhab:2.5.4-snapshot

@ariela are you saying you changed your tag to snapshot?
You should not be running snapshot releases on your production system. You should only run then if you are testing for development purposes.

@wborn you mean milestones are rebuilt daily with different image IDs? I thought the purpose of the latest tag was only to pull down an image if there were a newer one.

If the IDs change daily, Docker would pull an image down every day, if restarted daily.

1 Like

Yes so it’s a known issue @Bruce_Osborne.

@Bruce_Osborne yes, and indeed you are right. I was used to work my snapshot image with openhabian, when I started using OH. But now I have too many things connected, better to stay as much stable as possible. So I reverted to milestone. And I will ask ouroboros to IGNORE updates for openhab.

Folks, any idea when the new stable will be 2.5.4 instead of 2.5.3? @glhopital did some changes on OpenUV binding and I would like to implement the latest (maybe I can install manually?)

thanks again
Andrea

The general plan is to release monthly updates.
You may be able to manually install the addon, depending on your Docker volume mounting.

It looks like you are using Docker Compose? What are your volumes?

Unfortunately I’ve tried to delay the rules as I did in openabian via system_override.conf, but no chances :frowning:

[Service]
ExecStartPre=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.rules" -exec /usr/bin/rename.ul .rules .rules_away {} \\;'
ExecStartPre=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.script" -exec /usr/bin/rename.ul .script .script_away {} \\;'
ExecStartPost=/bin/sleep 240
ExecStartPost=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.script_away" -exec /usr/bin/rename.ul .script_away .script {} \\;'
ExecStartPost=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "*.rules_away" -exec /usr/bin/rename.ul .rules_away .rules {} \\;'
TimeoutStartSec=360

OK. please post the docker-compose.yml file.

That could run with changes. You really need to understand how your system is configured rather than just wanting complete solutions from this forum. It’s purpose is to help you understand, not feed complete solutions.

I really appreciate this way :slight_smile:

version: '3'

services:
  openhab: #name of the service
    container_name: openhanded
    image: "openhab/openhab:milestone-debian"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/TZ:/etc/timezone:ro"
      - "/volume1/docker/openhab/openhab_addons:/openhab/addons"
      - "/volume1/docker/openhab/openhab_conf:/openhab/conf"
      - "/volume1/docker/openhab/openhab_userdata:/openhab/userdata"
      - "/volume1/docker/openhab/systemd_override.conf:/etc/systemd/system/openhab2.service.d/override.conf:ro"
#      - ".java:/openhab/.java"
    environment:
      USER_ID: "1036"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Rome"
      LC_ALL: "en_US.UTF-8"
      LANG: "en_US.UTF-8"
      LANGUAGE: "en_US.UTF-8"
      CRYPTO_POLICY: "unlimited"
#    devices: 
#      - "/dev/ttyACM0:/dev/ttyACM0" # for Zwave stick

  samba:
    container_name: openhab-smb
    image: joebiellik/samba-server
    restart: always
    network_mode: host
    ports:
      - "8137:137/udp"
      - "8138:138/udp"
      - "8139:139/tcp"
      - "58445:445/tcp"
    volumes:
      # You must provide a Samba config file
      - /volume1/docker/openhab/smb.conf:/etc/samba/smb.conf
      # Shares
      - /volume1/docker/openhab/openhab_conf:/mnt/openhab
    depends_on:
      - openhab
    environment:
      - USERNAME=openhab
      - PASSWORD=xxxxx

      # Uncomment to override defaults
      - UID=1036
      - GID=65538


@wborn can correct me is I am mistaken. You should be able to uninstall the old binding, copy the new binding jar file into volume1/docker/openhab/openhab_addons and opeenHAB should use that binding file, if the file is owned by the user with UID=1036 and GID=65538.

You should remove this file before upgrading and then reinstall the upgraded binding.

That is not the purpose of this forum and eventually the volunteer users here will realize they are being abused and refuse to help you at all. Is that what you wish?
We do not have the volunteer resources to hand out complete solutions to every user so we must prioritize our efforts.

Bruce there is a misunderstanding here for sure. I’m not asking you to do what I’ve to do. Just to answer a question if you can/have time/pleasure to do so.

I’m a quite old member of this community, I’ve helped when I was able to do, and asked support when I was in trouble. Always finding the best approach.

Anyway, thanks for that

Andrea

1 Like