Skip to content

Conversation

@samber
Copy link
Contributor

@samber samber commented Apr 8, 2016

  • setting unique backend name
  • backend redirecting to internal container ip

see #275

Caution: Breaking (see issue)

@emilevauge
Copy link
Member

Thanks @samber !
Could you rebase to the master?
Other than that, LGTM :)

@samber samber force-pushed the TRAEFIK-275-consul-catalog-backend-using-container-internal-ip branch from ce1fe2c to 4f044cf Compare April 13, 2016 06:06
@samber
Copy link
Contributor Author

samber commented Apr 13, 2016

Done ;-)

@vdemeester
Copy link
Contributor

LGTM 🐰

@vdemeester vdemeester merged commit 2bcc5a2 into traefik:master Apr 13, 2016
@keis
Copy link

keis commented Apr 14, 2016

Trying this out after fixing the service address I'm registering but I'm getting issues from some of the static configured services we have in consul. Configured by json files in the consul directory where we don't set the ip because it's optional and would be discovered at runtime. The health route returns the service address as empty string but querying these through the consul dns returns the node ip.

I think the node address should be used as a fallback to match what consul itself does. Oh, and now it even fails to do anything because a name collision in backend names when the service address is empty.

@samber
Copy link
Contributor Author

samber commented Apr 14, 2016

There is no unique id in Consul, maybe shall we set a random id or put an index at the end of the service name ? (ex: web-80-1, api-443-2, nginx-80-3...)

IMO, Traefik shouldn't retrieve these services without valid ip. In your json file, can you declare the service as unhealthy ?

@keis
Copy link

keis commented Apr 14, 2016

I'm not sure it's really invalid though because according to documentation the field is optional https://www.consul.io/docs/agent/services.html

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. The port field can be used as well to make a service-oriented architecture simpler to configure; this way, the address and port of a service can be discovered.

@emilevauge
Copy link
Member

emilevauge commented Apr 14, 2016

Indeed: there is an issue with backend names: #309

@samber
Copy link
Contributor Author

samber commented Apr 15, 2016

Mmmh, ok let's do that.

I don't know your needs, but i think the best practice in that case would be to register your service in consul with a Status to warning or critical: https://www.consul.io/docs/agent/http/catalog.html#catalog_register

@keis
Copy link

keis commented Apr 15, 2016

Sorry. Let me try to explain my scenario a bit better. It's not the case of unhealthy service at all.

We have some services that are deployed as plain old rpm and runs directly on the host without any container or network isolation. We register these into consul with static json configurations we don't specify the service address because we are perfectly fine using the same as the agent running on the same host.

e.g

/etc/consul/services.json

{
  "services": [
    {
      "name": "marathon",
      "tags": [
        "marathon",
        "scheduler"
      ],
      "port": 8080,
      "checks": [
        {
          "script": "curl http://localhost:8080/ui/#/apps >/dev/null 2>&1",
          "interval": "15s"
        }
      ]
    }
  ]
}

@samber
Copy link
Contributor Author

samber commented Apr 15, 2016

Ok, thanks @keis
I see the use case ;-)

@ldez ldez changed the title feat(consul-catalog-provider): + setting unique backend name + backendd redirecting to internal container ip Setting unique backend name + backend redirecting to internal container ip Oct 1, 2017
@ldez ldez added the kind/enhancement a new or improved feature. label Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants