brutella / hkknx-public

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

Provide and support a docker image #52

Open brutella opened 4 years ago

BugRoger commented 4 years ago

I'm running hkknx in Kubernetes and Docker. Feel free to help yourself here: https://github.com/BugRoger/dockerfiles/tree/master/hkknx https://hub.docker.com/r/bugroger/hkknx/tags

It's a multi-arch image that works on both arm and amd64. It's quite minimal with being only 13mb big.

There's a bit of magic to make the arguments configurable via ENV variables. That's easy enough to remove if you don't like that.

Zinski commented 3 years ago

So I am running this docker image now on my pi4 but I am not able to connect to my KNX-interface. it just says that the gateway isn't reachable. The check for the bridge state gives "bridge not yet reachable".

@BugRoger maybe its possible that you add some documentation on how to deploy the image in docker? how to persist and how to enable the container to reach the gateway if there is any tweak for that

Any idea why?

BugRoger commented 3 years ago

it just says that the gateway isn't reachable.

Sounds like you have general network problems. First try that you can actually reach the gateway from your rpi. Something like: telnet 192.168.0.185 3671

If that works, check if rpi and gateway are they on the same subnet. If not the auto-discovery will not work. You then need to manually configure the IP of your gateway. Do you maybe have cable and wifi connected same time? I faintly remember a problem when HKKNX is bound to multiple interfaces.

If that is all good, put the container in host network mode:

docker run --rm -d --network host --env VERBOSE=true --port 8080 --name hkknx bugroger/hkknx:latest

Do you use a MDT IP Router? I couldn't get mine to work.

The check for the bridge state gives "bridge not yet reachable".

That is odd. Anything in the Docker log when VERBOSE is turned on?

Zinski commented 3 years ago

Thanks for the reply.

Telnet works from within the container. Everything is wired and in the same subnet. the pi itself can ping and telnet into the gateway.

Indeed I am using an MDT Interface. Is that the problem???

EDIT: Do you think it's worth trying it with knxd? Although I am not a fan of that.

EDIT 2: I am also not able to add the bridge in homekit. So this communication is also blocked. I am using portainer to maintain my containers on my pi, the container isn't reachable if I set the network to host. Maybe I am missing something here?

BugRoger commented 3 years ago

Indeed I am using an MDT Interface. Is that the problem???

Could be. What does the log say? I had panics (crashes) like this:

2020/09/12 10:21:46 sequence number one less than expected
panic: send on closed channel

goroutine 53 [running]:
github.com/brutella/knx/knxnet.(*link).publishMsg(0xc0000fdc00, 0xffb900, 0xc000156180)
    /Users/mah/Source/Code/Go/src/github.com/brutella/knx/knxnet/link.go:221 +0x4d
created by github.com/brutella/knx/knxnet.(*link).GroupRead
    /Users/mah/Source/Code/Go/src/github.com/brutella/knx/knxnet/link.go:208 +0x149
panic: send on closed channel

goroutine 64 [running]:
github.com/brutella/knx/knxnet.(*link).publishMsg(0xc0000fdc00, 0xffb900, 0xc000156700)
    /Users/mah/Source/Code/Go/src/github.com/brutella/knx/knxnet/link.go:221 +0x4d
created by github.com/brutella/knx/knxnet.(*link).GroupRead
    /Users/mah/Source/Code/Go/src/github.com/brutella/knx/knxnet/link.go:208 +0x149

I think, this is due to some bug in the MDT gateway or the knxnet library. As I had another gateway that worked I didn't explorer that further. knxd could work.

I am also not able to add the bridge in homekit. So this communication is also blocked. I am using portainer to maintain my containers on my pi, the container isn't reachable if I set the network to host. Maybe I am missing something here?

I'm not super familiar with Portainer. I would suppose that selecting the host network and publishing all ports will make hkknx available on port 8080 on the rpi's IP. Add VERBOSE=true in the ENV section and check the logs.

Zinski commented 3 years ago
DEBUG 2020/11/19 12:47:12 main.go:147: app: dial gateway: no route to 192.168.178.9:3671; retrying in 5s,
DEBUG 2020/11/19 12:47:27 main.go:147: app: dial gateway: no route to 192.168.178.9:3671; retrying in 5s,
DEBUG 2020/11/19 12:47:42 main.go:147: app: dial gateway: no route to 192.168.178.9:3671; retrying in 5s,

these are the logs on a bridge network, on a host network the container isn't available, i cant reach it, neither with it's FQDN nor by ip

EDIT: my bad, sorry! got it to work with my MDT interface and the host network. I haven't changed the port from 8080 to 8090, as I was mapping this port due to 8080 being used by homebridge.

Joeknx commented 3 years ago

@BugRoger thanks for the Docker-Image. It is still on 1.1.0. Can I update within the Container? I heard, that this is not the best way.

thorsten-gehrig commented 3 years ago

Hi i´m also looking vor 1.1.2 image... any chance to get an update? Best Thorsten

BugRoger commented 3 years ago

I pushed an update to the burgoger:hkknx image in 1.1.2 and 1.2.0. Thanks for the ping. I didn't notice the update. Enjoy!

Joeknx commented 3 years ago

Hey @BugRoger could you update your Docker image to the latest 1.2.0 final? It was beta before. Thanks a lot!

thorsten-gehrig commented 3 years ago

+1

BugRoger commented 3 years ago

I don't quite follow. The bugroger/hkknx:1.2.0 image is using the latest release 1.2.0 (2021-01-29T13:13:41+01:00).

As far as I can see that corresponds to the latest release here in Github.

brutella commented 3 years ago

The latest build for version 1.2.0 is 1.2.0 (2021-03-10T12:54:28+01:00).

BugRoger commented 3 years ago

Ok, where do I get it from? The last release here in Github is from 2021-01-27.

BugRoger commented 3 years ago

Ah, you replaced the assets on the release. I just rebuilt the image.

If you have been running that image before you need to do a docker pull bugroger/hkknx:1.2.0 to bust the Docker cache. Better use bugroger/hkknx:1.2.0-202103161235 to avoid confusion.

brutella commented 3 years ago

Ah, you replaced the assets on the release. I just rebuilt the image.

Correct. As long as the version is marked as pre-release, I just upload new builds. Once the version is final, the assets don't change anymore.

Joeknx commented 3 years ago

Perfect. Thx!

BugRoger commented 3 years ago

1.3.0(-pre) is available now

Joeknx commented 3 years ago

1.3.0(-pre) is available now

1.3.0 final is out now. Thx in advance!

Zinski commented 3 years ago

@BugRoger maybe its possible that you add some documentation on how to deploy the image in docker? how to persist and how to enable the container to reach the gateway if there is any tweak for that

@BugRoger is it possible to share some information about persistence?

Joeknx commented 3 years ago

push

Joeknx commented 3 years ago

@BugRoger 1.3.1 is out 😬

BugRoger commented 3 years ago

Pushed 1.3.1 and 2.0.0(-pre)

@BugRoger is it possible to share some information about persistence?

There's nothing much to it. hkknx writes to /db by default. You have to pass a volume from the host into the container docker run -v /home/zinski/hkknx:/db ...

See: https://hochgatterer.me/de/hkknx/docs/install/rpi-cli/#installation

andreasgapsch commented 3 years ago

Will there be an official support be panned, that we could run it on Synology or QNAP NAs?

BugRoger commented 2 years ago

docker.io/bugroger/hkknx:2.0.1 pushed

Joeknx commented 2 years ago

I'd love to see the new releases. Thx!

curana commented 2 years ago

Is there a full description on how to set up hkknx with Docker?

I found the image but it doesn't work for me on a RPi. Would be great if there would be a documentation somewhere on how to set it up, which ports to handle etc.

Error message is : "standard_init_linux.go:228: exec user process caused: exec format error"

Could just be a comment on hub.docker.com. Would be great.

Thanks!

BugRoger commented 2 years ago

Pushed bugroger/hkknx:2.1.0 and bugroger/hkknx:2.1.1.

@curana You are trying to start a non-ARM binary. Is this using the bugroger/hkknx:2.1.0 image? Docker automatically picks the right architecture. Don't pass any entrypoint parameters

curana commented 2 years ago

Yes, using your image. I just followed the comments above and didnt provide any parameters. Thats why I thought you could maybe add like basic steps for your image.

BugRoger commented 2 years ago

Try bugroger/hkknx:2.1.0 including the version. The latest image somehow is not including the ARM layers

curana commented 2 years ago

Try bugroger/hkknx:2.1.0 including the version. The latest image somehow is not including the ARM layers

That fixed it for me. Thanks.

BugRoger commented 2 years ago

Pushed bugroger/hkknx:2.2.0

Joeknx commented 2 years ago

2.3.1 is out. Thanks in advance!

