Openhab in a docker container: how to delay rules

Hi folks,

in order to avoid any issue with items not yet populated during the startup, how can I delay a bit the rules when I have my OH in a docker container?

Any suggestion?

In openhabian is quite easy, but I’m not able to figure out how to solve it with docker.

Any suggestion will be appreciated
thanks

Andrea

1 Like

The mechanism used in openHABian should work in Docker, too.
But why move ? Will just get you a potential bunch of problems you didn’t have before.

[16:24:20] openhabian@openhabianpi:~$ cat /etc/systemd/system/openhab2.service.d/override.conf

[Service]
ExecStartPre=-/bin/bash -c ‘/usr/bin/find ${OPENHAB_CONF} -name “.rules" -exec /usr/bin/rename.ul .rules .x {} \;’
ExecStartPost=-/bin/sleep 120
ExecStartPost=-/bin/bash -c '/usr/bin/find ${OPENHAB_CONF} -name "
.x” -exec /usr/bin/rename.ul .x .rules {} \;’
TimeoutStartSec=240

1 Like

So In my docker-compose I should expose this volume

volume
   - override.conf /etc/systemd/system/openhab2.service.d/override.conf

does it make any sense?
Andrea

why are you saying that? At the moment my test device is working waaaaaay better … but I need to move my zwave infrastructure …

Containers add complexity such as the questions you’ve put up yourself (how to map HW and volumes).
And there’s hardly any advantage for a normal user unless you change HW. But if you do that, you could also deploy openHABian on that new HW and would get the same speedup benefit (or better even when you dispose of the container overhead).

consider I’m moving from a Mac mini to a Synology NAS, and from VMware image to Docker, as I prefer a container instead of another vm with the Synology VM manager …

But I’m still testing, I don’t have migrated my zwave network yet

I wouldn’t use Docker, and I wouldn’t run it on a NAS. Official recommendations advise to use a dedicated system in the first place and for good reason. Any recent RPi will also do.
Performance should not be an issue on any of these platforms hence no reason to change.

1 Like

As for me, I run it on Docker on my Synology NAS since one or two years already. And I can’t complain at all (just know the limitations of your systems). I love the Docker concept and if the hardware (NAS) fails, I could easily start the docker container on my PC, notebook or any other device here.

1 Like