Native systemd service that advertises container subdomains via mDNS for HaLOS, and configures the system to resolve multi-label mDNS hostnames.
This package provides two key mDNS capabilities:
-
Publishing: Monitors Docker containers for the
halos.subdomainlabel and usesavahi-publishto advertise the corresponding mDNS records. This enables automatic subdomain resolution for HaLOS services on the local network. -
Resolution: Configures the system to resolve multi-label mDNS hostnames (e.g.,
auth.hostname.local). By default, Debian only resolves single-label.localnames; this package enables full subdomain resolution.
The package is available from the Hat Labs APT repository:
# Add Hat Labs repository (if not already added)
curl -fsSL https://apt.hatlabs.fi/hat-labs-apt-key.asc | sudo gpg --dearmor -o /usr/share/keyrings/hatlabs-apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/hatlabs-apt-key.gpg] https://apt.hatlabs.fi stable main" | sudo tee /etc/apt/sources.list.d/hatlabs.list
# Install the package
sudo apt update
sudo apt install halos-mdns-publisherThe service starts automatically after installation.
Add the halos.subdomain label to containers you want to advertise:
services:
authelia:
image: authelia/authelia:4.39
labels:
- "halos.subdomain=auth" # Advertises auth.<hostname>.local- On startup, scans all running Docker containers for
halos.subdomainlabels - Monitors Docker events for container start/stop
- Uses
avahi-publishto advertise subdomains pointing to the host IP - Cleans up mDNS records when containers stop
- Graceful degradation: waits for Docker if not immediately available
# Check status
sudo systemctl status halos-mdns-publisher
# View logs
sudo journalctl -u halos-mdns-publisher -f
# Restart service
sudo systemctl restart halos-mdns-publisherUsage: halos-mdns-publisher [OPTIONS]
Options:
-s, --socket <SOCKET> Docker socket path [default: /var/run/docker.sock]
-d, --debug Enable debug logging
--health-interval Health check interval in seconds [default: 60]
-h, --help Print help
-V, --version Print version
This package configures the system to resolve multi-label mDNS hostnames by:
- Installing
/etc/mdns.allowto permit resolution of all.localdomain names - Updating
/etc/nsswitch.confto usemdns4instead ofmdns4_minimal
The mdns4_minimal resolver (Debian default) only resolves 2-label hostnames like hostname.local. The mdns4 resolver with mdns.allow enables resolution of multi-label names like auth.hostname.local.
These changes are reverted when the package is purged (apt purge halos-mdns-publisher).
- Avahi daemon (
avahi-daemonpackage) - Avahi utilities (
avahi-utilspackage) - libnss-mdns (
libnss-mdnspackage) - for mDNS name resolution - Docker (recommended but not required at startup)
# Build
./run build
# Run tests
./run test
# Run linting
./run lint
# Install pre-commit hooks
./run hooks-installThis native package replaces the container-based halos-mdns-publisher-container package. The migration is automatic - installing this package will remove the container version.
MIT License - see LICENSE
- HaLOS Distro - HaLOS workspace
- HaLOS Core Containers - Core container definitions