-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mDNS support per container #11
Comments
This may not happen so smoothly for a multitude of reasons. There is no clear method of doing this, and running an avahi-daemon inside every container is no longer supported and is outright unsupported/removed as functionality since 2017 as mentioned in this Readme: Avahi now runs on the host os and communicates to guests via Dbus. Though I have been unsuccessful in getting any of the containers pingable at the requested hostname.local, despite the hostos having a process labelled 'requesting $hostname BUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket \
dbus-send \
--system \
--print-reply \
--reply-timeout=2000 \
--type=method_call \
--dest=org.freedesktop.Avahi \
/ \
org.freedesktop.Avahi.Server.SetHostName \
string:"mqtt" All the guides suggest using https://github.com/balena-io-playground/balena-avahi-dbus and https://github.com/balena-io-playground/avahi-zoo-publisher/tree/master/avahi-publisher but I've had little success. Will pick up on this when I'm less tired. |
There's already some kind of internal host name mapping which is how containers communicate with each other. Have you looked at this? There's also a Balena example of how to enable mDNS for containers ? |
@ajlennon I linked to that github page already, it reads: So this is no longer functional, as I've tested and noted. Dbus rejects an in-container avahi-daemon. The Dbus command gets some success, as it tells the host to tell Avahi to register a hostname. But I can't seem to ping it, despite The example python script in this dir is visible on |
This seems to be the go-to utility. But it breaks using alpine since it relies on systemd, and worse means we cannot use other people's images since it uses |
It seems that when we use Wifi-Connect on BalenaOS 2.44+ on a Pi3, all requests for any hostname are redirected to 192.168.42.1 As weird as this is, it somewhat solves the issue we're having temporarily. |
It might be wise to simply have the whole device pingable at After reading this, it implies we need to modify the sd card's boot partition to do any of this, is this true? Can we modify the hostname via the files in the git repo? |
There's an API to modify the hostname yes. All a bit of a faff. I did a post on this - https://forums.balena.io/t/a-hack-to-change-the-device-hostname/6195 |
Each container should either run mDNS via the Avahi-Daemon, or should at the very least have some manner of having mDNS redirected to it. The latter solution does not yet exist, but is something I could potentially write in Python after a bit of reading. My idea for that is that there should be a sort of broker that sits between the applications on the hypervisor that will take all of the container names and masquerade as their hostname. It would then redirect to the relevant internal IP of the container it's meant for, like a webserver would. Though I'm going to try and implement the former first just to get it done.
The text was updated successfully, but these errors were encountered: