You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subdomain, Local DNS support: Don't require hosts file manipulation #416
so far this works very well, sometimes it's a bit tricky on Linux as other systems also change the /etc/resolv.conf but restarting pygmy and with that checking the resolv.conf contents usually fixes that.
The problem with dnsmasq and all similar solutions is that it requires intervention with the workstation of the user, and in fact reconfigures their system. Most users don't appreciate things that do that, and there are almost always unanticipated consequences, and support issues we don't want or need.
I strongly recommend that we move to a legitimate resolvable domain name (like local.drud.com ?) and use wildcard DNS there. That would make it so that any user connected to the internet would immediately have a working DNS lookup and no hosts file manipulation would be required. This approach is outlined in #175. When users did not have DNS (traveling or otherwise disconnected) the traditional hosts file manipulation could be done.
I love the idea of nip.io (and never ever knew about it, thanks!), but
it's complex for people, it has great wildcard mapping, but you have to understand what an IP address is to use it.
It's under somebody else's control and maintenance, so could go away in a moment (or malfunction) and we'd have absolutely no recourse.
As far as docker host not running on localhost: We only support (currently) docker-for-mac and docker-for-windows, which are innately on the same machine. Linux could conceivably bite us, but we really don't have any plans to do anything more exotic than a local docker server. (I did originally test older docker versions for Windows, and was able to make them work, but we didn't ever see a need to support docker-machine and friends.)
but you have to understand what an IP address is to use it.
why? we assume it's 127.0.0.1 anyway always?
It's under somebody else's control and maintenance, so could go away in a moment (or malfunction) and we'd have absolutely no recourse.
correct, but do you feel ready to create a DNS infrastructure that can handle *.local.drud.com, what do you do if other people decide to use that? Running DNS is not thaaat easy.
nip.io only returns 127.0.0.1 if you use *.127.0.0.1.nip.io, as I read it. That means people need to use a long hostname, and it has funny numbers in it.
I was just talking about creating a wildcard record on our DNS for drud.com (or another domain). Not setting any infrastructure up.
Responding to "let localhost be localhost", thanks for that link. AFAICT, that's about the localhost names (localhost, .localhost, etc). We're not using those anywhere or in any way, just the reserved address 127.0.0.1. Maybe I misunderstood your intent with that.
I was just talking about creating a wildcard record on our DNS for drud.com (or another domain).
I think a wildcard itself will not be enough, you would need an ORIGIN directive so foo.bar.local.drud.com will also be resolved.
Not setting any infrastructure up.
Just saying, having thousand of users all over the world using .local.drud.com will put a tiny bit load on your DNS servers :), that's for example the problem with xip.io which struggled over time quite hard with too many requests and with that made people very sad because suddenly their local development environment did not work anymore.
Along with #415, I think we may need to get on a call with all 3 of us because this doesn't feel like we're in sync and this might just be a quicker item to resolve with additional clarity.
While we didn't quite get to a public DNS lookup first before modifying /etc/hosts, we do have FQDN support, which allows both the change of naming convention as well as the ability to use public DNS records that point back. To that end, I'm suggesting we close this thread. Conversations regarding switching the default TLD pattern was discussed here and can be re-opened. The desire to default to public DNS with /etc/hosts as a fallback is still on the table, but I'm wondering if the FQDN support already makes enough inroads towards this.
Actually, in re-reading my notes I think I vote to keep this open because we still want to address the change from *.ddev.local to *.ddev.site, which would be a prerequisite to switching out the default behavior if we proceed.
Activity
Schnitzel commentedon Jul 20, 2017
Here some links how we do it at amazee.io:
Basically we create a dnsmasq container that listens on port 53 on the host that just returns
127.0.0.1for any request with the domain*.docker.amazee.io:https://github.com/amazeeio/cachalot/blob/master/cli/amazeeio_cachalot/dnsmasq.rb
OS X has resolv.conf settings per domain, so we just set one for docker.amazee.io that then defines a nameserver to be 127.0.0.0:53:
https://github.com/amazeeio/cachalot/blob/master/cli/amazeeio_cachalot/resolver.rb
Linux has no nameservers per domain, so we just add ourselves to the /etc/resolv.conf, our nameserver will not return any requests other than
docker.amazee.ioso the system will just use the next nameserver in line, which is the one defined via DHCPhttps://github.com/amazeeio/pygmy/blob/master/lib/pygmy/resolv.rb#L46
on the haproxy side, we have not a full matching to the incoming domain, but match also subdomains:
https://github.com/amazeeio/docker-haproxy/blob/master/haproxy.tmpl#L40
so far this works very well, sometimes it's a bit tricky on Linux as other systems also change the /etc/resolv.conf but restarting pygmy and with that checking the resolv.conf contents usually fixes that.
rfay commentedon Sep 22, 2017
The problem with dnsmasq and all similar solutions is that it requires intervention with the workstation of the user, and in fact reconfigures their system. Most users don't appreciate things that do that, and there are almost always unanticipated consequences, and support issues we don't want or need.
I strongly recommend that we move to a legitimate resolvable domain name (like local.drud.com ?) and use wildcard DNS there. That would make it so that any user connected to the internet would immediately have a working DNS lookup and no hosts file manipulation would be required. This approach is outlined in #175. When users did not have DNS (traveling or otherwise disconnected) the traditional hosts file manipulation could be done.
[-]Subdomain, Local DNS support[/-][+]Subdomain, Local DNS support: Don't require hosts file manipulation[/+]Schnitzel commentedon Sep 22, 2017
and how do you know the IP that should be resolved to? Just assume that it is localhost always?
rfay commentedon Sep 22, 2017
Yes, it would resolve to 127.0.0.1, so in the example, *.local.drud.com would resolve to 127.0.0.1
Schnitzel commentedon Sep 22, 2017
then I would suggest to use nip.io and not invent something new :)
Schnitzel commentedon Sep 22, 2017
the only problem: what if the docker host is not running on localhost?
rfay commentedon Sep 22, 2017
I love the idea of nip.io (and never ever knew about it, thanks!), but
As far as docker host not running on localhost: We only support (currently) docker-for-mac and docker-for-windows, which are innately on the same machine. Linux could conceivably bite us, but we really don't have any plans to do anything more exotic than a local docker server. (I did originally test older docker versions for Windows, and was able to make them work, but we didn't ever see a need to support docker-machine and friends.)
Schnitzel commentedon Sep 22, 2017
why? we assume it's
127.0.0.1anyway always?correct, but do you feel ready to create a DNS infrastructure that can handle
*.local.drud.com, what do you do if other people decide to use that? Running DNS is not thaaat easy.the best would probably be https://tools.ietf.org/html/draft-west-let-localhost-be-localhost-06 but this will take a bit.
rfay commentedon Sep 22, 2017
rfay commentedon Sep 22, 2017
Responding to "let localhost be localhost", thanks for that link. AFAICT, that's about the localhost names (localhost, .localhost, etc). We're not using those anywhere or in any way, just the reserved address 127.0.0.1. Maybe I misunderstood your intent with that.
Schnitzel commentedon Sep 23, 2017
I think a wildcard itself will not be enough, you would need an
ORIGINdirective sofoo.bar.local.drud.comwill also be resolved.Just saying, having thousand of users all over the world using
.local.drud.comwill put a tiny bit load on your DNS servers :), that's for example the problem withxip.iowhich struggled over time quite hard with too many requests and with that made people very sad because suddenly their local development environment did not work anymore.rickmanelius commentedon Oct 2, 2017
Along with #415, I think we may need to get on a call with all 3 of us because this doesn't feel like we're in sync and this might just be a quicker item to resolve with additional clarity.
45 remaining items
rfay commentedon May 21, 2018
@wizonesolutions points out this article on not using .local - https://miketelahun.wordpress.com/2012/09/16/stop-using-local-as-the-top-level-domain-for-your-lan/
SqyD commentedon Jun 20, 2018
May I suggest an alternative approach, which I used for the drupaltrainingday event (in dutch, sorry):
This will avoid hostfile mods, doesn't require any elevated permissions and would allow the use of any domain without adding any services or overhead.
rickmanelius commentedon Jul 23, 2018
While we didn't quite get to a public DNS lookup first before modifying /etc/hosts, we do have FQDN support, which allows both the change of naming convention as well as the ability to use public DNS records that point back. To that end, I'm suggesting we close this thread. Conversations regarding switching the default TLD pattern was discussed here and can be re-opened. The desire to default to public DNS with /etc/hosts as a fallback is still on the table, but I'm wondering if the FQDN support already makes enough inroads towards this.
rickmanelius commentedon Jul 23, 2018
Actually, in re-reading my notes I think I vote to keep this open because we still want to address the change from *.ddev.local to *.ddev.site, which would be a prerequisite to switching out the default behavior if we proceed.
rfay commentedon Oct 23, 2018
From https://letsencrypt.org/docs/certificates-for-localhost/
rfay commentedon May 15, 2019
Now that we have mkcert for trusted local https, it's not important to have a "real" certificate. That means we have plenty of flexibility here.
A simple option is to