From d34ca506b0003143d6e101dd04340495785e4a00 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Wed, 25 Jan 2023 19:54:18 -0600 Subject: [PATCH 01/23] start dapr run -f docs Signed-off-by: Hannah Hunter --- .../local-development/multi-app-dapr-run.md | 71 ++++++++++++++++++ .../support/support-preview-features.md | 1 + .../static/images/multi-app-structure.png | Bin 0 -> 13627 bytes 3 files changed, 72 insertions(+) create mode 100644 daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md create mode 100644 daprdocs/static/images/multi-app-structure.png diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md new file mode 100644 index 000000000..0006debd9 --- /dev/null +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md @@ -0,0 +1,71 @@ +--- +type: docs +title: Run multiple applications with one command +linkTitle: Multi-app Dapr Run +weight: 2000 +description: Learn the scenarios around running multiple applications with one Dapr command +--- + +{{% alert title="Note" color="primary" %}} + Multi-app `dapr run` is currently a preview feature only supported in Linux/MacOS. +{{% /alert %}} + +Let's say you want to run several applications in local mode while being able to replication the production scenario. While in Kubernets mode, you'd be able to use helm/deployment YAML files, self-hosted mode required you to: + +- Run multiple `dapr run` commands +- Keep track of all ports opened +- Remember the resources folders and configuration files that each application refers to +- Recall all of the additional flags you used to tweak the `dapr run` command behavior (`--app-health-check-path`, `--dapr-grpc-port`, `--unix-domain-socket`, etc.) + +With the Multi-app Dapr Run feature, you can easily start multiple Dapr applications in self-hosted mode using a single `dapr run -f` command. + +## How does it work? + +Currently, upon running [`dapr init`]({{< ref install-dapr-selfhost.md >}}), Dapr initializes in the `~/.dapr/` directory on Linux, where the default configurations and resources are stored. + +For running multiple applications, `dapr init` will initialize the following `~/.dapr/` directory structure: + + + +When developing multiple applications, each **app directory** can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. If the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. + +> This change does not impact the `bin` folder, where the Dapr CLI looks for the `daprd` and `dashboard` binaries. That remains at `~/.dapr/bin/`. + +### The `config.yaml` file + +When you execute `dapr run -f`, Dapr parses the `config.yaml` file initialized with `dapr init`. The following example includes the configurations you can customize to your applications: + +```yaml + +version: 1 +common: (optional) + resources_dir: ./app/components # any dapr resources to be shared across apps + env: # any environment variable shared among apps + - DEBUG: true +apps: + - app_id: webapp ## required + app_dir: ./webapp/ ## required + resources_dir: ./webapp/components # (optional) can be default by convention too, ignore if dir is not found. + config_file: ./webapp/config.yaml # (optional) can be default by convention too, ignore if file is not found. + app_protocol: HTTP + app_port: 8080 + app_health_check_path: "/healthz" # All _ converted to - for all properties defined under daprd section + command: ["python3" "app.py"] + - app_id: backend + app_dir: ./backend/ + app_protocol: GRPC + app_port: 3000 + unix_domain_socket: "/tmp/test-socket" + env: + - DEBUG: false + command: ["./backend"] +``` + +### Precedence rules + + +## Scenario + +todo + +## Next steps \ No newline at end of file diff --git a/daprdocs/content/en/operations/support/support-preview-features.md b/daprdocs/content/en/operations/support/support-preview-features.md index 224d2e065..6b0da1ccc 100644 --- a/daprdocs/content/en/operations/support/support-preview-features.md +++ b/daprdocs/content/en/operations/support/support-preview-features.md @@ -20,3 +20,4 @@ For CLI there is no explicit opt-in, just the version that this was first made a | **App Middleware** | Allow middleware components to be executed when making service-to-service calls | N/A | [App Middleware]({{}}) | v1.9 | | **App health checks** | Allows configuring app health checks | `AppHealthCheck` | [App health checks]({{}}) | v1.9 | | **Pluggable components** | Allows creating self-hosted gRPC-based components written in any language that supports gRPC. The following component APIs are supported: State stores, Pub/sub, Bindings | N/A | [Pluggable components concept]({{}})| v1.9 | +| **Multi-app Run** | Configure multiple Dapr applications from a single configuration file and run from a single command | `dapr run -f` | [Multi-app Dapr Run]({{< ref multi-app-dapr-run.md >}}) | v1.10 | diff --git a/daprdocs/static/images/multi-app-structure.png b/daprdocs/static/images/multi-app-structure.png new file mode 100644 index 0000000000000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8k`l7O;>n15 zAh5b~bBt?%cvb0WxX$8uA5%KJf6p$k+RT+n`njK4s6;R5fqgc4xU%Ai7kB_b$U=8I z14~mT4{ca10NBY)`HTuC2tOAX1?RAS_jlwEL~Gr|-=;`IS2%_q&D!875A&c@C|6Sx zs(_~?-#9#}Q0Dvdg@a$>QzwUq7o8?-s7g%2n^&thIz5jJ8d4rIaEtiFhvT4L(-ETX z-wPa`Ot|i}(mB=cWn=Ou?vwa2)uk5Em1^#1Qv59?Y#;tn>j_LgC;iS*Fylv0oP~aK z`@)0e-<(dGI%zK8|NCuTa%PaLm7ci7{j|$Gqw6a^`!Fg=)jpo(0E!O9U^sKq7PvOZ z^Li?{9n{d(+cnk#eM#oVmdk-ryxUs-4J4gRhrmhPcIA4|5GqVxaeyJ?Gw? zu)6&_+))l)sWLJTA1)LG5QD+krlNn%bO2WDH>n8Ei=@~yicAmMcv73N z*NAT(g%=l8Y2PeLO)7{pNe~s4Zju^6*HPtpMjJV1YZFsB?5}`hr20-(p6yEz?iOfP3i*HqZl@4;dI>TG{8B!xEu@~-%FUmt z8q`%*$u#Ko;hXl%0D@Sl&4PXfR0G?xJyTOtiDMt?vw`{=rH_nB9k#W#1=b14m4b2w yyd$Rg-}XM7|9&~*zuKGsjW+`YNd0L#rujj1wD8l Date: Fri, 27 Jan 2023 14:37:26 -0600 Subject: [PATCH 02/23] pull template into another file Signed-off-by: Hannah Hunter --- .../local-development/multi-app-dapr-run.md | 71 --------------- .../multi-app-dapr-run/_index.md | 7 ++ .../multi-app-dapr-run/multi-app-overview.md | 63 +++++++++++++ .../multi-app-dapr-run/multi-app-template.md | 90 +++++++++++++++++++ daprdocs/content/en/reference/cli/dapr-run.md | 1 + 5 files changed, 161 insertions(+), 71 deletions(-) delete mode 100644 daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md create mode 100644 daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md create mode 100644 daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-overview.md create mode 100644 daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-template.md diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md deleted file mode 100644 index 0006debd9..000000000 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -type: docs -title: Run multiple applications with one command -linkTitle: Multi-app Dapr Run -weight: 2000 -description: Learn the scenarios around running multiple applications with one Dapr command ---- - -{{% alert title="Note" color="primary" %}} - Multi-app `dapr run` is currently a preview feature only supported in Linux/MacOS. -{{% /alert %}} - -Let's say you want to run several applications in local mode while being able to replication the production scenario. While in Kubernets mode, you'd be able to use helm/deployment YAML files, self-hosted mode required you to: - -- Run multiple `dapr run` commands -- Keep track of all ports opened -- Remember the resources folders and configuration files that each application refers to -- Recall all of the additional flags you used to tweak the `dapr run` command behavior (`--app-health-check-path`, `--dapr-grpc-port`, `--unix-domain-socket`, etc.) - -With the Multi-app Dapr Run feature, you can easily start multiple Dapr applications in self-hosted mode using a single `dapr run -f` command. - -## How does it work? - -Currently, upon running [`dapr init`]({{< ref install-dapr-selfhost.md >}}), Dapr initializes in the `~/.dapr/` directory on Linux, where the default configurations and resources are stored. - -For running multiple applications, `dapr init` will initialize the following `~/.dapr/` directory structure: - - - -When developing multiple applications, each **app directory** can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. If the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. - -> This change does not impact the `bin` folder, where the Dapr CLI looks for the `daprd` and `dashboard` binaries. That remains at `~/.dapr/bin/`. - -### The `config.yaml` file - -When you execute `dapr run -f`, Dapr parses the `config.yaml` file initialized with `dapr init`. The following example includes the configurations you can customize to your applications: - -```yaml - -version: 1 -common: (optional) - resources_dir: ./app/components # any dapr resources to be shared across apps - env: # any environment variable shared among apps - - DEBUG: true -apps: - - app_id: webapp ## required - app_dir: ./webapp/ ## required - resources_dir: ./webapp/components # (optional) can be default by convention too, ignore if dir is not found. - config_file: ./webapp/config.yaml # (optional) can be default by convention too, ignore if file is not found. - app_protocol: HTTP - app_port: 8080 - app_health_check_path: "/healthz" # All _ converted to - for all properties defined under daprd section - command: ["python3" "app.py"] - - app_id: backend - app_dir: ./backend/ - app_protocol: GRPC - app_port: 3000 - unix_domain_socket: "/tmp/test-socket" - env: - - DEBUG: false - command: ["./backend"] -``` - -### Precedence rules - - -## Scenario - -todo - -## Next steps \ No newline at end of file diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md new file mode 100644 index 000000000..afbced2f8 --- /dev/null +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md @@ -0,0 +1,7 @@ +--- +type: docs +title: "Multi-app support" +linkTitle: "Multi-app support" +weight: 300 +description: "Support for running multiple Dapr applications with one command" +--- \ No newline at end of file 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 new file mode 100644 index 000000000..8af743ad3 --- /dev/null +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-overview.md @@ -0,0 +1,63 @@ +--- +type: docs +title: Run multiple applications with one command +linkTitle: Multi-app Dapr Run +weight: 1000 +description: Learn the scenarios around running multiple applications with one Dapr command +--- + +{{% alert title="Note" color="primary" %}} + Multi-app `dapr run -f` is currently a preview feature only supported in Linux/MacOS. +{{% /alert %}} + +Let's say you want to run several applications locally to test them together, similar to a production scenario. With a local Kubernetes cluster, you'd be able to do this with helm/deployment YAML files. You'd also have to build them as containers and set up Kubernetes, which can add some complexity. + +Instead, you simply want to run them as local executables in self-hosted mode. However, self-hosted mode requires you to: + +- Run multiple `dapr run` commands +- Keep track of all ports opened (you cannot have duplicate ports for different applications)- Remember the resources folders and configuration files that each application refers to +- Recall all of the additional flags you used to tweak the `dapr run` command behavior (`--app-health-check-path`, `--dapr-grpc-port`, `--unix-domain-socket`, etc.) + +With Multi-app Run, you can easily start multiple applications in self-hosted mode using a single `dapr run -f` command. + +## Multi-app template file + +When you execute `dapr run -f`, Dapr parses the multi-app template file initialized with `dapr init`. By default, this template file is called `dapr.yaml`. + +You can customize the template file by executing `dapr run -f ./.yaml`. + +The following `dapr.yaml` example includes some of the configurations you can customize to your applications. For a more in-depth example and explanation of variables, see [Multi-app template]({{< ref multi-app-template.md >}}). + +```yaml +version: 1 +apps: + - appDirPath: ../../../apps/processor/ + appPort: 9081 + daprHTTPPort: 3510 + command: ["go","run", "app.go"] + - appID: emit-metrics + appDirPath: ../../../apps/emit-metrics/ + daprHTTPPort: 3511 + env: + DAPR_HOST_ADD: localhost + command: ["go","run", "app.go"] +``` + + +## How does it work? + +When running [`dapr init`]({{< ref install-dapr-selfhost.md >}}), this initializes a directory where the default configurations and resources are stored. + +For running multiple applications, `dapr init` will initialize the following `~/.dapr/` directory structure: + + + +When developing multiple applications, each **app directory** can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. If the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. + +> This change does not impact the `bin` folder, where the Dapr CLI looks for the `daprd` and `dashboard` binaries. That remains at `~/.dapr/bin/`. + + +### Precedence rules + + +## Next steps \ No newline at end of file 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 new file mode 100644 index 000000000..14a733e7e --- /dev/null +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/multi-app-template.md @@ -0,0 +1,90 @@ +--- +type: docs +title: Multi-app template file +linkTitle: Multi-app template +weight: 2000 +description: Unpack the multi-app template file and its variables +--- + +{{% alert title="Note" color="primary" %}} + Multi-app `dapr run -f` is currently a preview feature only supported in Linux/MacOS. +{{% /alert %}} + +The multi-app template file is a single YAML configuration file that you can use to configure multiple applications alongside a Dapr sidecar. Execute the following command for Dapr to parse the multi-app template file, named `dapr.yaml` by default: + +```cmd +dapr run -f +``` + +To name the multi-app template file something other than `dapr.yaml`, run: + +```cmd +dapr run -f ./.yaml +``` + +The multi-app template file can include any of the following parameters. + +```yaml +version: 1 +common: # optional section for variables shared across apps + resourcesPath: ./app/components # any dapr resources to be shared across apps + env: # any environment variable shared across apps + - DEBUG: true +apps: + - appID: webapp # required + appDirPath: ./webapp/ # required + resourcesPath: ./webapp/components # (optional) can be default by convention + configFilePath: ./webapp/config.yaml # (optional) can be default by convention too, ignore if file is not found. + appProtocol: HTTP + appPort: 8080 + appHealthCheckPath: "/healthz" # All _ converted to - for all properties defined under daprd section + command: ["python3" "app.py"] + - appID: backend + appDirPath: ./backend/ + appProtocol: GRPC + appPort: 3000 + unixDomainSocket: "/tmp/test-socket" + env: + - DEBUG: false + command: ["./backend"] +``` + +## Parameters + + +| Parameter | Required | Details | Example | +|--------------------------|:--------:|--------|---------| +| `appID` | Y | Your application's app ID | `webapp`, `backend` | +| `appDirPath` | Y | Path to the your application | `./webapp/`, `./backend/` | +| `resourcesPath` | N | Path to your Dapr resources. Can be default by convention; ignore if directory isn't found | `./app/components`, `./webapp/components` | +| `configFilePath` | N | Path to your application's configuration file | `./webapp/config.yaml` | +| `appProtocol` | N | Application protocol | `HTTP`, `GRPC` | +| `appPort` | N | Designated port for your application | `8080`, `3000` | +| `daprHTTPPort` | N | Dapr HTTP port | | +| `daprGRPCPort` | N | Dapr GRPC port | | +| `daprInternalGRPCPort` | N | | | +| `metricsPort` | N | | | +| `unixDomainSocket` | N | Path to the Unix Domain Socket | `/tmp/test-socket` | +| `profilePort` | N | | | +| `enableProfiling` | N | | | +| `apiListenAddresses` | N | Dapr API listen addresses | | +| `logLevel` | N | | | +| `appMaxConcurrency` | N | | | +| `placementHostAddress` | N | | | +| `appSSL` | N | | | +| `daprHTTPMaxRequestSize` | N | | | +| `daprHTTPReadBufferSize` | N | | | +| `enableAppHealthCheck` | N | Enable the app health check on the application | `true`, `false` | +| `appHealthCheckPath` | N | Path to the health check file | `/healthz` | +| `appHealthProbeInterval` | N | App health check interval time range | | +| `appHealthProbeTimeout` | N | When the app health check will timeout | | +| `appHealthThreshold` | N | | | +| `enableApiLogging` | N | | | +| `daprPath` | N | Dapr install path | | +| `env` | N | Map to environment variable; environment variables applied per application will overwrite environment variables shared across applications | `DEBUG`, `DAPR_HOST_ADD` | + +## Scenario + +todo + +## Next steps \ No newline at end of file diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index 995211012..acf0ba8ae 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -35,6 +35,7 @@ dapr run [flags] [command] | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on | | `--enable-profiling` | | `false` | Enable "pprof" profiling via an HTTP endpoint | | `--help`, `-h` | | | Print the help message | +| `--run-file`, `-f` | | Linux/Mac: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once via the multi-app template file | | `--image` | | | Use a custom Docker image. Format is `repository/image` for Docker Hub, or `example.com/repository/image` for a custom registry. | | `--log-level` | | `info` | The log verbosity. Valid values are: `debug`, `info`, `warn`, `error`, `fatal`, or `panic` | | `--enable-api-logging` | | `false` | Enable the logging of all API calls from application to Dapr | From 190e5ffad92b890278fe1fcacd144420857404dc Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 27 Jan 2023 17:07:22 -0600 Subject: [PATCH 03/23] notes from mark Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/multi-app-overview.md | 35 ++++++++++++++++--- .../multi-app-dapr-run/multi-app-template.md | 2 +- 2 files changed, 31 insertions(+), 6 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 8af743ad3..249fa74d3 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 @@ -1,7 +1,7 @@ --- type: docs title: Run multiple applications with one command -linkTitle: Multi-app Dapr Run +linkTitle: Multi-app Run weight: 1000 description: Learn the scenarios around running multiple applications with one Dapr command --- @@ -20,7 +20,7 @@ Instead, you simply want to run them as local executables in self-hosted mode. With Multi-app Run, you can easily start multiple applications in self-hosted mode using a single `dapr run -f` command. -## Multi-app template file +## Multi-app Run template file When you execute `dapr run -f`, Dapr parses the multi-app template file initialized with `dapr init`. By default, this template file is called `dapr.yaml`. @@ -44,20 +44,45 @@ apps: ``` -## How does it work? +## Multi-app Run defaults -When running [`dapr init`]({{< ref install-dapr-selfhost.md >}}), this initializes a directory where the default configurations and resources are stored. -For running multiple applications, `dapr init` will initialize the following `~/.dapr/` directory structure: + + +This is the directory structure that you can use, where these are optional When developing multiple applications, each **app directory** can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. If the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. +1 Go to root .dapr/resources and throw eerything in there and assume all apps will use that directory - all using the same resources path +- point to one place with convention +2 each application can have a different default resources path that you put in application directory +- point to separate places (per app) with convention +3 if you want to call it something other than .dapr, and be explicit about it, you can +- point to different places with whatever names you choose + > This change does not impact the `bin` folder, where the Dapr CLI looks for the `daprd` and `dashboard` binaries. That remains at `~/.dapr/bin/`. +Under .dapr/log folder locally: +app.log - application logs +daprd.log + +Even if you've decided to have a different resources folder, it will still have the logs there ### Precedence rules +## Try it out + + +## Watch the demo + +Watch [this video for an overview on pub/sub multi-tenancy](https://youtu.be/eK463jugo0c?t=1188): + + + + + + ## Next steps \ No newline at end of file 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 14a733e7e..864dfb317 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 @@ -33,7 +33,7 @@ common: # optional section for variables shared across apps apps: - appID: webapp # required appDirPath: ./webapp/ # required - resourcesPath: ./webapp/components # (optional) can be default by convention + resourcesPath: ./webapp/resources # (optional) can be default by convention configFilePath: ./webapp/config.yaml # (optional) can be default by convention too, ignore if file is not found. appProtocol: HTTP appPort: 8080 From 5c8a60e8b3c2100341d8e4e0dad01b2aadbb6e1b Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 27 Jan 2023 18:39:41 -0600 Subject: [PATCH 04/23] updates to wording Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/multi-app-overview.md | 37 +++++++++---------- .../multi-app-dapr-run/multi-app-template.md | 8 ++-- 2 files changed, 21 insertions(+), 24 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 249fa74d3..6bedfbf70 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 @@ -20,7 +20,7 @@ Instead, you simply want to run them as local executables in self-hosted mode. With Multi-app Run, you can easily start multiple applications in self-hosted mode using a single `dapr run -f` command. -## Multi-app Run template file +## Multi-app run template file When you execute `dapr run -f`, Dapr parses the multi-app template file initialized with `dapr init`. By default, this template file is called `dapr.yaml`. @@ -43,32 +43,32 @@ apps: command: ["go","run", "app.go"] ``` +## Approaches for using multi-app run -## Multi-app Run defaults +You have several options when using multi-app run. +### Point to one location (with convention) +When developing multiple applications, each app directory can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. Otherwise, if the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. +You can set all of your applications and resources at the `~/.dapr` root. This is helpful when all applications share the same resources path. -This is the directory structure that you can use, where these are optional +### Point to separate locations (with convention) - +If you decide to add a `.dapr` directory in each app directory, with a `/resources` directory and `config.yaml` file, you can specify different resources paths for each application. This approach remains within convention by using the default `.dapr` -When developing multiple applications, each **app directory** can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. If the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. +### Point to separate locations (custom) -1 Go to root .dapr/resources and throw eerything in there and assume all apps will use that directory - all using the same resources path -- point to one place with convention -2 each application can have a different default resources path that you put in application directory -- point to separate places (per app) with convention -3 if you want to call it something other than .dapr, and be explicit about it, you can -- point to different places with whatever names you choose +You can also name each app directory's `.dapr` directory something other than `.dapr`, like `mymagicapp`, `webapp`, or `backend`. This helps if you'd like to be explicit about resource or application directory paths. -> This change does not impact the `bin` folder, where the Dapr CLI looks for the `daprd` and `dashboard` binaries. That remains at `~/.dapr/bin/`. +## Logs -Under .dapr/log folder locally: -app.log - application logs -daprd.log +Logs are included by default within each app directory and are tracked in the following locations under `.dapr/logs`: -Even if you've decided to have a different resources folder, it will still have the logs there +- `app.log` +- `daprd.log` + +Even if you've decided to rename your resources folder to something other than `.dapr`, the logs will remain there. ### Precedence rules @@ -78,10 +78,7 @@ Even if you've decided to have a different resources folder, it will still have ## Watch the demo -Watch [this video for an overview on pub/sub multi-tenancy](https://youtu.be/eK463jugo0c?t=1188): - - - +Watch [this video for an overview on multi-app run](https://youtu.be/s1p9MNl4VGo?t=2456): 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 864dfb317..ae89bf73e 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 @@ -32,15 +32,15 @@ common: # optional section for variables shared across apps - DEBUG: true apps: - appID: webapp # required - appDirPath: ./webapp/ # required - resourcesPath: ./webapp/resources # (optional) can be default by convention - configFilePath: ./webapp/config.yaml # (optional) can be default by convention too, ignore if file is not found. + appDirPath: .dapr/webapp/ # required + resourcesPath: .dapr/resources # (optional) can be default by convention + configFilePath: .dapr/config.yaml # (optional) can be default by convention too, ignore if file is not found. appProtocol: HTTP appPort: 8080 appHealthCheckPath: "/healthz" # All _ converted to - for all properties defined under daprd section command: ["python3" "app.py"] - appID: backend - appDirPath: ./backend/ + appDirPath: .dapr/backend/ appProtocol: GRPC appPort: 3000 unixDomainSocket: "/tmp/test-socket" From 89dbc9ab6825f0ba7c095539151660f1b6585f1f Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 27 Jan 2023 18:48:58 -0600 Subject: [PATCH 05/23] capitalization consistency; add overview to title Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/multi-app-overview.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 6bedfbf70..16ae25dcd 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 @@ -1,7 +1,7 @@ --- type: docs title: Run multiple applications with one command -linkTitle: Multi-app Run +linkTitle: Multi-app Run overview weight: 1000 description: Learn the scenarios around running multiple applications with one Dapr command --- @@ -20,7 +20,7 @@ Instead, you simply want to run them as local executables in self-hosted mode. With Multi-app Run, you can easily start multiple applications in self-hosted mode using a single `dapr run -f` command. -## Multi-app run template file +## Multi-app Run template file When you execute `dapr run -f`, Dapr parses the multi-app template file initialized with `dapr init`. By default, this template file is called `dapr.yaml`. @@ -43,9 +43,9 @@ apps: command: ["go","run", "app.go"] ``` -## Approaches for using multi-app run +## Approaches for using Multi-app Run -You have several options when using multi-app run. +You have several options when using Multi-app Run. ### Point to one location (with convention) @@ -78,7 +78,7 @@ Even if you've decided to rename your resources folder to something other than ` ## Watch the demo -Watch [this video for an overview on multi-app run](https://youtu.be/s1p9MNl4VGo?t=2456): +Watch [this video for an overview on Multi-app Run](https://youtu.be/s1p9MNl4VGo?t=2456): From 4a2440dbc63506a0de1117b22ea0f6db17a5887c Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 27 Jan 2023 18:51:01 -0600 Subject: [PATCH 06/23] typo Signed-off-by: Hannah Hunter --- .../local-development/multi-app-dapr-run/multi-app-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ae89bf73e..1b3425c75 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 @@ -1,7 +1,7 @@ --- type: docs title: Multi-app template file -linkTitle: Multi-app template +linkTitle: Multi-app Run template weight: 2000 description: Unpack the multi-app template file and its variables --- From 716d75f2cb718f332cc0b1c09d6d9a699fe995eb Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Mon, 30 Jan 2023 09:44:57 -0600 Subject: [PATCH 07/23] update per Mark review Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/_index.md | 4 +- .../multi-app-dapr-run/multi-app-overview.md | 53 ++++++++-------- .../multi-app-dapr-run/multi-app-template.md | 63 ++++++++++--------- .../support/support-preview-features.md | 2 +- daprdocs/content/en/reference/cli/dapr-run.md | 2 +- 5 files changed, 65 insertions(+), 59 deletions(-) diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md index afbced2f8..8474af033 100644 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md @@ -1,7 +1,7 @@ --- type: docs -title: "Multi-app support" -linkTitle: "Multi-app support" +title: "Multi-app run" +linkTitle: "Multi-app run" weight: 300 description: "Support for running multiple Dapr applications with one command" --- \ No newline at end of file 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 16ae25dcd..01f28ae86 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 @@ -1,13 +1,13 @@ --- type: docs -title: Run multiple applications with one command -linkTitle: Multi-app Run overview +title: Multi-app Run (MapR) overview +linkTitle: MapR overview weight: 1000 -description: Learn the scenarios around running multiple applications with one Dapr command +description: Learn the scenarios around running multiple applications with one CLI command --- {{% alert title="Note" color="primary" %}} - Multi-app `dapr run -f` is currently a preview feature only supported in Linux/MacOS. + MapR (Multi-app Run using `dapr run -f`) is currently a preview feature only supported in Linux/MacOS. {{% /alert %}} Let's say you want to run several applications locally to test them together, similar to a production scenario. With a local Kubernetes cluster, you'd be able to do this with helm/deployment YAML files. You'd also have to build them as containers and set up Kubernetes, which can add some complexity. @@ -15,23 +15,25 @@ Let's say you want to run several applications locally to test them together, si Instead, you simply want to run them as local executables in self-hosted mode. However, self-hosted mode requires you to: - Run multiple `dapr run` commands -- Keep track of all ports opened (you cannot have duplicate ports for different applications)- Remember the resources folders and configuration files that each application refers to +- Keep track of all ports opened (you cannot have duplicate ports for different applications). +- Remember the resources folders and configuration files that each application refers to. - Recall all of the additional flags you used to tweak the `dapr run` command behavior (`--app-health-check-path`, `--dapr-grpc-port`, `--unix-domain-socket`, etc.) -With Multi-app Run, you can easily start multiple applications in self-hosted mode using a single `dapr run -f` command. +With Multi-app Run, you can start multiple applications in self-hosted mode using a single `dapr run -f` command using a template file. The template file describes how to start multiple applications as if you had run many separate CLI `run`commands. By default, this template file is called `dapr.yaml`. -## Multi-app Run template file +## MapR template file -When you execute `dapr run -f`, Dapr parses the multi-app template file initialized with `dapr init`. By default, this template file is called `dapr.yaml`. +When you execute `dapr run -f`, uses the multi-app template file to run all the applications. -You can customize the template file by executing `dapr run -f ./.yaml`. +You can name template file with preferred name other than the default. For example `dapr run -f ./.yaml`. -The following `dapr.yaml` example includes some of the configurations you can customize to your applications. For a more in-depth example and explanation of variables, see [Multi-app template]({{< ref multi-app-template.md >}}). +The following `dapr.yaml` example includes some of the template properties you can customize for your applications. In the example, you can simultaneously launch 2 applications with app IDs of `processor` and `emit-metrics`. ```yaml version: 1 apps: - - appDirPath: ../../../apps/processor/ + - appID: processor + appDirPath: ../../../apps/processor/ appPort: 9081 daprHTTPPort: 3510 command: ["go","run", "app.go"] @@ -43,23 +45,25 @@ apps: command: ["go","run", "app.go"] ``` -## Approaches for using Multi-app Run +For a more in-depth example and explanation of the template properties, see [Multi-app template]({{< ref multi-app-template.md >}}). -You have several options when using Multi-app Run. +## Locations for resources and configuration files -### Point to one location (with convention) +You have options on where to place your applications' resources and configuration files when using MapR. + +### Point to one file location (with convention) + +You can set all of your applications resources and configurations at the `~/.dapr` root. This is helpful when all applications share the same resources path, like when testing on a local machine. + +### Separate file locations for each application (with convention) When developing multiple applications, each app directory can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. Otherwise, if the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. -You can set all of your applications and resources at the `~/.dapr` root. This is helpful when all applications share the same resources path. - -### Point to separate locations (with convention) - If you decide to add a `.dapr` directory in each app directory, with a `/resources` directory and `config.yaml` file, you can specify different resources paths for each application. This approach remains within convention by using the default `.dapr` ### Point to separate locations (custom) -You can also name each app directory's `.dapr` directory something other than `.dapr`, like `mymagicapp`, `webapp`, or `backend`. This helps if you'd like to be explicit about resource or application directory paths. +You can also name each app directory's `.dapr` directory something other than `.dapr`, such as, `webapp`, or `backend`. This helps if you'd like to be explicit about resource or application directory paths. ## Logs @@ -68,18 +72,17 @@ Logs are included by default within each app directory and are tracked in the fo - `app.log` - `daprd.log` -Even if you've decided to rename your resources folder to something other than `.dapr`, the logs will remain there. - -### Precedence rules - +Even if you've decided to rename your resources folder to something other than `.dapr`, the logs file are written to `.dapr` folder. ## Try it out ## Watch the demo -Watch [this video for an overview on Multi-app Run](https://youtu.be/s1p9MNl4VGo?t=2456): +Watch [this video for an overview on MapR](https://youtu.be/s1p9MNl4VGo?t=2456): -## Next steps \ No newline at end of file +## Next steps + +[Unpack the MapR template file and its properties]({{< ref multi-app-template.md >}}) \ No newline at end of file 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 1b3425c75..e1f1b206e 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 @@ -1,28 +1,30 @@ --- type: docs -title: Multi-app template file -linkTitle: Multi-app Run template +title: MapR template file +linkTitle: MapR template weight: 2000 -description: Unpack the multi-app template file and its variables +description: Unpack the MapR template file and its properties --- {{% alert title="Note" color="primary" %}} - Multi-app `dapr run -f` is currently a preview feature only supported in Linux/MacOS. + MapR (Multi-app Run using `dapr run -f`) is currently a preview feature only supported in Linux/MacOS. {{% /alert %}} -The multi-app template file is a single YAML configuration file that you can use to configure multiple applications alongside a Dapr sidecar. Execute the following command for Dapr to parse the multi-app template file, named `dapr.yaml` by default: +The MapR template file is a YAML file that you can use to run multiple applications at once. Execute the following CLI command to read the MapR template file, named `dapr.yaml` by default: ```cmd +// the template file needs to be called `dapr.yaml` by default + dapr run -f ``` -To name the multi-app template file something other than `dapr.yaml`, run: +If the MapR template file is named something other than `dapr.yaml`, run: ```cmd dapr run -f ./.yaml ``` -The multi-app template file can include any of the following parameters. +The MapR template file can include the following properties. Below is an example template showing two applications that are configured with some of the properties. ```yaml version: 1 @@ -49,42 +51,43 @@ apps: command: ["./backend"] ``` -## Parameters +## Template properties + +The properties for the MapR template align with the `dapr run` CLI flags, [listed in the CLI reference documentation]({{< ref run.md >}}). -| Parameter | Required | Details | Example | +| Properties | Required | Details | Example | |--------------------------|:--------:|--------|---------| -| `appID` | Y | Your application's app ID | `webapp`, `backend` | -| `appDirPath` | Y | Path to the your application | `./webapp/`, `./backend/` | +| `appID` | Y | Application's app ID | `webapp`, `backend` | +| `appDirPath` | Y | Path to the your application code | `./webapp/`, `./backend/` | | `resourcesPath` | N | Path to your Dapr resources. Can be default by convention; ignore if directory isn't found | `./app/components`, `./webapp/components` | | `configFilePath` | N | Path to your application's configuration file | `./webapp/config.yaml` | -| `appProtocol` | N | Application protocol | `HTTP`, `GRPC` | -| `appPort` | N | Designated port for your application | `8080`, `3000` | +| `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 | | | -| `metricsPort` | N | | | -| `unixDomainSocket` | N | Path to the Unix Domain Socket | `/tmp/test-socket` | -| `profilePort` | N | | | -| `enableProfiling` | N | | | +| `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 | | | -| `appMaxConcurrency` | N | | | +| `logLevel` | N | The log verbosity. | | +| `appMaxConcurrency` | N | The concurrency level of the application; default is unlimited | | | `placementHostAddress` | N | | | -| `appSSL` | N | | | -| `daprHTTPMaxRequestSize` | N | | | -| `daprHTTPReadBufferSize` | 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 | App health check interval time range | | -| `appHealthProbeTimeout` | N | When the app health check will timeout | | -| `appHealthThreshold` | N | | | -| `enableApiLogging` | N | | | +| `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 | | | `daprPath` | N | Dapr install path | | | `env` | N | Map to environment variable; environment variables applied per application will overwrite environment variables shared across applications | `DEBUG`, `DAPR_HOST_ADD` | -## Scenario +## Next steps -todo - -## Next steps \ No newline at end of file +[Try out the MapR template using the Distributed Calculator tutorial] \ No newline at end of file diff --git a/daprdocs/content/en/operations/support/support-preview-features.md b/daprdocs/content/en/operations/support/support-preview-features.md index 6b0da1ccc..769ee842a 100644 --- a/daprdocs/content/en/operations/support/support-preview-features.md +++ b/daprdocs/content/en/operations/support/support-preview-features.md @@ -20,4 +20,4 @@ For CLI there is no explicit opt-in, just the version that this was first made a | **App Middleware** | Allow middleware components to be executed when making service-to-service calls | N/A | [App Middleware]({{}}) | v1.9 | | **App health checks** | Allows configuring app health checks | `AppHealthCheck` | [App health checks]({{}}) | v1.9 | | **Pluggable components** | Allows creating self-hosted gRPC-based components written in any language that supports gRPC. The following component APIs are supported: State stores, Pub/sub, Bindings | N/A | [Pluggable components concept]({{}})| v1.9 | -| **Multi-app Run** | Configure multiple Dapr applications from a single configuration file and run from a single command | `dapr run -f` | [Multi-app Dapr Run]({{< ref multi-app-dapr-run.md >}}) | v1.10 | +| **MapR** | Configure multiple Dapr applications from a single configuration file and run from a single command | `dapr run -f` | [MapR]({{< ref multi-app-dapr-run.md >}}) | v1.10 | diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index acf0ba8ae..af82c3b35 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -35,7 +35,7 @@ dapr run [flags] [command] | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on | | `--enable-profiling` | | `false` | Enable "pprof" profiling via an HTTP endpoint | | `--help`, `-h` | | | Print the help message | -| `--run-file`, `-f` | | Linux/Mac: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once via the multi-app template file | +| `--run-file`, `-f` | | Linux/Mac: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once using a multi-app run (MapR) template file | | `--image` | | | Use a custom Docker image. Format is `repository/image` for Docker Hub, or `example.com/repository/image` for a custom registry. | | `--log-level` | | `info` | The log verbosity. Valid values are: `debug`, `info`, `warn`, `error`, `fatal`, or `panic` | | `--enable-api-logging` | | `false` | Enable the logging of all API calls from application to Dapr | From 238b8987f58a3390a0980ba236de6446bc90b950 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Mon, 30 Jan 2023 10:05:46 -0600 Subject: [PATCH 08/23] fix link Signed-off-by: Hannah Hunter --- .../local-development/multi-app-dapr-run/_index.md | 4 ++-- .../multi-app-dapr-run/multi-app-template.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md index 8474af033..c85773ab1 100644 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md @@ -1,7 +1,7 @@ --- type: docs -title: "Multi-app run" -linkTitle: "Multi-app run" +title: "Multi-app Run (MapR)" +linkTitle: "Multi-app Run (MapR)" weight: 300 description: "Support for running multiple Dapr applications with one command" --- \ No newline at end of file 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 e1f1b206e..63ff2c344 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 @@ -53,7 +53,7 @@ apps: ## Template properties -The properties for the MapR template align with the `dapr run` CLI flags, [listed in the CLI reference documentation]({{< ref run.md >}}). +The properties for the MapR template align with the `dapr run` CLI flags, [listed in the CLI reference documentation]({{< ref "dapr-run.md#flags" >}}). | Properties | Required | Details | Example | From 0164ee6f33f9329f8b8f43b410e10774c4ee1e34 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Mon, 30 Jan 2023 10:42:48 -0600 Subject: [PATCH 09/23] update internal grpc port table entry Signed-off-by: Hannah Hunter --- .../local-development/multi-app-dapr-run/multi-app-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 63ff2c344..b77fafa41 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 @@ -66,7 +66,7 @@ The properties for the MapR template align with the `dapr run` CLI flags, [liste | `appPort` | N | The port your application is listening on | `8080`, `3000` | | `daprHTTPPort` | N | Dapr HTTP port | | | `daprGRPCPort` | N | Dapr GRPC port | | -| `daprInternalGRPCPort` | N | | | +| `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 | | From 1a6564f7fbd62b92edcd088433c933876358d9f5 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 31 Jan 2023 16:02:16 -0600 Subject: [PATCH 10/23] remove weird comment in example Signed-off-by: Hannah Hunter --- .../local-development/multi-app-dapr-run/multi-app-template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b77fafa41..37e2727f9 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 @@ -39,7 +39,7 @@ apps: configFilePath: .dapr/config.yaml # (optional) can be default by convention too, ignore if file is not found. appProtocol: HTTP appPort: 8080 - appHealthCheckPath: "/healthz" # All _ converted to - for all properties defined under daprd section + appHealthCheckPath: "/healthz" command: ["python3" "app.py"] - appID: backend appDirPath: .dapr/backend/ From caaa1e7c7d6f2f352d2ec7d9e50d5d187ac9de62 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Thu, 2 Feb 2023 11:32:59 -0600 Subject: [PATCH 11/23] pravin review Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/multi-app-overview.md | 9 +++------ .../multi-app-dapr-run/multi-app-template.md | 8 +++++--- 2 files changed, 8 insertions(+), 9 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 01f28ae86..734834286 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 @@ -67,16 +67,13 @@ You can also name each app directory's `.dapr` directory something other than `. ## Logs -Logs are included by default within each app directory and are tracked in the following locations under `.dapr/logs`: +Logs for application and `daprd` are captured in separate files. These log files are created automatically under `.dapr/logs` directory under each app director. These log file names follow the below pattern: -- `app.log` -- `daprd.log` +- `_app_.log` (file name format for app's log) +- `_daprd_.log` (file name format for `daprd` log) Even if you've decided to rename your resources folder to something other than `.dapr`, the logs file are written to `.dapr` folder. -## Try it out - - ## Watch the demo Watch [this video for an overview on MapR](https://youtu.be/s1p9MNl4VGo?t=2456): 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 37e2727f9..65fff9a6d 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 @@ -33,7 +33,7 @@ common: # optional section for variables shared across apps env: # any environment variable shared across apps - DEBUG: true apps: - - appID: webapp # required + - appID: webapp appDirPath: .dapr/webapp/ # required resourcesPath: .dapr/resources # (optional) can be default by convention configFilePath: .dapr/config.yaml # (optional) can be default by convention too, ignore if file is not found. @@ -58,8 +58,8 @@ The properties for the MapR template align with the `dapr run` CLI flags, [liste | Properties | Required | Details | Example | |--------------------------|:--------:|--------|---------| -| `appID` | Y | Application's app ID | `webapp`, `backend` | | `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` | | `resourcesPath` | N | Path to your Dapr resources. Can be default by convention; ignore if directory isn't found | `./app/components`, `./webapp/components` | | `configFilePath` | N | Path to your application's configuration file | `./webapp/config.yaml` | | `appProtocol` | N | The protocol Dapr uses to talk to the application. | `HTTP`, `GRPC` | @@ -90,4 +90,6 @@ The properties for the MapR template align with the `dapr run` CLI flags, [liste ## Next steps -[Try out the MapR template using the Distributed Calculator tutorial] \ No newline at end of file +Watch [this video for an overview on MapR](https://youtu.be/s1p9MNl4VGo?t=2456): + + From 9b12a599c8bfc1670af253ec10447d2c2a8ea89a Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 3 Feb 2023 10:33:52 -0600 Subject: [PATCH 12/23] updates per mukundand and pravin Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/multi-app-overview.md | 16 ++--- .../multi-app-dapr-run/multi-app-template.md | 58 +++++++++++++++++-- 2 files changed, 61 insertions(+), 13 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 734834286..b5b8c7b3c 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 @@ -23,7 +23,7 @@ With Multi-app Run, you can start multiple applications in self-hosted mode usin ## MapR template file -When you execute `dapr run -f`, uses the multi-app template file to run all the applications. +When you execute `dapr run -f .`, it uses the multi-app template file (named `dapr.yaml`) present in the current directory to run all the applications. You can name template file with preferred name other than the default. For example `dapr run -f ./.yaml`. @@ -33,12 +33,12 @@ The following `dapr.yaml` example includes some of the template properties you c version: 1 apps: - appID: processor - appDirPath: ../../../apps/processor/ + appDirPath: ../apps/processor/ appPort: 9081 daprHTTPPort: 3510 command: ["go","run", "app.go"] - appID: emit-metrics - appDirPath: ../../../apps/emit-metrics/ + appDirPath: ../apps/emit-metrics/ daprHTTPPort: 3511 env: DAPR_HOST_ADD: localhost @@ -57,9 +57,9 @@ You can set all of your applications resources and configurations at the `~/.dap ### Separate file locations for each application (with convention) -When developing multiple applications, each app directory can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. Otherwise, if the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. +When using MapR, each application directory can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. Otherwise, if the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. -If you decide to add a `.dapr` directory in each app directory, with a `/resources` directory and `config.yaml` file, you can specify different resources paths for each application. This approach remains within convention by using the default `.dapr` +If you decide to add a `.dapr` directory in each application directory, with a `/resources` directory and `config.yaml` file, you can specify different resources paths for each application. This approach remains within convention by using the default `~/.dapr`. ### Point to separate locations (custom) @@ -67,12 +67,12 @@ You can also name each app directory's `.dapr` directory something other than `. ## Logs -Logs for application and `daprd` are captured in separate files. These log files are created automatically under `.dapr/logs` directory under each app director. These log file names follow the below pattern: +Logs for application and `daprd` are captured in separate files. These log files are created automatically under `.dapr/logs` directory under each application directory (`appDirPath` in the template). These log file names follow the pattern seen below: -- `_app_.log` (file name format for app's log) +- `_app_.log` (file name format for `app` log) - `_daprd_.log` (file name format for `daprd` log) -Even if you've decided to rename your resources folder to something other than `.dapr`, the logs file are written to `.dapr` folder. +Even if you've decided to rename your resources folder to something other than `.dapr`, the log files are written only to the `.dapr/logs` folder (created in the application directory). ## Watch the demo 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 65fff9a6d..4a22f188b 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 @@ -1,7 +1,7 @@ --- type: docs -title: MapR template file -linkTitle: MapR template +title: "How to: Use the MapR template file" +linkTitle: "How to: Use the MapR template" weight: 2000 description: Unpack the MapR template file and its properties --- @@ -10,20 +10,59 @@ description: Unpack the MapR template file and its properties MapR (Multi-app Run using `dapr run -f`) is currently a preview feature only supported in Linux/MacOS. {{% /alert %}} -The MapR template file is a YAML file that you can use to run multiple applications at once. Execute the following CLI command to read the MapR template file, named `dapr.yaml` by default: +The MapR template file is a YAML file that you can use to run multiple applications at once. In this guide, you'll learn how to: +- Use the multi-app template +- View started applications +- Stop the multi-app template +- Stucture the multi-app template file + +## Use the multi-app template + +You can use the multi-app template file in one of the following two ways: + +### Execute by providing a directory path + +When you provide a directory path, the CLI will try to locate the MapR template file, named `dapr.yaml` by default in the directory. If the file is not found, the CLI will return an error. + +Execute the following CLI command to read the MapR template file, named `dapr.yaml` by default: ```cmd // the template file needs to be called `dapr.yaml` by default -dapr run -f +dapr run -f ``` -If the MapR template file is named something other than `dapr.yaml`, run: +### Execute by providing a file path + +If the MapR template file is named something other than `dapr.yaml`, then you can provide the relative or absolute file path to the command: ```cmd dapr run -f ./.yaml ``` +## View the started applications + +Once the multi-app template is running, you can view the started applications with the following command: + +```cmd +dapr list +``` + +## Stop the multi-app template + +Stop the multi-app run template anytime with either of the following commands: + +```cmd +dapr stop -f +``` +or: + +```cmd +dapr stop -f dapr.yaml +``` + +## Template file structure + The MapR template file can include the following properties. Below is an example template showing two applications that are configured with some of the properties. ```yaml @@ -51,6 +90,15 @@ apps: command: ["./backend"] ``` +{{% alert title="Important" color="warning" %}} +The following rules apply for all the paths present in the template file: + - If the path is absolute, it is used as is. + - All relative paths under comman section should be provided relative to the template file path. + - `appDirPath` under apps section should be provided relative to the template file path. + - All relative paths under app section should be provided relative to the appDirPath. + +{{% /alert %}} + ## Template properties The properties for the MapR template align with the `dapr run` CLI flags, [listed in the CLI reference documentation]({{< ref "dapr-run.md#flags" >}}). From c408e460ee5d3bb2e807b1ed3f2ba0329ec4f284 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 3 Feb 2023 16:04:43 -0600 Subject: [PATCH 13/23] remove mapr Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/_index.md | 4 ++-- .../multi-app-dapr-run/multi-app-overview.md | 16 +++++++------- .../multi-app-dapr-run/multi-app-template.md | 22 +++++++++---------- .../en/getting-started/quickstarts/_index.md | 1 - .../support/support-preview-features.md | 2 +- daprdocs/content/en/reference/cli/dapr-run.md | 2 +- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md index c85773ab1..aecd74114 100644 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md @@ -1,7 +1,7 @@ --- type: docs -title: "Multi-app Run (MapR)" -linkTitle: "Multi-app Run (MapR)" +title: "Multi-app Run" +linkTitle: "Multi-app Run" weight: 300 description: "Support for running multiple Dapr applications with one command" --- \ No newline at end of file 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 b5b8c7b3c..f2f3fd654 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 @@ -1,13 +1,13 @@ --- type: docs -title: Multi-app Run (MapR) overview -linkTitle: MapR overview +title: Multi-app Run overview +linkTitle: Multi-App Run overview weight: 1000 description: Learn the scenarios around running multiple applications with one CLI command --- {{% alert title="Note" color="primary" %}} - MapR (Multi-app Run using `dapr run -f`) is currently a preview feature only supported in Linux/MacOS. + Multi-App Run is currently a preview feature only supported in Linux/MacOS. {{% /alert %}} Let's say you want to run several applications locally to test them together, similar to a production scenario. With a local Kubernetes cluster, you'd be able to do this with helm/deployment YAML files. You'd also have to build them as containers and set up Kubernetes, which can add some complexity. @@ -21,7 +21,7 @@ Instead, you simply want to run them as local executables in self-hosted mode. With Multi-app Run, you can start multiple applications in self-hosted mode using a single `dapr run -f` command using a template file. The template file describes how to start multiple applications as if you had run many separate CLI `run`commands. By default, this template file is called `dapr.yaml`. -## MapR template file +## Multi-App Run template file When you execute `dapr run -f .`, it uses the multi-app template file (named `dapr.yaml`) present in the current directory to run all the applications. @@ -49,7 +49,7 @@ For a more in-depth example and explanation of the template properties, see [Mul ## Locations for resources and configuration files -You have options on where to place your applications' resources and configuration files when using MapR. +You have options on where to place your applications' resources and configuration files when using Multi-App Run. ### Point to one file location (with convention) @@ -57,7 +57,7 @@ You can set all of your applications resources and configurations at the `~/.dap ### Separate file locations for each application (with convention) -When using MapR, each application directory can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. Otherwise, if the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. +When using Multi-App Run, each application directory can have a `.dapr` folder, which contains a `config.yaml` file and a `resources` directory. Otherwise, if the `.dapr` directory is not present within the app directory, the default `~/.dapr/resources/` and `~/.dapr/config.yaml` locations are used. If you decide to add a `.dapr` directory in each application directory, with a `/resources` directory and `config.yaml` file, you can specify different resources paths for each application. This approach remains within convention by using the default `~/.dapr`. @@ -76,10 +76,10 @@ Even if you've decided to rename your resources folder to something other than ` ## Watch the demo -Watch [this video for an overview on MapR](https://youtu.be/s1p9MNl4VGo?t=2456): +Watch [this video for an overview on Multi-App Run](https://youtu.be/s1p9MNl4VGo?t=2456): ## Next steps -[Unpack the MapR template file and its properties]({{< ref multi-app-template.md >}}) \ No newline at end of file +[Unpack the Multi-App Run template file and its properties]({{< ref multi-app-template.md >}}) \ No newline at end of file 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 4a22f188b..fa0d7dd4f 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 @@ -1,16 +1,16 @@ --- type: docs -title: "How to: Use the MapR template file" -linkTitle: "How to: Use the MapR template" +title: "How to: Use the Multi-App Run template file" +linkTitle: "How to: Use the Multi-App Run template" weight: 2000 -description: Unpack the MapR template file and its properties +description: Unpack the Multi-App Run template file and its properties --- {{% alert title="Note" color="primary" %}} - MapR (Multi-app Run using `dapr run -f`) is currently a preview feature only supported in Linux/MacOS. + Multi-App Run is currently a preview feature only supported in Linux/MacOS. {{% /alert %}} -The MapR template file is a YAML file that you can use to run multiple applications at once. In this guide, you'll learn how to: +The Multi-App Run template file is a YAML file that you can use to run multiple applications at once. In this guide, you'll learn how to: - Use the multi-app template - View started applications - Stop the multi-app template @@ -22,9 +22,9 @@ You can use the multi-app template file in one of the following two ways: ### Execute by providing a directory path -When you provide a directory path, the CLI will try to locate the MapR template file, named `dapr.yaml` by default in the directory. If the file is not found, the CLI will return an error. +When you provide a directory path, the CLI will try to locate the Multi-App Run template file, named `dapr.yaml` by default in the directory. If the file is not found, the CLI will return an error. -Execute the following CLI command to read the MapR template file, named `dapr.yaml` by default: +Execute the following CLI command to read the Multi-App Run template file, named `dapr.yaml` by default: ```cmd // the template file needs to be called `dapr.yaml` by default @@ -34,7 +34,7 @@ dapr run -f ### Execute by providing a file path -If the MapR template file is named something other than `dapr.yaml`, then you can provide the relative or absolute file path to the command: +If the Multi-App Run template file is named something other than `dapr.yaml`, then you can provide the relative or absolute file path to the command: ```cmd dapr run -f ./.yaml @@ -63,7 +63,7 @@ dapr stop -f dapr.yaml ## Template file structure -The MapR template file can include the following properties. Below is an example template showing two applications that are configured with some of the properties. +The Multi-App Run template file can include the following properties. Below is an example template showing two applications that are configured with some of the properties. ```yaml version: 1 @@ -101,7 +101,7 @@ The following rules apply for all the paths present in the template file: ## Template properties -The properties for the MapR template align with the `dapr run` CLI flags, [listed in the CLI reference documentation]({{< ref "dapr-run.md#flags" >}}). +The properties for the Multi-App Run template align with the `dapr run` CLI flags, [listed in the CLI reference documentation]({{< ref "dapr-run.md#flags" >}}). | Properties | Required | Details | Example | @@ -138,6 +138,6 @@ The properties for the MapR template align with the `dapr run` CLI flags, [liste ## Next steps -Watch [this video for an overview on MapR](https://youtu.be/s1p9MNl4VGo?t=2456): +Watch [this video for an overview on Multi-App Run](https://youtu.be/s1p9MNl4VGo?t=2456): diff --git a/daprdocs/content/en/getting-started/quickstarts/_index.md b/daprdocs/content/en/getting-started/quickstarts/_index.md index 4e47d39e4..727b9a17b 100644 --- a/daprdocs/content/en/getting-started/quickstarts/_index.md +++ b/daprdocs/content/en/getting-started/quickstarts/_index.md @@ -29,4 +29,3 @@ Hit the ground running with our Dapr quickstarts, complete with code samples aim | [Secrets Management]({{< ref secrets-quickstart.md >}}) | Securely fetch secrets. | | [Configuration]({{< ref configuration-quickstart.md >}}) | Get configuration items and subscribe for configuration updates. | | [Resiliency]({{< ref resiliency >}}) | Define and apply fault-tolerance policies to your Dapr API requests. | - diff --git a/daprdocs/content/en/operations/support/support-preview-features.md b/daprdocs/content/en/operations/support/support-preview-features.md index e17636760..ec474b0f4 100644 --- a/daprdocs/content/en/operations/support/support-preview-features.md +++ b/daprdocs/content/en/operations/support/support-preview-features.md @@ -19,5 +19,5 @@ For CLI there is no explicit opt-in, just the version that this was first made a | **App Middleware** | Allow middleware components to be executed when making service-to-service calls | N/A | [App Middleware]({{}}) | v1.9 | | **App health checks** | Allows configuring app health checks | `AppHealthCheck` | [App health checks]({{}}) | v1.9 | | **Pluggable components** | Allows creating self-hosted gRPC-based components written in any language that supports gRPC. The following component APIs are supported: State stores, Pub/sub, Bindings | N/A | [Pluggable components concept]({{}})| v1.9 | -| **MapR** | Configure multiple Dapr applications from a single configuration file and run from a single command | `dapr run -f` | [MapR]({{< ref multi-app-dapr-run.md >}}) | v1.10 | +| **Multi-App Run** | Configure multiple Dapr applications from a single configuration file and run from a single command | `dapr run -f` | [Multi-App Run]({{< ref multi-app-dapr-run.md >}}) | v1.10 | | **Workflows** | Author workflows as code to automate and orchestrate tasks within your application, like messaging, state management, and failure handling | N/A | [Workflows concept]({{< ref "components-concept#workflows" >}})| v1.10 | \ No newline at end of file diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index 67e23a240..9191741f4 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -34,7 +34,7 @@ dapr run [flags] [command] | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on | | `--enable-profiling` | | `false` | Enable "pprof" profiling via an HTTP endpoint | | `--help`, `-h` | | | Print the help message | -| `--run-file`, `-f` | | Linux/Mac: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once using a multi-app run (MapR) template file | +| `--run-file`, `-f` | | Linux/Mac: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once using a Multi-App Run template file | | `--image` | | | Use a custom Docker image. Format is `repository/image` for Docker Hub, or `example.com/repository/image` for a custom registry. | | `--log-level` | | `info` | The log verbosity. Valid values are: `debug`, `info`, `warn`, `error`, `fatal`, or `panic` | | `--enable-api-logging` | | `false` | Enable the logging of all API calls from application to Dapr | From 23eafed4698fb8e4a15b8e56214861275a43faba Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Fri, 3 Feb 2023 17:51:37 -0600 Subject: [PATCH 14/23] remove --image-registry from preview features table (#3136) Signed-off-by: Hannah Hunter --- .../content/en/operations/support/support-preview-features.md | 1 - 1 file changed, 1 deletion(-) diff --git a/daprdocs/content/en/operations/support/support-preview-features.md b/daprdocs/content/en/operations/support/support-preview-features.md index 650c7f169..66af5f2cc 100644 --- a/daprdocs/content/en/operations/support/support-preview-features.md +++ b/daprdocs/content/en/operations/support/support-preview-features.md @@ -15,7 +15,6 @@ For CLI there is no explicit opt-in, just the version that this was first made a | Feature | Description | Setting | Documentation | Version introduced | | ---------- |-------------|---------|---------------|-----------------| -| **`--image-registry`** flag in Dapr CLI| In self-hosted mode, you can set this flag to specify any private registry to pull the container images required to install Dapr| N/A | [CLI `init` command reference]({{< ref "dapr-init.md#self-hosted-environment" >}}) | v1.7 | | **App Middleware** | Allow middleware components to be executed when making service-to-service calls | N/A | [App Middleware]({{< ref "middleware.md#app-middleware" >}}) | v1.9 | | **App health checks** | Allows configuring app health checks | `AppHealthCheck` | [App health checks]({{< ref "app-health.md" >}}) | v1.9 | | **Pluggable components** | Allows creating self-hosted gRPC-based components written in any language that supports gRPC. The following component APIs are supported: State stores, Pub/sub, Bindings | N/A | [Pluggable components concept]({{< ref "components-concept#pluggable-components" >}})| v1.9 | From 6602c68775e0e1ce996a565fbc3abbed087097d7 Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Fri, 3 Feb 2023 17:20:23 -0800 Subject: [PATCH 15/23] Add metrics regex docs (#3126) * add metrics regex Signed-off-by: yaron2 * Update daprdocs/content/en/operations/monitoring/metrics/metrics-overview.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Yaron Schneider --------- Signed-off-by: yaron2 Signed-off-by: Yaron Schneider Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> --- .../monitoring/metrics/metrics-overview.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/daprdocs/content/en/operations/monitoring/metrics/metrics-overview.md b/daprdocs/content/en/operations/monitoring/metrics/metrics-overview.md index f3091c237..bfe21154e 100644 --- a/daprdocs/content/en/operations/monitoring/metrics/metrics-overview.md +++ b/daprdocs/content/en/operations/monitoring/metrics/metrics-overview.md @@ -72,6 +72,30 @@ spec: enabled: false ``` +## High cardinality metrics + +Depending on your use case, some metrics emitted by Dapr might contain values that have a high cardinality. This might cause increased memory usage for the Dapr process/container and incur expensive egress costs in certain cloud environments. To mitigate this issue, you can set regular expressions for every metric exposed by the Dapr sidecar. [See a list of all Dapr metrics](https://github.com/dapr/dapr/blob/master/docs/development/dapr-metrics.md). + +The following example shows how to apply a regular expression for the label `method` in the metric `dapr_runtime_service_invocation_req_sent_total`: + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Configuration +metadata: + name: daprConfig +spec: + metric: + enabled: true + rules: + - name: dapr_runtime_service_invocation_req_sent_total + labels: + - name: method + regex: + "orders/": "orders/.+" +``` + +When this configuration is applied, a recorded metric with the `method` label of `orders/a746dhsk293972nz` will be replaced with `orders/`. + ## References * [Howto: Run Prometheus locally]({{< ref prometheus.md >}}) From a54c403e7901eff7379a397b794f0f3db1b46ea4 Mon Sep 17 00:00:00 2001 From: Bert Verstraete Date: Sat, 4 Feb 2023 02:22:10 +0100 Subject: [PATCH 16/23] Expand component metadata templating docs (#3070) * Expand component metadata templating docs - Add info on {namespace} and {appId} template - Reference metadata templating on Kafka component docs Signed-off-by: VerstraeteBert * Update daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md Co-authored-by: Mark Fussell Signed-off-by: Bert Verstraete * Update daprdocs/content/en/reference/components-reference/supported-bindings/kafka.md Co-authored-by: Mark Fussell Signed-off-by: Bert Verstraete * Fix broken link Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Bert Verstraete --------- Signed-off-by: VerstraeteBert Signed-off-by: Mark Fussell Signed-off-by: Bert Verstraete Co-authored-by: Mark Fussell Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> --- .../en/operations/components/component-schema.md | 16 +++++++++++----- .../supported-bindings/kafka.md | 3 +++ .../supported-pubsub/setup-apache-kafka.md | 5 ++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/daprdocs/content/en/operations/components/component-schema.md b/daprdocs/content/en/operations/components/component-schema.md index d87ac4017..bf60364cd 100644 --- a/daprdocs/content/en/operations/components/component-schema.md +++ b/daprdocs/content/en/operations/components/component-schema.md @@ -42,9 +42,18 @@ spec: | spec.ignoreErrors | N | Tells the Dapr sidecar to continue initialization if the component fails to load. Default is false | `false` | **spec.metadata** | - | **A key/value pair of component specific configuration. See your component definition for fields**| -### Special metadata values +### Templated metadata values -Metadata values can contain a `{uuid}` tag that is replaced with a randomly generate UUID when the Dapr sidecar starts up. A new UUID is generated on every start up. It can be used, for example, to have a pod on Kubernetes with multiple application instances consuming a [shared MQTT subscription]({{< ref "setup-mqtt3.md" >}}). Below is an example of using the `{uuid}` tag. +Metadata values can contain template tags that are resolved on Dapr sidecar startup. The table below shows the current templating tags that can be used in components. + +| Tag | Details | Example use case | +|-------------|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| {uuid} | Randomly generated UUIDv4 | When you need a unique identifier in self-hosted mode; for example, multiple application instances consuming a [shared MQTT subscription]({{< ref "setup-mqtt3.md" >}}) | +| {podName} | Name of the pod containing the Dapr sidecar | Use to have a persisted behavior, where the ConsumerID does not change on restart when using StatefulSets in Kubernetes | +| {namespace} | Namespace where the Dapr sidecar resides combined with its appId | Using a shared `clientId` when multiple application instances consume a Kafka topic in Kubernetes | +| {appID} | The configured `appID` of the resource containing the Dapr sidecar | Having a shared `clientId` when multiple application instances consumer a Kafka topic in self-hosted mode | + +Below is an example of using the `{uuid}` tag in an MQTT pubsub component. Note that multiple template tags can be used in a single metadata value. ```yaml apiVersion: dapr.io/v1alpha1 @@ -67,9 +76,6 @@ spec: value: "false" ``` -The consumerID metadata values can also contain a `{podName}` tag that is replaced with the Kubernetes POD's name when the Dapr sidecar starts up. This can be used to have a persisted behavior where the ConsumerID does not change on restart when using StatefulSets in Kubernetes. - - ## Further reading - [Components concept]({{< ref components-concept.md >}}) - [Reference secrets in component definitions]({{< ref component-secrets.md >}}) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/kafka.md b/daprdocs/content/en/reference/components-reference/supported-bindings/kafka.md index 152cfb6a0..9e0234fe8 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/kafka.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/kafka.md @@ -11,6 +11,9 @@ aliases: To setup Kafka binding create a component of type `bindings.kafka`. See [this guide]({{< ref "howto-bindings.md#1-create-a-binding" >}}) on how to create and apply a binding configuration. For details on using `secretKeyRef`, see the guide on [how to reference secrets in components]({{< ref component-secrets.md >}}). +All component metadata field values can carry [templated metadata values]({{< ref "component-schema.md#templated-metadata-values" >}}), which are resolved on Dapr sidecar startup. +For example, you can choose to use `{namespace}` as the `consumerGroup`, to enable using the same `appId` in different namespaces using the same topics as described in [this article]({{< ref "howto-namespace.md#with-namespace-consumer-groups">}}). + ```yaml apiVersion: dapr.io/v1alpha1 kind: Component diff --git a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md index a18b8c261..b1b0efab6 100644 --- a/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md +++ b/daprdocs/content/en/reference/components-reference/supported-pubsub/setup-apache-kafka.md @@ -11,6 +11,9 @@ aliases: To setup Apache Kafka pubsub create a component of type `pubsub.kafka`. See [this guide]({{< ref "howto-publish-subscribe.md#step-1-setup-the-pubsub-component" >}}) on how to create and apply a pubsub configuration. For details on using `secretKeyRef`, see the guide on [how to reference secrets in components]({{< ref component-secrets.md >}}). +All component metadata field values can carry [templated metadata values]({{< ref "component-schema.md#templated-metadata-values" >}}), which are resolved on Dapr sidecar startup. +For example, you can choose to use `{namespace}` as the `consumerGroup` to enable using the same `appId` in different namespaces using the same topics as described in [this article]({{< ref "howto-namespace.md#with-namespace-consumer-groups">}}). + ```yaml apiVersion: dapr.io/v1alpha1 kind: Component @@ -23,7 +26,7 @@ spec: - name: brokers # Required. Kafka broker connection setting value: "dapr-kafka.myapp.svc.cluster.local:9092" - name: consumerGroup # Optional. Used for input bindings. - value: "group1" + value: "{namespace}" - name: clientID # Optional. Used as client tracing ID by Kafka brokers. value: "my-dapr-app-id" - name: authType # Required. From 2b08c5b7fdb14a3f6fa7cb2d4a0aaefa0061412d Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Mon, 6 Feb 2023 11:43:31 -0600 Subject: [PATCH 17/23] updates per mukundan Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/_index.md | 4 ++-- .../multi-app-dapr-run/multi-app-overview.md | 10 +++++----- .../multi-app-dapr-run/multi-app-template.md | 16 +++++++++------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md index aecd74114..09a3cd5d7 100644 --- a/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md +++ b/daprdocs/content/en/developing-applications/local-development/multi-app-dapr-run/_index.md @@ -1,7 +1,7 @@ --- type: docs -title: "Multi-app Run" -linkTitle: "Multi-app Run" +title: "Multi-App Run" +linkTitle: "Multi-App Run" weight: 300 description: "Support for running multiple Dapr applications with one command" --- \ No newline at end of file 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 f2f3fd654..24b3c9c99 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 @@ -1,9 +1,9 @@ --- type: docs -title: Multi-app Run overview +title: Multi-App Run overview linkTitle: Multi-App Run overview weight: 1000 -description: Learn the scenarios around running multiple applications with one CLI command +description: Run multiple applications with one CLI command --- {{% alert title="Note" color="primary" %}} @@ -19,7 +19,7 @@ Instead, you simply want to run them as local executables in self-hosted mode. - Remember the resources folders and configuration files that each application refers to. - Recall all of the additional flags you used to tweak the `dapr run` command behavior (`--app-health-check-path`, `--dapr-grpc-port`, `--unix-domain-socket`, etc.) -With Multi-app Run, you can start multiple applications in self-hosted mode using a single `dapr run -f` command using a template file. The template file describes how to start multiple applications as if you had run many separate CLI `run`commands. By default, this template file is called `dapr.yaml`. +With Multi-App Run, you can start multiple applications in self-hosted mode using a single `dapr run -f` command using a template file. The template file describes how to start multiple applications as if you had run many separate CLI `run`commands. By default, this template file is called `dapr.yaml`. ## Multi-App Run template file @@ -27,7 +27,7 @@ When you execute `dapr run -f .`, it uses the multi-app template file (named `da You can name template file with preferred name other than the default. For example `dapr run -f ./.yaml`. -The following `dapr.yaml` example includes some of the template properties you can customize for your applications. In the example, you can simultaneously launch 2 applications with app IDs of `processor` and `emit-metrics`. +The following example includes some of the template properties you can customize for your applications. In the example, you can simultaneously launch 2 applications with app IDs of `processor` and `emit-metrics`. ```yaml version: 1 @@ -82,4 +82,4 @@ Watch [this video for an overview on Multi-App Run](https://youtu.be/s1p9MNl4VGo ## Next steps -[Unpack the Multi-App Run template file and its properties]({{< ref multi-app-template.md >}}) \ No newline at end of file +[Learn the Multi-App Run template file structure and its properties]({{< ref multi-app-template.md >}}) \ No newline at end of file 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 fa0d7dd4f..ce943f01b 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 @@ -27,7 +27,7 @@ When you provide a directory path, the CLI will try to locate the Multi-App Run Execute the following CLI command to read the Multi-App Run template file, named `dapr.yaml` by default: ```cmd -// the template file needs to be called `dapr.yaml` by default +# the template file needs to be called `dapr.yaml` by default if a directory path is given dapr run -f ``` @@ -37,7 +37,7 @@ dapr run -f If the Multi-App Run template file is named something other than `dapr.yaml`, then you can provide the relative or absolute file path to the command: ```cmd -dapr run -f ./.yaml +dapr run -f ./path/to/.yaml ``` ## View the started applications @@ -53,12 +53,14 @@ dapr list Stop the multi-app run template anytime with either of the following commands: ```cmd +# the template file needs to be called `dapr.yaml` by default if a directory path is given + dapr stop -f ``` or: ```cmd -dapr stop -f dapr.yaml +dapr stop -f ./path/to/.yaml ``` ## Template file structure @@ -72,16 +74,16 @@ common: # optional section for variables shared across apps env: # any environment variable shared across apps - DEBUG: true apps: - - appID: webapp - appDirPath: .dapr/webapp/ # required + - appID: webapp # optional + appDirPath: .dapr/webapp/ # REQUIRED resourcesPath: .dapr/resources # (optional) can be default by convention configFilePath: .dapr/config.yaml # (optional) can be default by convention too, ignore if file is not found. appProtocol: HTTP appPort: 8080 appHealthCheckPath: "/healthz" command: ["python3" "app.py"] - - appID: backend - appDirPath: .dapr/backend/ + - appID: backend # optional + appDirPath: .dapr/backend/ # REQUIRED appProtocol: GRPC appPort: 3000 unixDomainSocket: "/tmp/test-socket" From 30a1c865518ffe2d63e9a5212d427b940038b068 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 7 Feb 2023 08:22:14 -0600 Subject: [PATCH 18/23] add to dapr stop doc and update metadata table Signed-off-by: Hannah Hunter --- .../multi-app-dapr-run/multi-app-template.md | 2 +- daprdocs/content/en/reference/cli/dapr-stop.md | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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 ce943f01b..a0ef21650 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 @@ -135,7 +135,7 @@ The properties for the Multi-App Run template align with the `dapr run` CLI flag | `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 | | -| `daprPath` | N | Dapr install path | | +| `runtimePath` | N | Dapr runtime install path | | | `env` | N | Map to environment variable; environment variables applied per application will overwrite environment variables shared across applications | `DEBUG`, `DAPR_HOST_ADD` | ## Next steps diff --git a/daprdocs/content/en/reference/cli/dapr-stop.md b/daprdocs/content/en/reference/cli/dapr-stop.md index 2f9a47d00..c5fe074b1 100644 --- a/daprdocs/content/en/reference/cli/dapr-stop.md +++ b/daprdocs/content/en/reference/cli/dapr-stop.md @@ -21,10 +21,11 @@ dapr stop [flags] ### Flags -| Name | Environment Variable | Default | Description | -| ---------------- | -------------------- | ------- | -------------------------------- | -| `--app-id`, `-a` | `APP_ID` | | The application id to be stopped | -| `--help`, `-h` | | | Print this help message | +| Name | Environment Variable | Default | Description | +| -------------------- | -------------------- | ------- | -------------------------------- | +| `--app-id`, `-a` | `APP_ID` | | The application id to be stopped | +| `--help`, `-h` | | | Print this help message | +| `--run-file`, `-f` | | | Stop running multiple applications at once using a Multi-App Run template file | ### Examples From ffe2f31dfd7af00c9a610a6469a31d6769f1f57c Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 7 Feb 2023 08:43:12 -0600 Subject: [PATCH 19/23] add runtime path flag to dapr run doc Signed-off-by: Hannah Hunter --- daprdocs/content/en/reference/cli/dapr-run.md | 1 + 1 file changed, 1 insertion(+) diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index 9191741f4..9f47c6924 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -29,6 +29,7 @@ dapr run [flags] [command] | `--app-protocol`, `-P` | | `http` | The protocol Dapr uses to talk to the application. Valid values are: `http` or `grpc` | | `--app-ssl` | | `false` | Enable https when Dapr invokes the application | | `--resources-path`, `-d` | | Linux/Mac: `$HOME/.dapr/components`
Windows: `%USERPROFILE%\.dapr\components` | The path for components directory | +| `runtimePath` | | | Dapr runtime install path | | `--config`, `-c` | | Linux/Mac: `$HOME/.dapr/config.yaml`
Windows: `%USERPROFILE%\.dapr\config.yaml` | Dapr configuration file | | `--dapr-grpc-port` | `DAPR_GRPC_PORT` | `50001` | The gRPC port for Dapr to listen on | | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on | From cc14a4e6f0d7fd3912d513848d061112a4951174 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 7 Feb 2023 08:50:50 -0600 Subject: [PATCH 20/23] update to snake case in dapr run Signed-off-by: Hannah Hunter --- daprdocs/content/en/reference/cli/dapr-run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index 9f47c6924..0ebfb51db 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -29,7 +29,7 @@ dapr run [flags] [command] | `--app-protocol`, `-P` | | `http` | The protocol Dapr uses to talk to the application. Valid values are: `http` or `grpc` | | `--app-ssl` | | `false` | Enable https when Dapr invokes the application | | `--resources-path`, `-d` | | Linux/Mac: `$HOME/.dapr/components`
Windows: `%USERPROFILE%\.dapr\components` | The path for components directory | -| `runtimePath` | | | Dapr runtime install path | +| `runtime-path` | | | Dapr runtime install path | | `--config`, `-c` | | Linux/Mac: `$HOME/.dapr/config.yaml`
Windows: `%USERPROFILE%\.dapr\config.yaml` | Dapr configuration file | | `--dapr-grpc-port` | `DAPR_GRPC_PORT` | `50001` | The gRPC port for Dapr to listen on | | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on | From e90e505145ef6fc388ee3750d5cf48a6a9cccdf3 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 7 Feb 2023 08:53:21 -0600 Subject: [PATCH 21/23] add alpha state and availability to dapr stop Signed-off-by: Hannah Hunter --- daprdocs/content/en/reference/cli/dapr-stop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/cli/dapr-stop.md b/daprdocs/content/en/reference/cli/dapr-stop.md index c5fe074b1..0bb20213f 100644 --- a/daprdocs/content/en/reference/cli/dapr-stop.md +++ b/daprdocs/content/en/reference/cli/dapr-stop.md @@ -25,7 +25,7 @@ dapr stop [flags] | -------------------- | -------------------- | ------- | -------------------------------- | | `--app-id`, `-a` | `APP_ID` | | The application id to be stopped | | `--help`, `-h` | | | Print this help message | -| `--run-file`, `-f` | | | Stop running multiple applications at once using a Multi-App Run template file | +| `--run-file`, `-f` | | | Stop running multiple applications at once using a Multi-App Run template file. Currently in [alpha]({{< ref "support-preview-features.md" >}}) and only availale in Linux/MacOS | ### Examples From 101d55db8ef72b60ff417e1d555b3f6e5d99f2ca Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 7 Feb 2023 08:54:27 -0600 Subject: [PATCH 22/23] also add note about alpha and linux/macos to dapr run Signed-off-by: Hannah Hunter --- daprdocs/content/en/reference/cli/dapr-run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index 0ebfb51db..f1b15f462 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -35,7 +35,7 @@ dapr run [flags] [command] | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on | | `--enable-profiling` | | `false` | Enable "pprof" profiling via an HTTP endpoint | | `--help`, `-h` | | | Print the help message | -| `--run-file`, `-f` | | Linux/Mac: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once using a Multi-App Run template file | +| `--run-file`, `-f` | | Linux/MacOS: `$HOME/.dapr/dapr.yaml` | Run multiple applications at once using a Multi-App Run template file. Currently in [alpha]({{< ref "support-preview-features.md" >}}) and only availale in Linux/MacOS | | `--image` | | | Use a custom Docker image. Format is `repository/image` for Docker Hub, or `example.com/repository/image` for a custom registry. | | `--log-level` | | `info` | The log verbosity. Valid values are: `debug`, `info`, `warn`, `error`, `fatal`, or `panic` | | `--enable-api-logging` | | `false` | Enable the logging of all API calls from application to Dapr | From 3ff4313d117021ee8d1893f6097a1bf1ccdfc6b7 Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Tue, 7 Feb 2023 09:05:09 -0600 Subject: [PATCH 23/23] nit Signed-off-by: Hannah Hunter --- daprdocs/content/en/reference/cli/dapr-run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index f1b15f462..9973a128c 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -29,7 +29,7 @@ dapr run [flags] [command] | `--app-protocol`, `-P` | | `http` | The protocol Dapr uses to talk to the application. Valid values are: `http` or `grpc` | | `--app-ssl` | | `false` | Enable https when Dapr invokes the application | | `--resources-path`, `-d` | | Linux/Mac: `$HOME/.dapr/components`
Windows: `%USERPROFILE%\.dapr\components` | The path for components directory | -| `runtime-path` | | | Dapr runtime install path | +| `--runtime-path` | | | Dapr runtime install path | | `--config`, `-c` | | Linux/Mac: `$HOME/.dapr/config.yaml`
Windows: `%USERPROFILE%\.dapr\config.yaml` | Dapr configuration file | | `--dapr-grpc-port` | `DAPR_GRPC_PORT` | `50001` | The gRPC port for Dapr to listen on | | `--dapr-http-port` | `DAPR_HTTP_PORT` | `3500` | The HTTP port for Dapr to listen on |