Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 847 forks source link

Avahi/Zeroconf support #2515

Open tomjn opened 3 years ago

tomjn commented 3 years ago

Sites that use a .local TLD could be advertised using .local.

This would give a way to provide a hostname that can be used on devices that do not support host file modification. For example, when provisioning on a dedicated device such as a raspberry Pi connected to an iOS device.

tomjn commented 3 years ago

This is the puppet config Chassis uses to do it:

https://github.com/humanmade/Chassis/blob/master/puppet/modules/chassis/manifests/hosts.pp

GitHub
Chassis/hosts.pp at master · humanmade/Chassis
📦 Chassis is a virtual server for your WordPress site, built using Vagrant. - Chassis/hosts.pp at master · humanmade/Chassis
tomjn commented 3 years ago

So installing avahi-daemon is enough to get it to expose itself, but it will only expose the machines hostname ( or a different one if we configure it ), and can only do .local TLDs.

If we want multiple TLDs though then we need to take extra steps of wwhcih there are a few options

Useful links:

Server Fault
Configure Zeroconf to broadcast multiple names
I want to broadcast multiple host names on a local network only from a single instance of Ubuntu Server 10 with Zeroconf or something similar. It has to be zeroconf or similar because it's going t...
Haven200
Avahi-Daemon Service
Avahi is a free zero-configuration networking (zeroconf) implementation, including a system formulticast DNS/DNS-SDservice discovery.
Linux Command Library
avahi-publish man | Linux Command Library
avahi-publish linux command man page: Register an mDNS/DNS-SD service or host name or address mapping using the Avahi daemon
Stack Overflow
How to route all subdomains to a single host using mDNS?
I have a development webserver hosting as "myhost.local" which is found using Bonjour/mDNS. The server is running avahi-daemon. The webserver also wants to handle any subdomains of itself. Eg "cat.
pi3g.com
Avahi how to assign several .local names to same IP - pi3g.com
In some situations you would like to access the same computer / IP using different .local names. This is possible using the Avahi daemon. The following is written for Ubuntu 18.04 Bionic Beaver. Install Avahi apt install avahi-daemon avahi-utils Avahi automatically adds your computer’s hostname to the .local Domain. For instance, my computer is called…
tomjn commented 3 years ago

Also, it seems that this won't work on Windows out of the box:

tomjn commented 3 years ago

2515 installs the daemon and exposes the vvv.local default host, it also installs avahi-utils. It doesn't support the other hosts or site hosts though

tomjn commented 3 years ago

for sites, ideally it should pick up any hosts ending in .local and serve them via Avahi. We'll also need the xhgui domain in .local form, and to adjust the dashboard so vvv.local is used instead of vvv.test when loaded on that URL