Openhab Docker updater / semi blue-green deployment

Hello everyone,

as I have recently moved my openhab to a docker container, I wanted to make it as low maintanance as possible. What intrigued me was: I wanted to be able to upgrade without the risk of being left without a working openhab. So my idea was simple: Shutdown, copy the files, create the new container, check if it is working, and if not, roll back to the original container. As I am on a Synology Diskstation, I wanted to keep everything in .sh files, as I am able to manage these from the task window in the system settings. The entire thing is integrated via a telegram bot and tells me what it is doing. I have successfully upgraded from 4.3.6 to 5.0.1 using this script, but would of course be happy to hear from you if you find it useful. I would also be very happy if someone decides to develop this further. However, I have little experience working in git repos with more than one dev, so please don’t hesitate to tell me if I need to do something regarding the repo.

I would be extremely happy to also include suggestions from you, especially if we can manage to get the downtime shorter, or if one of you has any ideas on how to set up a reliable testing environment for this project.

The repo can be found here: https://github.com/javamaster10000/openhabUpdater

Cheers!

When the container comes up and sees that the container has a different version than the config files mounted into it (based on the contents of userdata/etc/versions.properties) it creates a backup for you automatically under userdata/backup. So copying the files may not be necessary. The container already does that before it attempts an upgrade.

Well the idea is that the old files are still ready to go in case there is something that is not compatible in the new version. But the backup to zip might be kind of overkill…

That’s what’s in the automatically created backup, everything in .

Overkill or not, the container is going to create the zip file whether you want it and use it or not.

Note, it doesn’t delete these backups so that folder will get larger and larger every time you upgrade so beware and remember to clear it out periodically.