gliderlabs / resolvable

Host-level DNS gateway for Docker
MIT License
315 stars 37 forks source link

Add LOCAL_DOMAIN config from env variable #20

Closed lalyos closed 8 years ago

lalyos commented 8 years ago

With this config, I could mimic for example a multihost consul/registrator setup, by defining node.dc1.consul as LOCAL_DOMAIN

tilgovi commented 8 years ago

When you say "mimic", do you mean you're trying not to run consul and registrator, too?

lalyos commented 8 years ago

Yes I meant that on a single host the containers can "feel" like they are in a multihost consul/registrator environment.

But that just one spefic use case, i also wanted to give the same freedom like consul gives you when it comes to domain name.

tilgovi commented 8 years ago

I'm not sure this makes sense for a project like resolvable. It's not really host-aware. It's a single-host tool until paired with other things. Do you think it's appropriate to treat . as a host unto itself?

If you take your example, .node.dc1.consul points to a node, not a container on a node.

Maybe if we can talk about a use case from the perspective of the application configuration.

To me, it seems like if you want to mimic a consul setup for an application, what you really want is short names to resolve automatically. For that, you could just start containers with --dns=<host ip if resolvable is --net host, otherwise resolvable container ip> --dns-search=docker, no?

lalyos commented 8 years ago

To me, it seems like ... what you really want is short names to resolve automatically.

Yes, but with reverse DNS lookup.

You are right, In most case auto registered short names which are resolvable to an ip is sufficient. But some software (especially in java world) try to figure out the fqdn by the ip address. So I need PTR records.

Surely i can solve the issue with consul + registrator, or maybe the upcoming "docker dns" will be similar. I just wanted to use resolvable, as I prefer to have 1 container instead of 2.

But again even if my use case seems strange, this PR is simply only makes a fixed string configurable by an environment variable.

When I discussed the configurable domain name idee with @progrium, he was even surpised its not already configurable.

tilgovi commented 8 years ago

Looking at #19, I wonder if this actually already works for you if you set the hostname of the container to <name>.node.dc1.consul.

tilgovi commented 8 years ago

I just checked and actually resolvable only adds the short hostname as an alias. If it used the full hostname then I think it would just work from the container config rather than making it a resolvable-wide config.

@progrium whatcha think?

progrium commented 8 years ago

No new thoughts on this one. Perhaps @mgood has some.

lalyos commented 8 years ago

@tilgovi

Looking at #19, I wonder if this actually already works for you if you set the hostname of the container to .node.dc1.consul

Ohhh right! Actually that was implemented in #22, and I just realize that this PR is not needed. So closing this in favor of #22