brutella / hkknx-public

hkknx is a HomeKit KNX bridge for KNX.
https://hochgatterer.me/hkknx
102 stars 6 forks source link

Problems with the docker container #341

Closed lagunenkiter closed 3 weeks ago

lagunenkiter commented 3 weeks ago

Hi,

i struggle with the new Docker Image on my Ubuntu 24 Server. I tried several configurations but I am not able to run the Image without errors.

I have always the folding Error:

Usage of hkknx: --autoupdate Auto updating the app every 24 hours. (default true) --db string Path to database folder --port int Port of the server (default 8080) --verbose Enable verbose logging --version Prints the version number invalid argument "${PORT}" for "--port" flag: strconv.ParseInt: parsing "${PORT}": invalid syntax

I run all my Containers with Portainer and setup an own Stack for HKKNX.

I used the following configuration:

# compose.yaml
services:
  hkknx:
    container_name: "hkknx"
    volumes:
      - /srv/docker/hkknx/db:/db
    hostname: "hkknx"
    image: "brutella/hkknx:3.0.0"
    network_mode: "host"
    # Mapping ports is not needed if "network_mode" is "host".
    ports:
      - "8080:8080/tcp"
    #   - "3671:3671/udp"
    #   - "5353:5353/udp"
    restart: "unless-stopped"

But also try several other configuration with and without the Ports and different Port as well as network_mode.

I have also tried starting directly via Docker to check the Port topic, but unlike with my other containers, I am not able to even start the container (with sudo and without):

@mim:/srv/docker/hkknx$ sudo docker run --volume /srv/docker/hkknx/db:/db --net=host --restart unless-stopped brutella/hkknx:3.0.0 docker: Error response from daemon: error while creating mount source path '/srv/docker/hkknx/db': mkdir /srv/docker: read-only file system. @mim:/srv/docker/hkknx$ sudo docker run --volume ./db:/db --net=host --restart unless-stopped brutella/hkknx:3.0.0 docker: Error response from daemon: error while creating mount source path '/srv/docker/hkknx/db': mkdir /srv/docker: read-only file system.

Das File System ist RW und ich kann auch selber Ordner anlegen.

Hintergrund der ganzen Docker Test ist die Tatsache, dass ich seit dem Upgrade auf Ubuntu 24 nach ein zwei Minuten Betrieb die HomeKit Verbindung verliere und etwas später auch die KNX. Homebridge läuft ohne Probleme im Container.

Viele Grüße

Lagunenkiter

brutella commented 3 weeks ago

The error error while creating mount source path '/srv/docker/hkknx/db': mkdir /srv/docker: read-only file system. means that the directory /srv/docker is read only.

hkknx needs a writeable folder to store persistent data. Either try to make this folder writeable or choose a different folder.

lagunenkiter commented 3 weeks ago

I run all my containers in this folder, which is a mount point for my HDDs. I checked it using the "mount" command, and it is definitely set to RW (read-write). I also changed the folder permissions to allow access for everyone, and I was able to create the folder manually without any issues.

However, I tried running it in my home directory, and it works, but I am still getting the same error as in Portainer:

@mim:~$ sudo docker run --volume ./db:/db --net=host --restart unless-stopped brutella/hkknx:latest

invalid argument "${PORT}" for "--port" flag: strconv.ParseInt: parsing "${PORT}": invalid syntax invalid argument "${PORT}" for "--port" flag: strconv.ParseInt: parsing "${PORT}": invalid syntax Usage of hkknx: --autoupdate Auto updating the app every 24 hours. (default true) --db string Path to database folder --port int Port of the server (default 8080) --verbose Enable verbose logging --version Prints the version number @mim:~$ sudo docker run --volume ./db:/db --net=host --port 8080/tcp --restart unless-stopped brutella/hkknx:latest unknown flag: --port See 'docker run --help'. @mim:~$ sudo docker run --volume ./db:/db --net=host --port=8080/tcp --restart unless-stopped brutella/hkknx:latest unknown flag: --port See 'docker run --help'. i@mim:~$ sudo docker run --volume ./db:/db --net=host --port:8080/tcp --restart unless-stopped brutella/hkknx:latest unknown flag: --port:8080/tcp See 'docker run --help'. @mim:~$ sudo docker run --volume ./db:/db --net=host --port:8080 --restart unless-stopped brutella/hkknx:latest unknown flag: --port:8080 See 'docker run --help'. @mim:~$ sudo docker run --volume ./db:/db --net=host --port 8080 --restart unless-stopped brutella/hkknx:latest unknown flag: --port

brutella commented 3 weeks ago

I've just updated the Dockerfile on https://hub.docker.com/repository/docker/brutella/hkknx. Please try again.

lagunenkiter commented 3 weeks ago

thx for the fast update! The container starts without any problem.

But I have the same problem in with the Container as without the container :(

After around one minute I lose the connection to the Bridge.

INFO 2024/10/03 13:33:32 main.go:182: version 3.0.0 (built at 2024-09-10T16:49:32Z+0200) INFO 2024/10/03 13:33:33 main.go:361: webpage available at port 8080 INFO 2024/10/03 13:33:47 app.go:636: tunnel: connected to 192.168.172.52:3671 (udp) via 1.0.252 2024/10/03 13:33:47 rate limiting: sleep 0s 2024/10/03 13:34:11 discarding message with sequence number 58 (expected 59) 2024/10/03 13:34:20 rate limiting: sleep 0s 2024/10/03 13:34:21 rate limiting: sleep 0s 2024/10/03 13:34:22 discarding message with sequence number 91 (expected 92) 2024/10/03 13:34:22 rate limiting: sleep 0s 2024/10/03 13:34:23 rate limiting: sleep 0s 2024/10/03 13:34:33 discarding message with sequence number 122 (expected 123) 2024/10/03 13:34:46 rate limiting: sleep 0s 2024/10/03 13:34:47 rate limiting: sleep 0s INFO 2024/10/03 13:34:47 netlink_linux.go:30: route ip+net: no such network interface 2024/10/03 13:34:47 discarding message with sequence number 147 (expected 148) 2024/10/03 13:34:48 rate limiting: sleep 0s 2024/10/03 13:34:49 rate limiting: sleep 0s 2024/10/03 13:35:18 discarding message with sequence number 225 (expected 226) 2024/10/03 13:36:53 discarding message with sequence number 148 (expected 149)

I already check the mDNS and activate it also on all my interfaces. Furthermore i run also the Homebridge Container with two Brides without any Problems. For Test Purpose I shutdown the home bridge container and still the same result...

Do you have any idea what could be the problem? I found some Issues regarding Multicast from 2022 but it doesn't solve my problem. I will install the raspberry and check if it will run there... Let's see

With Ubuntu 22.04 I didn't had this problem

brutella commented 3 weeks ago

I will install the raspberry and check if it will run there... Let's see

Yes, please try the latest Raspberry Pi image. https://hochgatterer.me/de/hkknx/docs/install/

brutella commented 3 weeks ago

The problem with lost a connections after some time should be fixed in 3.1.0-b2

lagunenkiter commented 3 weeks ago

I tried it with the Raspberry and it works fine with the backup. So let me test later version 3.1.0-b2.

brutella commented 3 weeks ago

Is this issue now resolved?

lagunenkiter commented 3 weeks ago

It works now on Raspberry, Linux Ubuntu 24.04 and Container (Portainer and Ubuntu 24.04). Thx a lot for your fast help!

For your information, actually it is not possible to change the Port via Compose/Portainer. If I try to change the Port (uncomment the Port Section and only HTTP) I receive the same error like before you fix the Issue relating the container.