mbrockeu commented 2 years ago

If somebody needs the current versions, I provided them, based on the scripts above, on https://hub.docker.com/r/mbrockeu/hkknx/tags for arm64

SvenBunge commented 1 year ago

@mbrockeu : If you could also build for amd64 or @BugRoger update his docker image to 2.4 it would really help me to install the actual version on my synology nas. Thx alot!

mbrockeu commented 1 year ago

@SvenBunge in my package the following platforms are currently defined:

--platform linux/amd64,linux/arm,linux/arm64

So it should work?

BugRoger commented 1 year ago

Pushed 2.4.1. It's time for a Github Action that automates this... I'll take a stab at it in the next days

BugRoger commented 1 year ago

There's now a Github Action that automated the release of the bugroger:hkknx Docker image. New releases will automatically be published once per day

https://github.com/BugRoger/dockerfiles/blob/master/.github/workflows/hkknx-image.yml

Joeknx commented 1 year ago

Great work! Thank you!

mbrockeu commented 1 year ago

There's now a Github Action that automated the release of the bugroger:hkknx Docker image. New releases will automatically be published once per day

https://github.com/BugRoger/dockerfiles/blob/master/.github/workflows/hkknx-image.yml

Could you also provide an image for arm64v8? :-)

thanks

BugRoger commented 1 year ago

Could you also provide an image for arm64v8? :-)

Yes. Just added linux/arm/v8. The bugroger/hkknx:2.4.1 image comes with all 3 platforms now.

SvenBunge commented 1 year ago

There's now a Github Action that automated the release of the bugroger:hkknx Docker image. New releases will automatically be published once per day

arm64: Thanks. I'll try it out! Regarding github action: Perfect idea. Had the same today and just checked this thread before starting the configuration my myself.

jhuber commented 1 year ago

Any chance for an Unraid Docker Image? Would be fantastic to see hkknx integrated into the Unraid Community Apps.

thorsten-gehrig commented 1 year ago

Hi it´s easy to add the existing docker image to unraid... i´m using this since >1 year! Best Thorsten

mbrockeu commented 1 year ago

There's now a Github Action that automated the release of the bugroger:hkknx Docker image. New releases will automatically be published once per day

https://github.com/BugRoger/dockerfiles/blob/master/.github/workflows/hkknx-image.yml

There's now a Github Action that automated the release of the bugroger:hkknx Docker image. New releases will automatically be published once per day

https://github.com/BugRoger/dockerfiles/blob/master/.github/workflows/hkknx-image.yml

Hi, maybe the action doesn't work? The latest image is still b4.

coolbox13 commented 1 year ago

This compose.yaml works for me. Set the bridge port fixed to 51827. compose.yaml.zip

mirkolenz commented 1 year ago

After using a custom Dockerfile and local build pipeline for a while, I finally had the time to develop an automated pipeline for publishing a HKKNX docker image:

https://github.com/mirkolenz/hkknx-container

The image is built every night for the latest and beta releases of HKKNX. The containers are available for arm64 and amd64. The image is built from scratch and thus only contains the required binaries, meaning the container has the same size as the HKKNX binary itself. Another consequence is that the containers have no built-in shell, leading to better security. The CLI parameters can be set by overriding the Docker command.

Here is an exemplary compose definition:

services:
  hkknx:
    image: ghcr.io/mirkolenz/hkknx-container:latest
    restart: unless-stopped
    network_mode: host
    volumes:
      - ./hkknx:/db

Please let me know if you run into any issues with this image.

jalouxx commented 1 year ago

I am using the Raspberry image of hkknx and that worked well. Due to some hardware consolidation I would love to migrate my setup to a container image. Luckily I've found the image from @BugRoger but it seems like I am holding it wrong since it cannot access the gateway no route.

INFO 2023/07/29 08:53:37 main.go:79: version 2.6.0 (built at 2023-03-20T12:16:05Z+0100)
INFO 2023/07/29 08:53:37 main.go:221: webpage available at port 8080
DEBUG 2023/07/29 08:53:47 app.go:340: dial gateway: no route to 192.168.137.196:3671

What I have checked so far:

My container runtime is podman, running with ubuntu on an odroid M1.

@brutella is there any (linux) command I could run to troubleshoot the connection? Like whatever hkknx is using to verify that the gateway is accessible.

brutella commented 1 year ago

Please check if your network configuration meets the requirements → https://hochgatterer.me/de/hkknx/docs/config/knx-connection/