Install & maintain openHAB on Raspi in Docker together with Mosquitto, Duplicati, influxDB, Samba etc - Step by step instruction

The issue got fixed and deployed. So will remove the addition platform: linux/armv7 again.

1 Like

The more you write the more I believe I have a bug in my wmbusmeters volume definition and the correspoding samba share.

Regarding your question of ā€œmissing nanoā€ to do the configuration after going the docker exec -it wmbusmeters /bin/sh-route: Thereā€™s also the alternative of accessing the volumes directly. Use sudo su and then cd /var/lib/docker/volumes/. You should then see your wmbusmeters-directory, and do the config-setting via nano directly there.

Btw: Iā€™m running a system not straightly set up via my instruction above (so I also played around a bit), but I do find three wmbusmeters-folders (and only one linked via Samba)ā€¦
image
ā€¦so I believe your problem is just the result of a bug in my volume definitions, leading to multiple wmbusmeters volumes, but just one being the correct one. Iā€™ll fix this as well, but might take some time until I find the time.

1 Like

Samba is still somehow a mystery to me. Sometimes it works, sometimes it doesnā€™t. Maybe you find out what needs to be changed in the docker-compose.yml, so that I can update the guideline above.

image

I think we are really close :slight_smile:
''wmbusmeters_data" volume is missing within my configuration :slight_smile:
at the same time ā€œopenhab_data_wmbusmeters_dataā€ volume looks to be empty while treated with ā€œlsā€ commandā€¦

Try to find out which is the ā€œrealā€ volume thatā€™s currently being used by wmbusmeters (and ignore the others which are caused by my bug :wink: ), do your configuration there, and then it should work. The fact that the stick is already working is majority of the work.

I know only basic linux :frowning:
I found this command and it works:

sudo chmod -R 777 /var/lib/docker/volumes/

Hope you sleep well - there is no bug in your configuration!
Followed advice and found my configuration folder (same as visible by samba share) and created meter files with sudo nano and IT WORKS :slight_smile:
Looks like the problem were files created within windows notepad :frowning: same data saved with sudo nano stated for victory :smiley:

THANKS CPLANT

Hehe is working config for TheengsGateway - it is BT gateway working on Rpi 4 (maybe other) without additional HW.

  theengsgateway:
    image: theengs/gateway:latest
    container_name: theengsgateway
    network_mode: host
    environment:
      MQTT_HOST: 192.168.1.247
      MQTT_USERNAME: mosquitto
      MQTT_PASSWORD: k0mar23
      MQTT_PUB_TOPIC: home/TheengsGateway/BTtoMQTT
      MQTT_SUB_TOPIC: home/TheengsGateway/commands
      PUBLISH_ALL: true
      TIME_BETWEEN: 60
      SCAN_TIME: 60
      LOG_LEVEL: DEBUG
      HASS_DISCOVERY: false
      DISCOVERY: true
      DISCOVERY_TOPIC: homeassistant/sensor
      DISCOVERY_DEVICE_NAME: TheengsGateway
      DISCOVERY_FILTER: "[IBEACON,GAEN,MS-CDP]"
      SCANNING_MODE: active
      ADAPTER: hci0
    volumes:
      - /var/run/dbus:/var/run/dbus

volumes:
  data_theengsgateway_data:

Thanks, glad to hear. Finally. Will still have to investigate the wmbusmeters-volumes-topic. Am not sure whether I currently have everything backed up correctly. Having three volumes on my end for the same thing makes me kind of nervous. :wink:

Well done, thank you for great tutorial!

My few questions and comments:

  • As I was migrating from instance where I already got influx2 I got stuck as there is no influx2 for armv7. Hopefully Iā€™m on RPi4b 8GB so I just went for 64bit lite version and everything seems to be working
  • Any reason why you are using full paths when mounting to certain services (chronograf, duplicati) instead of volume?
  • BTW it creates potential issue if someone lables the master project differenty (as I did) as the full path has ā€¦/openhab_dataā€¦ hardcoded in
  • also sometimes the timezone is parameter (eg. openhab), sometimes its hardcoded (eg. duplicati, samba)

Youā€™re right, I noticed this as well. The influxDB-part is one of the things that needs some thought going forward, as 1.8 will come to an end sooner or later.

With precision youā€™re pointing to a part which I was always happy about that itā€™s working, but which I solved probably in a not-so-ideal way. :wink: So Iā€™m happy to incorporate any changes or recommendations which you have. Feel free to post what youā€™re running, and Iā€™m happy to replace it above.

Same here. As mentioned in my disclaimer, Iā€™m not a pro. If you let me know how you would solve it, and if it works, Iā€™m happy to edit the instruction above.

Same as above. Happy to incorporate whatever suggestion you have.

Thanks, Iā€™m currently working on the setup, Iā€™ll post the outcome when Iā€™m more happy with the resultsā€¦ Iā€™m still getting some issues (dangling volumes from samba, wrong userids, unaccessible folders), but moving slowly forward as a night-time hobby ;-). Iā€™m not as good as local gurus (hats off, Rich), but also thought of learning (reusing/tailoring) ansible to automate some of the steps to make it easier. If someone needs help sooner, I can try (most things currently work).

1 Like

Couldnā€™t sum it up any better. Started here around two years ago, and still feel somewhat stupid, even though the tutorials that I wrote are probably not that bad. :wink:

Anyway, as soon as you have something, let me know. We could also go ahead and move the entire docker-compose.yml to Github.

I just got a Zigbee device and considered to go the zigbee2mqtt-route. Instead I just installed the Zigbee-Binding, which works like a charm as well.

This is a great setup! Thank you very much!

I have to change it a bit to work for my needs. I like the setup where the persistent data from the dockers is saved in the host file system, like it is done in the openhab/docker-documentation.
I donā€™t need duplicati this way, and also I donā€™t need
But I am struggling to get it right for frontail:

can't open '/var/log/openhab/events.log': No such file or directory
can't open '/var/log/openhab/openhab.log': No such file or directory

I think I should change the location of the logfile to where it is on my host, but how? I changed it like this, but itā€™s not working.

    volumes:
      #- /var/lib/docker/volumes/openhab_data_openhab_userdata/_data:/openhab/userdata:ro
      - /var/lib/docker/volumes/openhab_data_openhab_userdata/_data:/opt/openhab/userdata/logs:ro

And also I wonder how to set this correctly for influxdb and grafana too. Do I have to make users ā€˜influxdbā€™ and ā€˜Graphanaā€™ and set the user-idā€™s just the way it is handled for openhab?

Unfortunately not able to answer your question. Tbh, I was pretty happy to get everything working the way I wanted and put it into this step-by-step (especially on the volumes I have to admit that I have not fully understood this topic), so I hope thereā€™s someone else out there with more basic understanding.

Fixed a small bug in the samba-part that did not allow to write to the shares.

Not a samba-pro. If someone believes thereā€™s a better way, let me know.

This is awesome.

I wish I found it before I struggled getting my Openhabian install moved to docker.

Iā€™m trying to adapt my own version now, which Iā€™ll be happy to share when ready. It will include HABapp as a service dependent on openhab, and frontail pointing at both habapp and openhab logs.

Some questions:
What is the advantage of using docker volumes versus bind volumes? I always preferred being able to log in to the host and easily see all the files, without having to log into the container and/or run weird commands to access docker volumes (which I assume is the process).

What is the best way to specify the log files that Frontail will display?

Also the welteki/frontail-openhab image we are both using is pretty old. I donā€™t think it does the new color formatting that openhabian does. I found this thread trying to figure out how to add that, and then found this more fun to play with, so I need to get back to that.

Lastly, Samba creates a bunch of unnamed volumes which I personally donā€™t enjoy. Iā€™m going to see if I can either consolidate them or point them at a common bind share.

Honest answer: No idea. :wink: Maybe bind volumes are better than docker volumes. As mentioned, Iā€™m not a pro myself, and was quite happy when I got everything running (and learned a ton along the way). Iā€™m sure thereā€™s a better way of doing things than what Iā€™m currently doing.

What do you mean by ā€œspecify the log filesā€?

After I submitted that, I realized that volumes make a container much more portable than when you have it on the filesystem, which is the intent of a system like docker. Not super-relevant in my situation, however.

I use frontail to not just show the OH logs, but also the HABApp logs my environment creates. I thought they would maybe be an environmental variable, but it looks like they are part of the command that docker runs when starting the container, so maybe I need to build a dockerfile that builds on it or there is a way to give this file an updated command to execute at startup.

Like you, Iā€™m learning a lot along the way.