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

Consider setting DAPR_HTTP_PORT and DAPR_GRPC_PORT in DaprDistributedApplicationLifecycleHook #4077

Open
frankbuckley opened this issue May 3, 2024 · 3 comments · May be fixed by #4086
Open
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication area-dapr

Comments

@frankbuckley
Copy link

Currently, when adding a Dapr sidecar, the DAPR_HTTP_ENDPOINT and DAPR_GRPC_ENDPOINT environment variables are set:

var http = daprCli.GetEndpoint("http");
var grpc = daprCli.GetEndpoint("grpc");
context.EnvironmentVariables.TryAdd("DAPR_GRPC_ENDPOINT", grpc);
context.EnvironmentVariables.TryAdd("DAPR_HTTP_ENDPOINT", http);

Some apps may instead rely on DAPR_HTTP_PORT and/or DAPR_GRPC_PORT and will therefore fail.

See also:

https://github.com/dapr/dotnet-sdk/blob/ba1341510bfc81f0e1ba4687539ec49aa90abc4e/src/Shared/DaprDefaults.cs#L63-L76

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label May 3, 2024
@frankbuckley
Copy link
Author

Some apps may instead rely on DAPR_HTTP_PORT and/or DAPR_GRPC_PORT and will therefore fail

...which is what they will be relying on when deployed:

    Environment:
      ASPNETCORE_ENVIRONMENT:                                  production
      DOTNET_gcServer:                                         1
      DOTNET_GCDynamicAdaptationMode:                          1
      DOTNET_GCConserveMemory:                                 8
      CLUSTER_NAME:                                            <set to the key 'cluster-name' of config map 'cluster-config'>    Optional: false
      CLUSTER_REGION:                                          <set to the key 'cluster-region' of config map 'cluster-config'>  Optional: false
      NODE_NAME:                                                (v1:spec.nodeName)
      POD_NAME:                                                *************-7b5bf5f457-56lpv (v1:metadata.name)
      POD_UID:                                                  (v1:metadata.uid)
      POD_NAMESPACE:                                           production (v1:metadata.namespace)
      POD_IP:                                                   (v1:status.podIP)
      APP_API_TOKEN:                                           <set to the key 'token' in secret 'dapr-api-token'>                                 Optional: false
      DAPR_API_TOKEN:                                          <set to the key 'token' in secret 'dapr-api-token'>                                 Optional: false
      DAPR_HTTP_PORT:                                          3500
      DAPR_GRPC_PORT:                                          50001

@frankbuckley
Copy link
Author

...and DAPR_HTTP_ENDPOINT and DAPR_GRPC_ENDPOINT were only added July 2023:

dapr/dotnet-sdk#1124

...I am guessing, but are these only configured when deployed if using Diagrid Catalyst, rather than Dapr alone?

@frankbuckley
Copy link
Author

...and they are not documented:

https://docs.dapr.io/reference/environment/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication area-dapr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants