I’m in the middle of migrating from OH2 to OH3. My OH2 installation is running on a Windows “server” (actually WinXP), while my OH3 installation is openHABian on a RPi.
I’ve used Git to backup my configuration. By that I mean configuration files that I put time into configuring like items, rules, maps, sitemaps etc. I use .gitignore
to exclude everything that is somehow configured automatically or during a “normal” installation. Please don’t start the “backup” discussion, as this isn’t my only form of backup and it isn’t intended to be something that I can restore to regain a running system. This is to preserve the work I put into building “my system”. The history, going back and looking at why I changed and why/when is as important as the “backup” itself. It’s a way to keep control of what I’m doing, and I also check the diff before I commit after making some changes to see that I haven’t done something I didn’t intend to which has turned out to be quite useful if I’ve used the GUI for anything, since “strange things” seems to happen there like stubs suddenly appearing in different places).
I’m not sure if it’s because of the move from Windows to Linux or from OH2 to OH3 (although I suspect the latter), but the file structure of the files I need to include in my git repo has changed. On my OH2 installation, everything is very nicely organized in one place, where conf
and userdata
live in the same folder and the git repo “root” is the parent folder for all this. Using .gitignore
I then simply exclude all the folders that aren’t of interest.
On the openHABian installation however, this is completely different. Here I have $OPENHAB_CONF
pointing to /etc/openhab
and $OPENHAB_USERDATA
pointing to /var/lib/openhab
. This makes it impossible to utilize the same strategy unless I want to make /
the git repo “root” (and that isn’t really a viable solution for a number of reasons).
At first I configured my git repo “root” in $OPENHAB_CONF
, since that’s where most of the data I want to preserve is located. But, it turns out that there are so many things in OH3 which simply can’t be done with configuration files (widgets++), so I don’t seem to have a choice but to include the JSON database. While it would be possible to create a second git repo in $OPENHAB_USERDATA
and create a corresponding second remote repository, it wouldn’t be a very good solution and I haven’t really considered it viable. It would take away the ability to compare changes in a practical way, and depend on strict discipline to make sure everything was done “in sync” between the two repos.
My question is how to solve this. What I have done now, is the following (which seems like a “failed” attempt): I stopped openhab
and zram-config
, created /etc/openhab/userdata
and moved all the content from /var/lib/openhab
to /etc/openhab/userdata
. I then deleted /var/lib/openhab
and replaces it with a symlink of the same name pointing to /etc/openhab/userdata
. I also reconfigured /etc/ztab
to cache persistence
in its new location (as I don’t know if zram will work properly via a symlink). I then started everything up again.
While I haven’t seen any errors in the log, it doesn’t feel good and I have widgets that now don’t seem to update themselves. Symlinks can break a lot of stuff, so I just don’t like it. An alternative might be to just change $OPENHAB_USERDATA
to point to the “new” location and remove the symlink. I don’t the consequences of this either.
I’m worried that things like backup scripts, openHABian scripts etc won’t play nice with this configuration, even if I manage to figure out why the widgets no longer read the item sources.
Is there a “proper” and safe way to get these folders organized such that they can belong to one git repo? If so, what is that?