Filesystem polling instead of inotify

Hey,

I use the openHAB Docker image and bind mount an NFS share with the openHAB config into the container. Everything works fine apart from notifying openHAB about changes to the configuration files. openHAB relies on inotify events, which do not get propagated from the NFS server to the clients by design.

Can we implement an alternative method for noticing configuration changes like polling and comparing the filesystem’s change timestamp of each file?

Looking forward to hearing your thoughts about this!

1 Like

If you run the Docker image on another box than the NFS server (you didn’t tell), I’d refrain from that setup, it makes OH dependent on other boxes. had that setup myself but suffered from those dependencies so moved everything to a single SBC.
And even if it’s both running on the same NAS, what’s the benefit of mounting the config dir ?
Just leave that local to your OH container.

1 Like

Ah sorry for leaving this information out. My NFS server is on a highly available NAS system, while most of my infrastructure runs on a stack of laptops (used as servers).

All those servers do is run Docker containers and if one server fails, another one will take over. This very much increases the stability and availability for every container. So I kind of move away from the SBC way of life.

I design and maintain server infrastructure for a living (running stacks of containers and keeping them highly available) and know that things WILL fail. And this method, paired with multiple power sources and a battery backup usually protect not from the problems themselves but from the consequences.

(I use Rancher 1.6 to control which container runs on which server. The servers run RancherOS without a “real” operating system in it. So everything runs in a container and if a server breaks, I can just throw it away and stick a new one into the cabinet and it will work just like before)

This is the core issue

Might be some workarounds here

Well so do I :slight_smile: but I’m more of a KISS type (keep it simple, stupid).
Virtualizing everything sometimes creates problems you wouldn’t have without that much stacking, your issue being a proof to that statement.
Real HW outages are rare, and a SBC is quick and cheap to exchange if you have a proper backup concept.
Anyway. Feel free to stick with your setup, just keep your config dir local instead of on NFS.

1 Like