From f9207413a1d1d0485c1b921cb17219c2799badbf Mon Sep 17 00:00:00 2001 From: Elena Kolevska Date: Fri, 14 Feb 2025 16:39:09 +0000 Subject: [PATCH 1/7] Adds scheduler ha/nonha info Signed-off-by: Elena Kolevska --- daprdocs/content/en/concepts/dapr-services/scheduler.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/daprdocs/content/en/concepts/dapr-services/scheduler.md b/daprdocs/content/en/concepts/dapr-services/scheduler.md index 364297a9f0b..5eb56549e2e 100644 --- a/daprdocs/content/en/concepts/dapr-services/scheduler.md +++ b/daprdocs/content/en/concepts/dapr-services/scheduler.md @@ -61,15 +61,16 @@ When the Scheduler service triggers a job and it has a client side error, the jo For non-client side errors, for example, when a job cannot be sent to an available Dapr sidecar at trigger time, it is placed in a staging queue within the Scheduler service. Jobs remain in this queue until a suitable sidecar instance becomes available, at which point they are automatically sent to the appropriate Dapr sidecar instance. + ## Self-hosted mode The Scheduler service Docker container is started automatically as part of `dapr init`. It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}). -## Kubernetes mode +The Scheduler can be run in both high availability (HA) and non-HA modes in self-hosted deployments. However, non-HA mode is not recommended for production use. If switching between non-HA and HA modes, the existing data directory must be removed, which will result in loss of jobs and actor reminders. Ensure you [run a back up]({{< ref "#back-up-and-restore-scheduler-data" >}}) before making this change to avoid losing data. -The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. When running in Kubernetes mode, the Scheduler service is configured to run with exactly 3 replicas to ensure data integrity. +## Kubernetes mode -You can run Scheduler in high availability (HA) mode. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}}) +The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler will always run in high availability (HA) mode in Kubernetes deployments. Scaling up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}}) When a Kubernetes namespace is deleted, all the Job and Actor Reminders corresponding to that namespace are deleted. @@ -115,6 +116,7 @@ Once you have access to the etcd ports, you can follow the [official etcd backup If you are not using any features that require the Scheduler service (Jobs API, Actor Reminders, or Workflows), you can disable it by setting `global.scheduler.enabled=false`. + For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}). ## Related links From 859e135e1398ac6c19b22510d0030f1e0761f94e Mon Sep 17 00:00:00 2001 From: Elena Kolevska Date: Fri, 14 Feb 2025 16:42:58 +0000 Subject: [PATCH 2/7] Empty lines Signed-off-by: Elena Kolevska --- daprdocs/content/en/concepts/dapr-services/scheduler.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/daprdocs/content/en/concepts/dapr-services/scheduler.md b/daprdocs/content/en/concepts/dapr-services/scheduler.md index 5eb56549e2e..e42b20ad74e 100644 --- a/daprdocs/content/en/concepts/dapr-services/scheduler.md +++ b/daprdocs/content/en/concepts/dapr-services/scheduler.md @@ -61,7 +61,6 @@ When the Scheduler service triggers a job and it has a client side error, the jo For non-client side errors, for example, when a job cannot be sent to an available Dapr sidecar at trigger time, it is placed in a staging queue within the Scheduler service. Jobs remain in this queue until a suitable sidecar instance becomes available, at which point they are automatically sent to the appropriate Dapr sidecar instance. - ## Self-hosted mode The Scheduler service Docker container is started automatically as part of `dapr init`. It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}). @@ -116,7 +115,6 @@ Once you have access to the etcd ports, you can follow the [official etcd backup If you are not using any features that require the Scheduler service (Jobs API, Actor Reminders, or Workflows), you can disable it by setting `global.scheduler.enabled=false`. - For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}). ## Related links From 866d2358ed3559fb47a1bd3d735da7a50dd47a7b Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 14 Feb 2025 15:39:26 -0500 Subject: [PATCH 3/7] reorder toc Signed-off-by: Hannah Hunter --- .../debugging/_index.md | 2 +- .../develop-components/_index.md | 2 +- .../error-codes/_index.md | 2 +- .../integrations/_index.md | 2 +- .../integrations/gRPC-integration.md | 257 ------------------ .../local-development/_index.md | 2 +- .../en/developing-applications/sdks/_index.md | 2 +- 7 files changed, 6 insertions(+), 263 deletions(-) delete mode 100644 daprdocs/content/en/developing-applications/integrations/gRPC-integration.md diff --git a/daprdocs/content/en/developing-applications/debugging/_index.md b/daprdocs/content/en/developing-applications/debugging/_index.md index d6d77e77df1..bb9d76df122 100644 --- a/daprdocs/content/en/developing-applications/debugging/_index.md +++ b/daprdocs/content/en/developing-applications/debugging/_index.md @@ -2,6 +2,6 @@ type: docs title: "Debugging Dapr applications and the Dapr control plane" linkTitle: "Debugging" -weight: 60 +weight: 50 description: "Guides on how to debug Dapr applications and the Dapr control plane" --- \ No newline at end of file diff --git a/daprdocs/content/en/developing-applications/develop-components/_index.md b/daprdocs/content/en/developing-applications/develop-components/_index.md index 970744958fc..981506e6d3f 100644 --- a/daprdocs/content/en/developing-applications/develop-components/_index.md +++ b/daprdocs/content/en/developing-applications/develop-components/_index.md @@ -2,6 +2,6 @@ type: docs title: "Components" linkTitle: "Components" -weight: 40 +weight: 70 description: "Learn more about developing Dapr's pluggable and middleware components" --- diff --git a/daprdocs/content/en/developing-applications/error-codes/_index.md b/daprdocs/content/en/developing-applications/error-codes/_index.md index f693722f5a6..0ea1f5846b4 100644 --- a/daprdocs/content/en/developing-applications/error-codes/_index.md +++ b/daprdocs/content/en/developing-applications/error-codes/_index.md @@ -2,7 +2,7 @@ type: docs title: "Error codes" linkTitle: "Error codes" -weight: 20 +weight: 30 description: "Error codes and messages you may encounter while using Dapr" --- diff --git a/daprdocs/content/en/developing-applications/integrations/_index.md b/daprdocs/content/en/developing-applications/integrations/_index.md index b988581b78b..a884aeb5c43 100644 --- a/daprdocs/content/en/developing-applications/integrations/_index.md +++ b/daprdocs/content/en/developing-applications/integrations/_index.md @@ -2,6 +2,6 @@ type: docs title: "Integrations" linkTitle: "Integrations" -weight: 70 +weight: 60 description: "Dapr integrations with other technologies" --- \ No newline at end of file diff --git a/daprdocs/content/en/developing-applications/integrations/gRPC-integration.md b/daprdocs/content/en/developing-applications/integrations/gRPC-integration.md deleted file mode 100644 index 6b05dfa6076..00000000000 --- a/daprdocs/content/en/developing-applications/integrations/gRPC-integration.md +++ /dev/null @@ -1,257 +0,0 @@ ---- -type: docs -title: "How to: Use the gRPC interface in your Dapr application" -linkTitle: "gRPC interface" -weight: 6000 -description: "Use the Dapr gRPC API in your application" ---- - -Dapr implements both an HTTP and a gRPC API for local calls. [gRPC](https://grpc.io/) is useful for low-latency, high performance scenarios and has language integration using the proto clients. - -[Find a list of auto-generated clients in the Dapr SDK documentation]({{< ref sdks >}}). - -The Dapr runtime implements a [proto service](https://github.com/dapr/dapr/blob/master/dapr/proto/runtime/v1/dapr.proto) that apps can communicate with via gRPC. - -In addition to calling Dapr via gRPC, Dapr supports service-to-service calls with gRPC by acting as a proxy. [Learn more in the gRPC service invocation how-to guide]({{< ref howto-invoke-services-grpc.md >}}). - -This guide demonstrates configuring and invoking Dapr with gRPC using a Go SDK application. - -## Configure Dapr to communicate with an app via gRPC - -{{< tabs "Self-hosted" "Kubernetes">}} - -{{% codetab %}} - -When running in self-hosted mode, use the `--app-protocol` flag to tell Dapr to use gRPC to talk to the app. - -```bash -dapr run --app-protocol grpc --app-port 5005 node app.js -``` - -This tells Dapr to communicate with your app via gRPC over port `5005`. - -{{% /codetab %}} - - -{{% codetab %}} - -On Kubernetes, set the following annotations in your deployment YAML: - -```yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: myapp - namespace: default - labels: - app: myapp -spec: - replicas: 1 - selector: - matchLabels: - app: myapp - template: - metadata: - labels: - app: myapp - annotations: - dapr.io/enabled: "true" - dapr.io/app-id: "myapp" - dapr.io/app-protocol: "grpc" - dapr.io/app-port: "5005" -... -``` - -{{% /codetab %}} - -{{< /tabs >}} - -## Invoke Dapr with gRPC - -The following steps show how to create a Dapr client and call the `SaveStateData` operation on it. - -1. Import the package: - - ```go - package main - - import ( - "context" - "log" - "os" - - dapr "github.com/dapr/go-sdk/client" - ) - ``` - -1. Create the client: - - ```go - // just for this demo - ctx := context.Background() - data := []byte("ping") - - // create the client - client, err := dapr.NewClient() - if err != nil { - log.Panic(err) - } - defer client.Close() - ``` - - 3. Invoke the `SaveState` method: - - ```go - // save state with the key key1 - err = client.SaveState(ctx, "statestore", "key1", data) - if err != nil { - log.Panic(err) - } - log.Println("data saved") - ``` - -Now you can explore all the different methods on the Dapr client. - -## Create a gRPC app with Dapr - -The following steps will show how to create an app that exposes a server for with which Dapr can communicate. - -1. Import the package: - - ```go - package main - - import ( - "context" - "fmt" - "log" - "net" - - "github.com/golang/protobuf/ptypes/any" - "github.com/golang/protobuf/ptypes/empty" - - commonv1pb "github.com/dapr/dapr/pkg/proto/common/v1" - pb "github.com/dapr/dapr/pkg/proto/runtime/v1" - "google.golang.org/grpc" - ) - ``` - -1. Implement the interface: - - ```go - // server is our user app - type server struct { - pb.UnimplementedAppCallbackServer - } - - // EchoMethod is a simple demo method to invoke - func (s *server) EchoMethod() string { - return "pong" - } - - // This method gets invoked when a remote service has called the app through Dapr - // The payload carries a Method to identify the method, a set of metadata properties and an optional payload - func (s *server) OnInvoke(ctx context.Context, in *commonv1pb.InvokeRequest) (*commonv1pb.InvokeResponse, error) { - var response string - - switch in.Method { - case "EchoMethod": - response = s.EchoMethod() - } - - return &commonv1pb.InvokeResponse{ - ContentType: "text/plain; charset=UTF-8", - Data: &any.Any{Value: []byte(response)}, - }, nil - } - - // Dapr will call this method to get the list of topics the app wants to subscribe to. In this example, we are telling Dapr - // To subscribe to a topic named TopicA - func (s *server) ListTopicSubscriptions(ctx context.Context, in *empty.Empty) (*pb.ListTopicSubscriptionsResponse, error) { - return &pb.ListTopicSubscriptionsResponse{ - Subscriptions: []*pb.TopicSubscription{ - {Topic: "TopicA"}, - }, - }, nil - } - - // Dapr will call this method to get the list of bindings the app will get invoked by. In this example, we are telling Dapr - // To invoke our app with a binding named storage - func (s *server) ListInputBindings(ctx context.Context, in *empty.Empty) (*pb.ListInputBindingsResponse, error) { - return &pb.ListInputBindingsResponse{ - Bindings: []string{"storage"}, - }, nil - } - - // This method gets invoked every time a new event is fired from a registered binding. The message carries the binding name, a payload and optional metadata - func (s *server) OnBindingEvent(ctx context.Context, in *pb.BindingEventRequest) (*pb.BindingEventResponse, error) { - fmt.Println("Invoked from binding") - return &pb.BindingEventResponse{}, nil - } - - // This method is fired whenever a message has been published to a topic that has been subscribed. Dapr sends published messages in a CloudEvents 0.3 envelope. - func (s *server) OnTopicEvent(ctx context.Context, in *pb.TopicEventRequest) (*pb.TopicEventResponse, error) { - fmt.Println("Topic message arrived") - return &pb.TopicEventResponse{}, nil - } - - ``` - -1. Create the server: - - ```go - func main() { - // create listener - lis, err := net.Listen("tcp", ":50001") - if err != nil { - log.Fatalf("failed to listen: %v", err) - } - - // create grpc server - s := grpc.NewServer() - pb.RegisterAppCallbackServer(s, &server{}) - - fmt.Println("Client starting...") - - // and start... - if err := s.Serve(lis); err != nil { - log.Fatalf("failed to serve: %v", err) - } - } - ``` - - This creates a gRPC server for your app on port 50001. - -## Run the application - -{{< tabs "Self-hosted" "Kubernetes">}} - -{{% codetab %}} - -To run locally, use the Dapr CLI: - -```bash -dapr run --app-id goapp --app-port 50001 --app-protocol grpc go run main.go -``` - -{{% /codetab %}} - - -{{% codetab %}} - -On Kubernetes, set the required `dapr.io/app-protocol: "grpc"` and `dapr.io/app-port: "50001` annotations in your pod spec template, as mentioned above. - -{{% /codetab %}} - -{{< /tabs >}} - - -## Other languages - -You can use Dapr with any language supported by Protobuf, and not just with the currently available generated SDKs. - -Using the [protoc](https://developers.google.com/protocol-buffers/docs/downloads) tool, you can generate the Dapr clients for other languages like Ruby, C++, Rust, and others. - - ## Related Topics -- [Service invocation building block]({{< ref service-invocation >}}) -- [Service invocation API specification]({{< ref service_invocation_api.md >}}) diff --git a/daprdocs/content/en/developing-applications/local-development/_index.md b/daprdocs/content/en/developing-applications/local-development/_index.md index 8ffc396d4ee..b06587df577 100644 --- a/daprdocs/content/en/developing-applications/local-development/_index.md +++ b/daprdocs/content/en/developing-applications/local-development/_index.md @@ -2,6 +2,6 @@ type: docs title: "Local development" linkTitle: "Local development" -weight: 50 +weight: 40 description: "Capabilities for developing Dapr applications locally" --- \ No newline at end of file diff --git a/daprdocs/content/en/developing-applications/sdks/_index.md b/daprdocs/content/en/developing-applications/sdks/_index.md index 5434d497b26..4f56c0513bd 100644 --- a/daprdocs/content/en/developing-applications/sdks/_index.md +++ b/daprdocs/content/en/developing-applications/sdks/_index.md @@ -2,7 +2,7 @@ type: docs title: "Dapr Software Development Kits (SDKs)" linkTitle: "SDKs" -weight: 30 +weight: 20 description: "Use your favorite languages with Dapr" no_list: true --- From dc40d7f75eb10006686fa6de66ba148a6ab18bf3 Mon Sep 17 00:00:00 2001 From: Elena Kolevska Date: Mon, 17 Feb 2025 13:27:11 +0000 Subject: [PATCH 4/7] Applies comment from review --- daprdocs/content/en/concepts/dapr-services/scheduler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/concepts/dapr-services/scheduler.md b/daprdocs/content/en/concepts/dapr-services/scheduler.md index e42b20ad74e..2828d06f94c 100644 --- a/daprdocs/content/en/concepts/dapr-services/scheduler.md +++ b/daprdocs/content/en/concepts/dapr-services/scheduler.md @@ -69,7 +69,7 @@ The Scheduler can be run in both high availability (HA) and non-HA modes in self ## Kubernetes mode -The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler will always run in high availability (HA) mode in Kubernetes deployments. Scaling up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}}) +The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler will always run in high availability (HA) mode in Kubernetes deployments. Scaling the Scheduler service replicas up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}}) When a Kubernetes namespace is deleted, all the Job and Actor Reminders corresponding to that namespace are deleted. From f330572b54ecc5daca7049e6c42efe1b961af453 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 18 Feb 2025 11:29:46 -0500 Subject: [PATCH 5/7] forgot to add file Signed-off-by: Hannah Hunter --- .../local-development/gRPC-integration.md | 257 ++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 daprdocs/content/en/developing-applications/local-development/gRPC-integration.md diff --git a/daprdocs/content/en/developing-applications/local-development/gRPC-integration.md b/daprdocs/content/en/developing-applications/local-development/gRPC-integration.md new file mode 100644 index 00000000000..bd0eea99230 --- /dev/null +++ b/daprdocs/content/en/developing-applications/local-development/gRPC-integration.md @@ -0,0 +1,257 @@ +--- +type: docs +title: "How to: Use the gRPC interface in your Dapr application" +linkTitle: "gRPC interface" +weight: 400 +description: "Use the Dapr gRPC API in your application" +--- + +Dapr implements both an HTTP and a gRPC API for local calls. [gRPC](https://grpc.io/) is useful for low-latency, high performance scenarios and has language integration using the proto clients. + +[Find a list of auto-generated clients in the Dapr SDK documentation]({{< ref sdks >}}). + +The Dapr runtime implements a [proto service](https://github.com/dapr/dapr/blob/master/dapr/proto/runtime/v1/dapr.proto) that apps can communicate with via gRPC. + +In addition to calling Dapr via gRPC, Dapr supports service-to-service calls with gRPC by acting as a proxy. [Learn more in the gRPC service invocation how-to guide]({{< ref howto-invoke-services-grpc.md >}}). + +This guide demonstrates configuring and invoking Dapr with gRPC using a Go SDK application. + +## Configure Dapr to communicate with an app via gRPC + +{{< tabs "Self-hosted" "Kubernetes">}} + +{{% codetab %}} + +When running in self-hosted mode, use the `--app-protocol` flag to tell Dapr to use gRPC to talk to the app. + +```bash +dapr run --app-protocol grpc --app-port 5005 node app.js +``` + +This tells Dapr to communicate with your app via gRPC over port `5005`. + +{{% /codetab %}} + + +{{% codetab %}} + +On Kubernetes, set the following annotations in your deployment YAML: + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: myapp + namespace: default + labels: + app: myapp +spec: + replicas: 1 + selector: + matchLabels: + app: myapp + template: + metadata: + labels: + app: myapp + annotations: + dapr.io/enabled: "true" + dapr.io/app-id: "myapp" + dapr.io/app-protocol: "grpc" + dapr.io/app-port: "5005" +... +``` + +{{% /codetab %}} + +{{< /tabs >}} + +## Invoke Dapr with gRPC + +The following steps show how to create a Dapr client and call the `SaveStateData` operation on it. + +1. Import the package: + + ```go + package main + + import ( + "context" + "log" + "os" + + dapr "github.com/dapr/go-sdk/client" + ) + ``` + +1. Create the client: + + ```go + // just for this demo + ctx := context.Background() + data := []byte("ping") + + // create the client + client, err := dapr.NewClient() + if err != nil { + log.Panic(err) + } + defer client.Close() + ``` + + 3. Invoke the `SaveState` method: + + ```go + // save state with the key key1 + err = client.SaveState(ctx, "statestore", "key1", data) + if err != nil { + log.Panic(err) + } + log.Println("data saved") + ``` + +Now you can explore all the different methods on the Dapr client. + +## Create a gRPC app with Dapr + +The following steps will show how to create an app that exposes a server for with which Dapr can communicate. + +1. Import the package: + + ```go + package main + + import ( + "context" + "fmt" + "log" + "net" + + "github.com/golang/protobuf/ptypes/any" + "github.com/golang/protobuf/ptypes/empty" + + commonv1pb "github.com/dapr/dapr/pkg/proto/common/v1" + pb "github.com/dapr/dapr/pkg/proto/runtime/v1" + "google.golang.org/grpc" + ) + ``` + +1. Implement the interface: + + ```go + // server is our user app + type server struct { + pb.UnimplementedAppCallbackServer + } + + // EchoMethod is a simple demo method to invoke + func (s *server) EchoMethod() string { + return "pong" + } + + // This method gets invoked when a remote service has called the app through Dapr + // The payload carries a Method to identify the method, a set of metadata properties and an optional payload + func (s *server) OnInvoke(ctx context.Context, in *commonv1pb.InvokeRequest) (*commonv1pb.InvokeResponse, error) { + var response string + + switch in.Method { + case "EchoMethod": + response = s.EchoMethod() + } + + return &commonv1pb.InvokeResponse{ + ContentType: "text/plain; charset=UTF-8", + Data: &any.Any{Value: []byte(response)}, + }, nil + } + + // Dapr will call this method to get the list of topics the app wants to subscribe to. In this example, we are telling Dapr + // To subscribe to a topic named TopicA + func (s *server) ListTopicSubscriptions(ctx context.Context, in *empty.Empty) (*pb.ListTopicSubscriptionsResponse, error) { + return &pb.ListTopicSubscriptionsResponse{ + Subscriptions: []*pb.TopicSubscription{ + {Topic: "TopicA"}, + }, + }, nil + } + + // Dapr will call this method to get the list of bindings the app will get invoked by. In this example, we are telling Dapr + // To invoke our app with a binding named storage + func (s *server) ListInputBindings(ctx context.Context, in *empty.Empty) (*pb.ListInputBindingsResponse, error) { + return &pb.ListInputBindingsResponse{ + Bindings: []string{"storage"}, + }, nil + } + + // This method gets invoked every time a new event is fired from a registered binding. The message carries the binding name, a payload and optional metadata + func (s *server) OnBindingEvent(ctx context.Context, in *pb.BindingEventRequest) (*pb.BindingEventResponse, error) { + fmt.Println("Invoked from binding") + return &pb.BindingEventResponse{}, nil + } + + // This method is fired whenever a message has been published to a topic that has been subscribed. Dapr sends published messages in a CloudEvents 0.3 envelope. + func (s *server) OnTopicEvent(ctx context.Context, in *pb.TopicEventRequest) (*pb.TopicEventResponse, error) { + fmt.Println("Topic message arrived") + return &pb.TopicEventResponse{}, nil + } + + ``` + +1. Create the server: + + ```go + func main() { + // create listener + lis, err := net.Listen("tcp", ":50001") + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + + // create grpc server + s := grpc.NewServer() + pb.RegisterAppCallbackServer(s, &server{}) + + fmt.Println("Client starting...") + + // and start... + if err := s.Serve(lis); err != nil { + log.Fatalf("failed to serve: %v", err) + } + } + ``` + + This creates a gRPC server for your app on port 50001. + +## Run the application + +{{< tabs "Self-hosted" "Kubernetes">}} + +{{% codetab %}} + +To run locally, use the Dapr CLI: + +```bash +dapr run --app-id goapp --app-port 50001 --app-protocol grpc go run main.go +``` + +{{% /codetab %}} + + +{{% codetab %}} + +On Kubernetes, set the required `dapr.io/app-protocol: "grpc"` and `dapr.io/app-port: "50001` annotations in your pod spec template, as mentioned above. + +{{% /codetab %}} + +{{< /tabs >}} + + +## Other languages + +You can use Dapr with any language supported by Protobuf, and not just with the currently available generated SDKs. + +Using the [protoc](https://developers.google.com/protocol-buffers/docs/downloads) tool, you can generate the Dapr clients for other languages like Ruby, C++, Rust, and others. + + ## Related Topics +- [Service invocation building block]({{< ref service-invocation >}}) +- [Service invocation API specification]({{< ref service_invocation_api.md >}}) From e231d4da6e995f45fa5cd41f41495d477b07dbc5 Mon Sep 17 00:00:00 2001 From: Elena Kolevska Date: Tue, 18 Feb 2025 17:06:56 +0000 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Elena Kolevska --- daprdocs/content/en/concepts/dapr-services/scheduler.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daprdocs/content/en/concepts/dapr-services/scheduler.md b/daprdocs/content/en/concepts/dapr-services/scheduler.md index 2828d06f94c..c7364ecd697 100644 --- a/daprdocs/content/en/concepts/dapr-services/scheduler.md +++ b/daprdocs/content/en/concepts/dapr-services/scheduler.md @@ -65,11 +65,11 @@ For non-client side errors, for example, when a job cannot be sent to an availab The Scheduler service Docker container is started automatically as part of `dapr init`. It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}). -The Scheduler can be run in both high availability (HA) and non-HA modes in self-hosted deployments. However, non-HA mode is not recommended for production use. If switching between non-HA and HA modes, the existing data directory must be removed, which will result in loss of jobs and actor reminders. Ensure you [run a back up]({{< ref "#back-up-and-restore-scheduler-data" >}}) before making this change to avoid losing data. +The Scheduler can be run in both high availability (HA) and non-HA modes in self-hosted deployments. However, non-HA mode is not recommended for production use. If switching between non-HA and HA modes, the existing data directory must be removed, which results in loss of jobs and actor reminders. [Run a back-up]({{< ref "#back-up-and-restore-scheduler-data" >}}) before making this change to avoid losing data. ## Kubernetes mode -The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler will always run in high availability (HA) mode in Kubernetes deployments. Scaling the Scheduler service replicas up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}}) +The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler always runs in high availability (HA) mode in Kubernetes deployments. Scaling the Scheduler service replicas up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}}) When a Kubernetes namespace is deleted, all the Job and Actor Reminders corresponding to that namespace are deleted. From 336dcdfe8451df9015683d34ab49726b1a239cf8 Mon Sep 17 00:00:00 2001 From: Filinto Duran <1373693+filintod@users.noreply.github.com> Date: Wed, 19 Feb 2025 19:22:08 -0600 Subject: [PATCH 7/7] add image pull info (#4545) * add info about image pull policy Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com> * Update multi-app-overview.md Add note Signed-off-by: Mark Fussell * Update multi-app-template.md Added example Signed-off-by: Mark Fussell --------- Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com> Signed-off-by: Mark Fussell Co-authored-by: Mark Fussell --- .../multi-app-dapr-run/multi-app-overview.md | 4 +- .../multi-app-dapr-run/multi-app-template.md | 67 ++++++++++--------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-overview.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-overview.md index 4e48d8a09e4..1cb8cc0b93d 100644 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-overview.md +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-overview.md @@ -124,6 +124,7 @@ apps: appDirPath: ./nodeapp/ appPort: 3000 containerImage: ghcr.io/dapr/samples/hello-k8s-node:latest + containerImagePullPolicy: Always createService: true env: APP_PORT: 3000 @@ -134,6 +135,7 @@ apps: > **Note:** > - If the `containerImage` field is not specified, `dapr run -k -f` produces an error. +> - The containerImagePullPolicy indicates that a new container image is always downloaded for this app. > - The `createService` field defines a basic service in Kubernetes (ClusterIP or LoadBalancer) that targets the `--app-port` specified in the template. If `createService` isn't specified, the application is not accessible from outside the cluster. For a more in-depth example and explanation of the template properties, see [Multi-app template]({{< ref multi-app-template.md >}}). @@ -169,4 +171,4 @@ Watch [this video for an overview on Multi-App Run in Kubernetes](https://youtu. - [Learn the Multi-App Run template file structure and its properties]({{< ref multi-app-template.md >}}) - [Try out the self-hosted Multi-App Run template with the Service Invocation quickstart]({{< ref serviceinvocation-quickstart.md >}}) -- [Try out the Kubernetes Multi-App Run template with the `hello-kubernetes` tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/hello-kubernetes) \ No newline at end of file +- [Try out the Kubernetes Multi-App Run template with the `hello-kubernetes` tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/hello-kubernetes) diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-template.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-template.md index 606ae9fbe8c..ba7e3d17753 100644 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-template.md +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-template.md @@ -203,6 +203,7 @@ apps: appLogDestination: file # (optional), can be file, console or fileAndConsole. default is fileAndConsole. daprdLogDestination: file # (optional), can be file, console or fileAndConsole. default is file. containerImage: ghcr.io/dapr/samples/hello-k8s-node:latest # (optional) URI of the container image to be used when deploying to Kubernetes dev/test environment. + containerImagePullPolicy: IfNotPresent # (optional), the container image is downloaded if one is not present locally, otherwise the local one is used. createService: true # (optional) Create a Kubernetes service for the application when deploying to dev/test environment. - appID: backend # optional appDirPath: .dapr/backend/ # REQUIRED @@ -285,39 +286,39 @@ The properties for the Multi-App Run template align with the `dapr run -k` CLI f {{< table "table table-white table-striped table-bordered" >}} -| Properties | Required | Details | Example | -|--------------------------|:--------:|--------|---------| -| `appDirPath` | Y | Path to the your application code | `./webapp/`, `./backend/` | -| `appID` | N | Application's app ID. If not provided, will be derived from `appDirPath` | `webapp`, `backend` | -| `appChannelAddress` | N | The network address the application listens on. Can be left to the default value by convention. | `127.0.0.1` | `localhost` | -| `appProtocol` | N | The protocol Dapr uses to talk to the application. | `http`, `grpc` | -| `appPort` | N | The port your application is listening on | `8080`, `3000` | -| `daprHTTPPort` | N | Dapr HTTP port | | -| `daprGRPCPort` | N | Dapr GRPC port | | -| `daprInternalGRPCPort` | N | gRPC port for the Dapr Internal API to listen on; used when parsing the value from a local DNS component | | -| `metricsPort` | N | The port that Dapr sends its metrics information to | | -| `unixDomainSocket` | N | Path to a unix domain socket dir mount. If specified, communication with the Dapr sidecar uses unix domain sockets for lower latency and greater throughput when compared to using TCP ports. Not available on Windows. | `/tmp/test-socket` | -| `profilePort` | N | The port for the profile server to listen on | | -| `enableProfiling` | N | Enable profiling via an HTTP endpoint | | -| `apiListenAddresses` | N | Dapr API listen addresses | | -| `logLevel` | N | The log verbosity. | | -| `appMaxConcurrency` | N | The concurrency level of the application; default is unlimited | | -| `placementHostAddress` | N | | | -| `appSSL` | N | Enable https when Dapr invokes the application | | -| `daprHTTPMaxRequestSize` | N | Max size of the request body in MB. | | -| `daprHTTPReadBufferSize` | N | Max size of the HTTP read buffer in KB. This also limits the maximum size of HTTP headers. The default 4 KB | | -| `enableAppHealthCheck` | N | Enable the app health check on the application | `true`, `false` | -| `appHealthCheckPath` | N | Path to the health check file | `/healthz` | -| `appHealthProbeInterval` | N | Interval to probe for the health of the app in seconds - | | -| `appHealthProbeTimeout` | N | Timeout for app health probes in milliseconds | | -| `appHealthThreshold` | N | Number of consecutive failures for the app to be considered unhealthy | | -| `enableApiLogging` | N | Enable the logging of all API calls from application to Dapr | | -| `env` | N | Map to environment variable; environment variables applied per application will overwrite environment variables shared across applications | `DEBUG`, `DAPR_HOST_ADD` | -| `appLogDestination` | N | Log destination for outputting app logs; Its value can be file, console or fileAndConsole. Default is fileAndConsole | `file`, `console`, `fileAndConsole` | -| `daprdLogDestination` | N | Log destination for outputting daprd logs; Its value can be file, console or fileAndConsole. Default is file | `file`, `console`, `fileAndConsole` | -| `containerImage`| N | URI of the container image to be used when deploying to Kubernetes dev/test environment. | `ghcr.io/dapr/samples/hello-k8s-python:latest` -| `createService`| N | Create a Kubernetes service for the application when deploying to dev/test environment. | `true`, `false` | +| Properties | Required | Details | Example | +|----------------------------|:--------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| +| `appDirPath` | Y | Path to the your application code | `./webapp/`, `./backend/` | +| `appID` | N | Application's app ID. If not provided, will be derived from `appDirPath` | `webapp`, `backend` | +| `appChannelAddress` | N | The network address the application listens on. Can be left to the default value by convention. | `127.0.0`, `localhost` | +| `appProtocol` | N | The protocol Dapr uses to talk to the application. | `http`, `grpc` | +| `appPort` | N | The port your application is listening on | `8080`, `3000` | +| `daprHTTPPort` | N | Dapr HTTP port | | +| `daprGRPCPort` | N | Dapr GRPC port | | +| `daprInternalGRPCPort` | N | gRPC port for the Dapr Internal API to listen on; used when parsing the value from a local DNS component | | +| `metricsPort` | N | The port that Dapr sends its metrics information to | | +| `unixDomainSocket` | N | Path to a unix domain socket dir mount. If specified, communication with the Dapr sidecar uses unix domain sockets for lower latency and greater throughput when compared to using TCP ports. Not available on Windows. | `/tmp/test-socket` | +| `profilePort` | N | The port for the profile server to listen on | | +| `enableProfiling` | N | Enable profiling via an HTTP endpoint | | +| `apiListenAddresses` | N | Dapr API listen addresses | | +| `logLevel` | N | The log verbosity. | | +| `appMaxConcurrency` | N | The concurrency level of the application; default is unlimited | | +| `placementHostAddress` | N | | | +| `appSSL` | N | Enable https when Dapr invokes the application | | +| `daprHTTPMaxRequestSize` | N | Max size of the request body in MB. | | +| `daprHTTPReadBufferSize` | N | Max size of the HTTP read buffer in KB. This also limits the maximum size of HTTP headers. The default 4 KB | | +| `enableAppHealthCheck` | N | Enable the app health check on the application | `true`, `false` | +| `appHealthCheckPath` | N | Path to the health check file | `/healthz` | +| `appHealthProbeInterval` | N | Interval to probe for the health of the app in seconds | | +| `appHealthProbeTimeout` | N | Timeout for app health probes in milliseconds | | +| `appHealthThreshold` | N | Number of consecutive failures for the app to be considered unhealthy | | +| `enableApiLogging` | N | Enable the logging of all API calls from application to Dapr | | +| `env` | N | Map to environment variable; environment variables applied per application will overwrite environment variables shared across applications | `DEBUG`, `DAPR_HOST_ADD` | +| `appLogDestination` | N | Log destination for outputting app logs; Its value can be file, console or fileAndConsole. Default is fileAndConsole | `file`, `console`, `fileAndConsole` | +| `daprdLogDestination` | N | Log destination for outputting daprd logs; Its value can be file, console or fileAndConsole. Default is file | `file`, `console`, `fileAndConsole` | +| `containerImage` | N | URI of the container image to be used when deploying to Kubernetes dev/test environment. | `ghcr.io/dapr/samples/hello-k8s-python:latest` | +| `containerImagePullPolicy` | N | The container image pull policy (default to `Always`). | `Always`, `IfNotPresent`, `Never` | +| `createService` | N | Create a Kubernetes service for the application when deploying to dev/test environment. | `true`, `false` | {{< /table >}}