Docker Community Marketplace addons persistence during restarts

runtimeInfo:
  version: 4.2.0
  buildString: Release Build
locale: nl-NL
systemInfo:
  configFolder: /openhab/conf
  userdataFolder: /openhab/userdata
  logFolder: /openhab/userdata/logs
  javaVersion: 17.0.11
  javaVendor: Alpine
  osName: Linux
  osVersion: 6.6.32-production+truenas
  osArchitecture: amd64
  availableProcessors: 32
  freeMemory: 811935096
  totalMemory: 1191182336
  uptime: 558
  startLevel: 100

The issue is that after restarting/reloading the container the ‘Community Marketplace’ bindings have to be manually reinstalled.

I’m not seeing the same behavior.

How do you have your volumes mapped?

And when you say “restarting/reloading” do you mean actually just restarting an existing container or creating a new container?

This is true for me only when I create a new container.

I have just assumed that clearing the marketplace folder in userdata is part of the update script in the image because that’s easier than trying to automatically download never versions of marketplace bindings.

If you’re getting this issue on every restart then I wonder if for some reason your update script is running every time. For example, are you, in fact, creating a new container every time you restart?

Hmmm.

The upgrade script should only run if the new container is running a different version of OH than the userdata/etc/version.properties. That’s one of the few code contributions I’ve made to OH over the years. :slight_smile:

When there is a new version of OH the entrypoint script creates a backup and calls /openhab/runtime/upgrade which clears the cache (including userdata/marketplace), then runs the upgrade tool. The entrypoint then copies over the new userdata/etc files.

Therefore, I wouldn’t expect to need to reinstall a marketplace add-on unless the container is recreated and the OH version in the new container is different from the version in the last container that used those volumes. If you are running snapshots that could be every day.

It could also be a problem if the userdata folder isn’t mapped as a volume.

I believe that the marketplace add-ons to install get defined in userdata/jsondb/org.openhab.marketplace.json. However, looking at mine I see that it’s currently an empty JSON (i.e. {}). But I still have the doctor add-ons from the marketplace installed. I do notice that one of my backups of that file does have an entry for the doctor add-on, maybe my OH is pulling from that?

What is the contents of this file for both of you before and after recreating the contianer and, if it’s only just restarting the container before and after doing that?

I’m pretty sure I’ve recreated the container since installing the doctor add-on. But I’m on the milestone releases so my OH version won’t change until 4.3 M1 is released.

I wonder if something (bug?) is clearing out org.openhab.marketplace.json so when the cache gets cleared the add-ons from the marketplace do not get reinstalled.

I believe that once it’s installed, so long as the add-on shows up for the new version of OH, it should be reinstalled even after an upgrade. If the add-on does not show up because of the published supported versions, it should not be reinstalled but a warning might be nice. I don’t think there is a warning now and I am not sure what happens.

1 Like

I mean stopping and starting the container.


On the other hand I might have switched container versions, now I read your post. I’ll give a restart without changing versions.

Hmmm, the addons remain.

This is correct and therefore the solution to my problem.