pnxtech / hydra

A light-weight library for building distributed applications such as microservices
https://www.hydramicroservice.com
MIT License
645 stars 54 forks source link

Alternative to IP based services? #97

Closed derrickpelletier closed 6 years ago

derrickpelletier commented 7 years ago

Has it been considered to also support service registry by providing a service host rather than only an IP?

I was interested in using hydra to register services deployed via http://zeit.co/now Unfortunately they are not accessible via IP address, as the hostname is used for routing.

I considered just putting the hostname in the description property but it is pretty hacky. Any better suggestions that I'm just not seeing in the docs?

cjus commented 7 years ago

@derrickpelletier this isn't something we've considered. How would ports work? And multiple instances of a service?

cjus commented 7 years ago

I've heard about now but haven't tried it. I did try to visit the site just now - but looks like there's an issue at the moment.

cursor_and_https___zeit_co_now
derrickpelletier commented 7 years ago

@cjus hah, bad luck. It's up now.

I hadn't considered it much further. I guess I would expect multiple instances to work as unique hostnames? I know at least for now, clustering/scaling is handled on their end.

To what end would ports be necessary? I guess I envisioned using hydra.findService and using the returned service-info to make my requests. Are there other hydra apis that wouldn't be able to handle this?

cjus commented 7 years ago

@derrickpelletier if you're available next week I'd like to discuss over skype. @cjustini34

parweb commented 7 years ago

I'm very interested too ;)

limay commented 7 years ago

Me too.

I made a quick test last week removing "host to IP" functionality from Hydra and using it with domains, and everything was looking good!! I didn't see any problem.

@cjus Is there any reason why Hydra needs only IP?

Thanks

parweb commented 7 years ago

@limay can tou explain a bit more what did you do ?

cjus commented 7 years ago

@limay this idea is really growing on me! @derrickpelletier thanks for raising this opportunity! @limay I don't think so. There's no reason hydra should care whether an IP is used or a DNS entry! Hydra-router shouldn't either - but that's something to test as well.

cjus commented 7 years ago

@derrickpelletier @limay @parweb you can try an experimental release:

Just specify a DNS name in your service config:

    "serviceIP": "cjmac",
cjus commented 7 years ago

@derrickpelletier @limay @parweb hydra-express now supports DNS usage via the new serviceDNS entry. Simply place the DNS name of your service in that field and it will work with external load balancers. I've tested this inside of a docker swarm using the swarm DNS. Can one of you test this in your usecase so I can close this ticket? ;-)

limay commented 7 years ago

@cjus Sorry for the delay! I'm eager to try your solution but I find a second until now. Let me test it and I reply here ASAP. Thanks!

@parweb Sorry! Basically, I bypassed a code that checked if serviceIP is a valid IP and put the url (and it worked fine!) But it doesn't matter anymore because serviceDNS seems a good solution.

derrickpelletier commented 7 years ago

@cjus will try it out this weekend, thanks!

cjus commented 7 years ago

@derrickpelletier @limay @parweb I'd like to close this ticket if possible.