Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Provide alternative service resolution mechanism besides mdns #3256

Closed
wcs1only opened this issue Jun 2, 2021 · 37 comments · Fixed by #7038
Closed

[Proposal] Provide alternative service resolution mechanism besides mdns #3256

wcs1only opened this issue Jun 2, 2021 · 37 comments · Fixed by #7038

Comments

@wcs1only
Copy link
Contributor

wcs1only commented Jun 2, 2021

In what area(s)?

/area runtime

Describe the feature

We commonly get reports that service invocation does not work with dapr standalone mode:
#2665
dapr/quickstarts#361
dapr/quickstarts#388
dapr/quickstarts#399 (May also be a general failure to start daprd?)
dapr/python-sdk#146
... and a bunch more across various SDKs/docs repos

We've root caused most of these to security/VPN configurations blocking mdns requests. The fix varies heavily based on which OS/security software the user is using. It would be lovely to have a generic solution to this, either by falling back to another service discovery mechanism if mdns doesn't work, or replacing mdns outright with something else.

Release Note

RELEASE NOTE:

@wcs1only wcs1only changed the title Provide alternative service discovery mechanism besides mdns Provide alternative service resolution mechanism besides mdns Jun 2, 2021
@yaron2
Copy link
Member

yaron2 commented Jun 3, 2021

We can point users to use Consul in self hosted mode.

Alternatively, if we find another cross machine self discovery mechanism that doesnt involve an external agent (as this is already provided with Consul) we can consider that.

@greenie-msft greenie-msft added this to Backlog in Dapr Roadmap Jun 3, 2021
@wcs1only
Copy link
Contributor Author

wcs1only commented Jun 8, 2021

We can point users to use Consul in self hosted mode.

Alternatively, if we find another cross machine self discovery mechanism that doesnt involve an external agent (as this is already provided with Consul) we can consider that.

I'm hoping for a solution a little more out of the box than "point users to this." This seems to be tripping up users on the quickstart hello-world path, and the last thing I'd want to do is introduce another thing to install/understand before getting started.

@greenie-msft greenie-msft moved this from Planned (Committed) to Backlog in Dapr Roadmap Jun 15, 2021
@wcs1only wcs1only changed the title Provide alternative service resolution mechanism besides mdns [Proposal] Provide alternative service resolution mechanism besides mdns Jun 16, 2021
@greenie-msft greenie-msft removed this from Backlog in Dapr Roadmap Jun 17, 2021
@dapr-bot
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@dapr-bot dapr-bot added the stale Issues and PRs without response label Jul 16, 2021
@dapr-bot
Copy link
Collaborator

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@markheath
Copy link

It would be really nice for there to be a simple alternative for self-hosted systems where this is an issue. There is something with our corporate network that is blocking service to service invocation. Every time I think I've worked out how to work around it, it comes back. I can imagine this could be a very frustrating issue for people trying out Dapr for the first time.

@artursouza artursouza added pinned and removed stale Issues and PRs without response labels Aug 23, 2021
@artursouza artursouza reopened this Aug 23, 2021
@artursouza artursouza added this to the v1.5 milestone Sep 13, 2021
@artursouza artursouza added this to Backlog in Dapr Roadmap via automation Sep 13, 2021
@artursouza artursouza moved this from Backlog to Planned (Committed) in Dapr Roadmap Sep 13, 2021
@artursouza
Copy link
Member

@mukundansundar Any idea on this?

@pkedy
Copy link
Member

pkedy commented Sep 28, 2021

Here are a few thoughts from an offline conversation:

Yes, Consul would absolutely work, but is another container that the CLI would have to install.

An alternative is to add "Consul lite" functionality to the placement service. This could range anywhere from a "local only mode" which holds a simple in-memory lookup table to a fully distributed/replicated lookup table via Raft. The placement service already handles replicating the actors placement table. In theory, adding general service addresses could make use of existing infra/replication code. One could ask "are you just recreating Consul"? Yeah sort of. That aside, assuming the goals are 1) lightweight/no additional installation footprint, 2) satisfies Dapr service invocation without the pitfalls of mDNS and potentially 3) operate in a distributed setup, then this approach could make sense.

/cc @artursouza

@wcs1only
Copy link
Contributor Author

wcs1only commented Sep 28, 2021

Could we have a local resolver component that is just a flat file in ~/.dapr/ ?

@wcs1only
Copy link
Contributor Author

Alternatively, we could do whatever dapr list is doing.

@pkedy
Copy link
Member

pkedy commented Sep 28, 2021

dapr list and the VS Code plugin both look at the running processes to discover app-id and ports. If we don't really need a distributed option, this makes a ton of sense and the code/logic already exists in the CLI.

@yaron2
Copy link
Member

yaron2 commented Sep 29, 2021

I don't support expanding the placement service to provide service discovery, although I am guilty of suggesting the same in the past. Assigning extra responsibilities for a component that is targeted at placing actors just because it's the nearest neighbor isn't something I can advocate for.

