Running same instance of OH on multiple platforms

I store my OpenHAB instance in a folder within my Dropbox account, and run OpenHAB on a Windows laptop which is always on.

This is a really great way to make incremental changes with the confidence that everything is backed-up instantly, and it also allows me to roll-back if I mess something up - I don’t want to be plunged into darkness!

Secondly it’s great because if I want to make a quick edit to config files when I’m away from home, I don’t have to remote in - I can just update the files in my Dropbox from another PC and OpenHAB sees the change within a few seconds and reloads the config files. Neat.

Question 1: does anyone do something similar on Linux? I want to set up a Pi and run OpenHAB from the Pi, also running it from a directory within Dropbox. Will that work?

Question 2: if I simply copy my Windows instance to the Pi, will it work (after I’ve set up associated services like MQTT, etc.)?

  1. I don’t do this but I used to and it worked fine - I never trusted the Dropbox sync tho as I had a few cases when everything just disappeared so I got nervous and now use git for version control - obviously not as easy to load new config remotely, have to SSH in and run git pull after making and pushing local changes. Still, works well and nice to have proper versioning/history etc.

  2. Should be fine, as long as there is a JVM it will run on any platform. Only thing to watch out for are any path names, and hardware/device names etc. But yeah, should be fine I think.

Thanks @ben_jones12! Next steps: getting Homekit and OwnTracks working (sadly I didn’t manage to get OwnTracks working with MQTT on a linux instance last time I tried - must try harder!)

Sing out if you need a hand with that, myself or @jpmens will be happy to help. Should be pretty straightforward…should be

I do something a little similar using a private git server. Some have done it using github and I know a lot of people have done similar with DropBox. There is a Linux Dropbox client so it should work.

I would highly recommend installing OH using apt-get and symbolically linking your config and webapps folders to the appropriate places from your DropBox folder. This way you get the benefit of having everything set up for you so OH runs with the right permissions, starts as a service, and can get updated through apt-get yet all the things you would touch for your configurations would be in DropBox.

Devices (e.g. the COM port 1 for a zwave dongle) will be different. You will also have to worry more about file permissions and ownership.

Overall, you should be able to make it work though.

Git is a great way of doing it. If you run gitlab community edition on a local VM, you can use it’s CI feature. When you merge your changes into a branch, it can automatically trigger a webhook. This webhook can just be URL provided by a basic web server running on the Openhab server that triggers a bash script that simply runs “git pull”.

Gitlab also has a front end web editor, so you can make the changes in a browser without having to run a local clone, merge it to your master branch and the automated process will kick in.

I may not be doing a good job of explaining it simply, but it’s really easy to setup. It’s the same principle we use in work to deploy our code changes to all of the web servers.

And if all you really want is a really light weight server with few frills, Gogs is pretty good. I have it running in a Docker container. I’m not sure how much disk space it takes up but the container itself only consumes 8.5 M of RAM. The web interface isn’t half bad either, though such automation described is not included.

Hi @beardedgeek I am using Gitlab for my openhab config but I am very interested about how to integrate CI and the webhook stuff. Would be able to share some details about how you set this up? Sounds like a very useful setup!

This would make an excellent new Tutorial and Example posting…

@beardedgeek - would you be interested in sharing how you setup Gitlab to automatically update openHAB on merge commit? I would find this very useful and am struggling a bit to see how this can be done with the Gitlab CI Runner. Most of the documentation seems to be geared around Docker images etc.