Skip to content

graugans/traefik-avahi-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub tag (with filter) The Apache-2 License Build Status

Introduction

When using the reverse proxy Træfik in a local setup one may have the need to create a custom Avahi CNAME like traefik.local automatically when a container is created and routed by traefik. This lightweight helper container provides a Go binary which handles the communication to both the Docker daemon and the avahi daemon.

Motivation

At home I assume most of the people have some sort of a broadband router which handles DHCP and DNS. If you are like me and do not want to mess around with DNS and run your own DNS server inside your home network than mDNS or zeroconf may come handy.

When working with the reverse Proxy Træfik most of the configuration options can be performed by Docker Labels, why not automatically register the mDNS entries based on those labels.

There is a great article by Andrew Dupont about why and how to announce mDNS addresses.

Alternatives

There are a couple of alternatives to this approach

  • go-avahi-cname, the idea of this project is to register specific CNAMEs or subdomains based on a Full Qualified Domain Name (fqdn). This comes handy when you are looking for *.<anyname>.local. In this case no access to the Docker socket is required only access to the DBus socket.

  • hardillb/traefik-avahi-helper, this is basically the same approach as this project. It uses a NodeJS and Python mix to achieve the goal.

Project status

This is a WIP so please do not expect a working solution.

Usage

The intended use case is to run the Docker Container and provide both the Docker socket and the DBus socket to this container.

  • /var/run/docker.sock, is the default Docker socket. This can be overwritten with the Environment variable "DOCKER_HOST": "unix:///var/run/docker-host.sock"
  • /var/run/dbus/system_bus_socket, is the default System DBus socket.

Configuration

The only configuration parameter for the traefik-avahi-helper is the environment variable CNAME_TTL with a default of 600.

LICENSE

This software is released under the Apache-2 license. See the LICENSE file for details. Some of the resources are released under the MIT License. Please check the related files.