Best practice for running openHAB as docker container and using samba?

I am going to migrate my openHAB installation from my RasPi to my Debian home server using Docker.

Now I am looking for the recommended way to access and edit the openHAB configuration via samba.

I think there are a few different options:

  1. configure a samba server inside the openHAB container
  2. add a separate samba container with access to the named volumes with the openHAB files
  3. use my existing samba server on the host and add a share for /var/lib/docker/volumes/openhab*
    But as which user?
    a. using my local user that already has access to other samba shares on this server
    b. using the openhab user (9001:9001)
    But then I would need to access the samba server with different users from my client
  4. Keep using the command line editor (vi, mcedit, nano) and do not switch to VSCode via samba.

How do you guys do it?
What is the recommended way?

Install ooenhabian via get then let it configure samba? It’s a s option and it exposes all the proper dorctories.

I did this on my Ubuntu vm, worked great.

I went with option 3 even if the Docker way would be to have Samba running in a seperate container. On the host i‘ve created an openhab user (9001:9001) and added my regular User to the openhab group.

I want to use a container.
openHABian is more the full feature solution, I guess.

Yeah, that sounds like the best idea.

@christoph_wempe yes openhabian “the tool” is a great tool. I have installed it manually on my ubuntu system and I let it do the work of configuring samba etc.

I also, use openhabian “the os” on my raspberri pi. But the tool can be installed manullay on other linux distros. I would assume this includes a docker container. I am not familiar with docker however.

The idea of docker is to use little “containers” wich serve a single purpose/service.
So I have a conatiner for influxdb, another for grafana, another for mqtt and so on.
Whereas openhabian would install everything into one container.

DonT get me wrong, openhabian is a fantastic tool/OS if you want to install and configure everything on one system easily.
But it is not what I want. :slight_smile:

Thanks anyway.

And you’re going to constantly going to maintain all those containers (to avoid e.g., security issues)? :wink:

@christoph_wempe may I recommend portioner and watchtower to you? These are the first ones I’ve started with. Apart from that, there is influxdb, telegraf, chronograf, mqtt, nodered, openhab, frontail and rsyslog.

I think there are containers for openHAB, but I first the impression there’s still some manual cleanup needed when upgrading.

I’ve startednplaying with containers lately. The home assistant one, for example, I pull the new image, stop my running container and start it up with the new image, job done. No cleanup, removal of cache files. Seems a very clean process.

I’ve not investigated the openHAB ones much, or if there’s an openHABian one that is. More self contained.

It’s an idea I’d like to look at more, even running this on my dedicated machine. That said since moving Fromm a windows instance to a Linux instance the upgrade procedure is much simpler.

Since beginning of this year there are new upgrade scripts in place that take care of all cleanup steps. Works like a charm.

Like any software it has to be maintained. But if it’s done right, like virtualisation and taking snapshots, an upgrade can be performed, and if it doesn’t work, stop the container and revert to an older version in seconds.

I’ve had failed on upgrades before (admittedly on windows) where the system was hosed, and I needed to completely reinstall.

This is also where good configuration managed is needed so that latest versions of things and items files can be pulled from a repository.

Ideally any containerisation would include this aspect. I know this thread was talking about pullin config from samba. I would have thought an svn/local or external got server might be a better option, as it can be automated with less scripting.

The issue with openHAB is getting any addons down that are desired. I think this is where the addons.cfg file should be used.

Yes, I know.
But I think we get off topic. :wink:

I know the benefits of container.
I just wanted to know how others solved the “samba problem”. :wink:

That reminds me of something: in smb.conf I had to add something like admin users=<my-user-goes-here> into the definition of the share.

1 Like

Hi Matthias,
Could you share exactly how you configure frontail as a docker for your openhab docker setup? (not openhabian)?
much thanks

Hi @epicurean,

here is my section from the compose file (.css and .json from openhabian):

    container_name: frontail
    restart: unless-stopped
    image: mthenw/frontail
    command: --disable-usage-stats --ui-highlight --ui-highlight-preset /frontail/preset/openhab.json -t openhab -l 2000 -n 200 /logs/openhab.log /logs/events.log
      - openhab
      - ./frontail/preset.json:/frontail/preset/openhab.json:ro
      - ./frontail/openhab.css:/frontail/web/assets/styles/openhab.css:ro
      - ./openhab/userdata/logs:/logs:ro
      - "8001:9001"