I do support creating a local name resolution component that's explicitly clear about providing dev/single-box discovery.

Using it would be as simple as configuring the following:

apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
  name: appconfig
spec:
  nameResolution:
    component: "local"

The CLI could be configured to register the local component by default.

@mukundansundar
Copy link
Contributor

For the local component, we could replicate similar logic to Consul but have it in a datastore for example Redis. Since we are already using Redis as a state store an an actor store we can use it for service resolution also I think. This way a service can self register on Init and perform GET requests on ResolveID calls.

The potential issue in this is in the slim mode the fallback will still be mDNS or Redis needs to be stood up separately and used for service discovery.

One more concern is deregistration of the service once it is shutdown . Currently we do not have a onShutdown handle regarding name resolution for deregistration ...

One option is extend the name resolution interface to handle onShutdown ... This will help with the current Consul component also.
The other option is to make use of Redis TTL for the keys and have the service periodically refresh the associated registration if possIble.

@pkedy
Copy link
Member

pkedy commented Sep 29, 2021

@mukundansundar @yaron2 any concerns with using the dapr list approach? It would work in slim mode as well.

@yaron2
Copy link
Member

yaron2 commented Sep 29, 2021

I do not support using Redis or any state store for service discovery purposes as that would create a tight coupling between a state store and a name resolution component.

@pkedy I'm fine with a file based approach or whatever dapr list does.

@dapr-bot
Copy link
Collaborator

dapr-bot commented Sep 30, 2021 via email

@jjcollinge
Copy link
Contributor

jjcollinge commented Feb 4, 2022

@wcs1only would using Gossip directly be a viable alternative to mDNS? I think based on this article even Consul uses Gossip under the hood for membership and there's other projects in this space such as https://github.com/newrelic/sidecar.

@safari137
Copy link

This may already be covered by another issue, but a work around for me works as follows:

  1. Disconnect from VPN (Cisco AnyConnect in my case)
  2. Start the apps with Dapr
  3. Re-connect to VPN

This is pretty painful in development as I do restart the apps often as I make changes. If my application didn't have to access the corporate network, that wouldn't be a big deal though.

I'm going to work on running dapr on WSL/ubuntu since I could at least script the startup/shutdown of the apps and vpn.

@safari137
Copy link

I have confirmed that if I use openconnect in WSL and run my apps in WSL, I can run everything without issue.

That does prevent me from using VPN on the host, or at least requires me to start/stop vpn, but I can work around that at least.

@addjuarez
Copy link
Contributor

@MrCliff
Copy link

MrCliff commented Jun 21, 2023

Configuring the name resolver to resolve only dapr sidecars on local computer would be much needed feature for us. We have quite opposite issues with dapr in development but this should fix them too. When developing in office environment where mDNS is allowed, Dapr resolves to services on other developers' computers. This is because mDNS packets are thrown to the same network which other computers can see.

We have tried blocking inbound mDNS packets on Windows Firewall but somehow they don't get blocked at all. If blocking outbound mDNS, the name resolution stops working completely.

Do you have some estimate when this will be implemented? Currently this pretty much blocks us from using dapr in local development.

@MrCliff
Copy link

MrCliff commented Jul 31, 2023

We found a solution for our issues which is to use Consul. However, the guide on Dapr docs doesn't give simple and complete example how to use Consul as name resolver in local environment. Thankfully I found this great article that contains simple enough instructions for that. You could include such an example on the Dapr Docs Consul page.

@xckai
Copy link

xckai commented Aug 9, 2023

We found a solution for our issues which is to use Consul. However, the guide on Dapr docs doesn't give simple and complete example how to use Consul as name resolver in local environment. Thankfully I found this great article that contains simple enough instructions for that. You could include such an example on the Dapr Docs Consul page.

Thank you. It's been two years since this issue was raised, but Dapr has not yet provided an official solution.

@ItalyPaleAle ItalyPaleAle added this to the v1.13 milestone Sep 12, 2023
@ItalyPaleAle
Copy link
Contributor

Let's get this done for 1.13, for local development scenarios using SQLite.

@hmgSilva1973
Copy link

hmgSilva1973 commented Oct 9, 2023

Adding that on CLI 1.11.0/Runtime 11.1.4 this is still an issue (Windows 10).
Something seems odd though, as the nodejs quickstarts work fine, but the .NET ones don't, so maybe something related with .net sdk (didn't yet try other languages quickstarts though, as it would require some environment changes/installs that I can't do right now)?
Even the Consul based solution is failing with health checks giving a 500 error.

@ItalyPaleAle
Copy link
Contributor

New name resolver (backed by SQLite) is implemented in #7038

Whether that becomes the new default for the local DX is an issue that should be discussed with the runtime and CLI maintainers.

@JoshVanL JoshVanL mentioned this issue Oct 24, 2023
31 tasks
@msfussell
Copy link
Member

@ItalyPaleAle Is this "Whether that becomes the new default for the local DX is an issue that should be discussed with the runtime and CLI maintainers." tracked as an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment