smebberson / docker-alpine

Docker containers running Alpine Linux and s6 for process management. Solid, reliable containers.
MIT License
596 stars 186 forks source link

Support .consul in go-dnsmasq stubzones #31

Closed matthewvalimaki closed 8 years ago

matthewvalimaki commented 8 years ago

Related to #24.

Could we add stubzones support in alpine-consul? According to https://github.com/janeczku/go-dnsmasq Use different nameservers for specific domains domain[,domain]/host[:port] so I'm thinking the following might work for https://github.com/smebberson/docker-alpine/blob/master/alpine-base/root/etc/services.d/resolver/run:

exec go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts --stubzones=.consul/127.0.0.1:8600 >> $GO_DNSMASQ_LOG_FILE 2>&1
smebberson commented 8 years ago

@matthewvalimaki, yeah this looks good. I'm half way through approving and checking #13, post that, we can integrate this for sure. Nice and simple ;)

matthewvalimaki commented 8 years ago

Sweet. I have not looked into this but there was significant delay with response when consul was only nameserver. Perhaps I missed an option, perhaps newer consul doesn't experience that. Something to test :) On Mar 17, 2016 3:55 PM, "Scott Mebberson" notifications@github.com wrote:

@matthewvalimaki https://github.com/matthewvalimaki, yeah this looks good. I'm half way through approving and checking #13 https://github.com/smebberson/docker-alpine/pull/13, post that, we can integrate this for sure. Nice and simple ;)

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/smebberson/docker-alpine/issues/31#issuecomment-198115386

matthewvalimaki commented 8 years ago

Actually I propose we'll introduce ENV CONSUL_DOMAIN=consul to alpine-base which then is used with go-dnsmasq --stubzones=$CONSUL_DOMAIN/127.0.0.1:8600 and consul -domain $CONSUL_DOMAIN. That way it's easy to change it if necessary and no need to write over default /etc/services.d/consul/run.

smebberson commented 8 years ago

@matthewvalimaki, sounds good. I really like that refinement. If you want to implement in PR #34, I'll merge straight away :)

matthewvalimaki commented 8 years ago

@smebberson done. I also updated the ENV styling a bit to be more readable. I also updated go-dnsmasq version to latest while I was touching that spot.

So with this configuration we still default to consul domain and all should work as they used to. But if you want/need to change the domain all one needs to do is re-declare ENV CONSUL_DOMAIN=<my domain>.