Skip to content

Use Address instead of ServiceAddress? #88

@chy168

Description

@chy168

Hello,

I'm trying to integrate fabio with my own service with Consul.
I found Consul might not return "ServiceAddress" when we don't set service.address in Consul definition.

It might cause proxy error, because fabio now depends on "ServiceAddress" as the dest of traffic.

For example:

Consul definition WITH "address" attribute:

{"service": {"name": "web", "tags": ["urlprefix-/test1"], "address": "172.17.0.4", "port": 8000, "check": {"script": "curl localhost:8000 >/dev/null 2>&1", "interval": "5s"}}}

consul return:

$ curl -XGET http://172.17.0.1:8500/v1/catalog/service/web
[
  {
    "Node": "6453bcec8524",
    "Address": "172.17.0.4",
    "ServiceID": "web",
    "ServiceName": "web",
    "ServiceTags": [
      "urlprefix-/test1"
    ],
    "ServiceAddress": "172.17.0.4",
    "ServicePort": 8000,
    "ServiceEnableTagOverride": false,
    "CreateIndex": 22226,
    "ModifyIndex": 22227
  }
]

Consul definition WITHOUT "address" attribute:

{"service": {"name": "web", "tags": ["urlprefix-/test1"], "port": 8000, "check": {"script": "curl localhost:8000 >/dev/null 2>&1", "interval": "5s"}}}

consul return:

$ curl -XGET http://172.17.0.1:8500/v1/catalog/service/web
[
  {
    "Node": "6453bcec8524",
    "Address": "172.17.0.4",
    "ServiceID": "web",
    "ServiceName": "web",
    "ServiceTags": [
      "urlprefix-/test1"
    ],
    "ServiceAddress": "",
    "ServicePort": 8000,
    "ServiceEnableTagOverride": false,
    "CreateIndex": 22116,
    "ModifyIndex": 22117
  }
]

For non-fixed consul definition file in Docker image, could we just leverage Address instead of ServiceAddress? is that possible?

Please advice! thank you! :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions