OH3: Disaster Recovery

Hi,

Im new to OH3, and just discovering the new features. For example you can now make complex GUI’s through pages (Love it!).

But these are stored in a JSONDB I think ? How do you guys handle disaster recovery, for example your disk fully crashed.

Right now I run my OH on docker and push my config folder to a private Github, but with these new features how do you version control this ? Just fully push the userdata folder all the time to Github ? Seems like you push to much bloat then.

Git pushed differences. Parts that have not changed do not add to bloat. that is part of the principles of using git

Yes I understand that github only push the differences, what I mean is that I only want to push the basic config files the code of my system.

Compare it with npm-packages or your bin directory if you are coding, you only want to push the important files.

I thought that the config folder would have a new folder “pages” and you could store all your pages there.

Most config is in the text bases JSONDb files.

And at where are they stored ? In userdata/jsondb I only have a file users.json and I have created some pages already.

Nevermind: tried a symbolic link on this folder and this bricked my openhab.

My idea is to symbolic link the jsondb folder to my github repo where my configs are so its easy to push all the configs and jsondb files to 1 repo

If you want to save everything you need to include all of conf and most of userdata. You’ll skip the cache and tmp folders and any of the backup folders (there will be a backups under jsondb and another one just under userdata created every time you upgrade your container.

You definitely want etc, config, jsond, any of the folders created by an addon, and persistence folders as those all hold configuration and saved data.

If pushing all of that to your personal git server is “too much bloat” than you should look for some other backup and restore approach.

I don’t care about any bloat on this (maybe someday I will but I don’t for now). So my .gitignore is

userdata/*
!userdata/secrets
!userdata/etc
!userdata/jsondb
!userdata/config
!userdata/habot
!userdata/openhabcloud
!userdata/uuid
!userdata/zigbee
!userdata/zwave
userdata/jsondb/backup
userdata/backup
.Trash-1000
conf/html/hum.jpg
conf/html/light.jpg
conf/html/power.jpg
conf/html/temp.jpg
*py.class
*.swp
*~
*.old

I don’t really care about backing up my persistence stuff (MapDB/rrd4j) so I exclude it too. But that does mean that this isn’t really a complete backup.

1 Like

With docker you could also exclude userdata/logs.

The way that .gitignore works is it first excludes everything under userdata. Then I undo the exclude for only those folders I want to include (it’s a kind of white list). So only those lines starting with ! will be included in the git checkin. So logs is also excluded with that .gitignore file.

2 Likes