Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Support to specify a service-specific IP address #106

Closed
FraBle opened this issue Mar 11, 2016 · 3 comments
Closed

Support to specify a service-specific IP address #106

FraBle opened this issue Mar 11, 2016 · 3 comments

Comments

@FraBle
Copy link

FraBle commented Mar 11, 2016

I'm running several docker containers. One is used for Consul, running server and agent on the same machine. Another one is used for a Java service (Dropwizard) using the Java Docker image. To connect my Java service with Consul, I use dropwizard-consul. It is based on consul-client.

Since the Java container has its own IP address, but does not propagate it to Consul as service address, I don't have a valid service registration.
Consul uses the agents address as fallback, which is wrong in my case.

However, it's possible to specify a service address:

The address field can be used to specify a service-specific IP address. By default, the IP address of the agent is used, and this does not need to be provided.

(duplicate of #28, but it has never been reconsidered yet)

@gjesse
Copy link
Contributor

gjesse commented Mar 11, 2016

You can already do this, though it's a little indirect. Something like

        Registration.RegCheck check = Registration.RegCheck.http("http://check/path", 10);

        Registration registration = ImmutableRegistration
                .builder()
                .port(1234)
                .address("192.168.0.24")
                .check(check)
                .name("name")
                .id("id")
                .addTags("tag", "tag2")
                .build();

        client.agentClient().register(registration);

I think the general use case is that people run the agent locally on the machine, so I'm guessing this is not a very common use case, and therefore probably not worth adding another set of overloaded registration methods to AgentClient

@rickfast
Copy link
Owner

I'm inclined to agree. There's already more register methods than I'd like. Going to close this for now.

@FraBle
Copy link
Author

FraBle commented Mar 14, 2016

I took @gjesse advice and added the missing functionality to smoketurner/dropwizard-consul (Pull Request). Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants