From e1aad266406260e61a2ab3d6e121ada99ca42f4c Mon Sep 17 00:00:00 2001 From: Mukundan Sundararajan Date: Tue, 8 Dec 2020 15:30:40 -0800 Subject: [PATCH] Update CLI reference --- .../content/en/reference/cli/cli-overview.md | 37 +++++++++---------- .../en/reference/cli/dapr-completion.md | 4 +- .../en/reference/cli/dapr-components.md | 9 ++++- .../en/reference/cli/dapr-configurations.md | 9 ++++- .../en/reference/cli/dapr-dashboard.md | 25 ++++++++++++- .../content/en/reference/cli/dapr-init.md | 20 +++++++++- .../content/en/reference/cli/dapr-invoke.md | 17 +++++++-- .../en/reference/cli/dapr-invokeGet.md | 24 ------------ .../en/reference/cli/dapr-invokePost.md | 25 ------------- .../content/en/reference/cli/dapr-list.md | 15 +++++++- .../content/en/reference/cli/dapr-logs.md | 10 ++++- .../en/reference/cli/dapr-mtls--export.md | 29 +++++++++++++++ .../en/reference/cli/dapr-mtls-expiry.md | 28 ++++++++++++++ .../content/en/reference/cli/dapr-mtls.md | 16 +++++++- .../content/en/reference/cli/dapr-publish.md | 14 +++++-- daprdocs/content/en/reference/cli/dapr-run.md | 20 ++++++---- .../content/en/reference/cli/dapr-status.md | 12 ++++-- .../content/en/reference/cli/dapr-stop.md | 11 +++++- .../en/reference/cli/dapr-uninstall.md | 19 +++++++++- 19 files changed, 244 insertions(+), 100 deletions(-) delete mode 100644 daprdocs/content/en/reference/cli/dapr-invokeGet.md delete mode 100644 daprdocs/content/en/reference/cli/dapr-invokePost.md create mode 100644 daprdocs/content/en/reference/cli/dapr-mtls--export.md create mode 100644 daprdocs/content/en/reference/cli/dapr-mtls-expiry.md diff --git a/daprdocs/content/en/reference/cli/cli-overview.md b/daprdocs/content/en/reference/cli/cli-overview.md index 3dd01734f..3e5c1f248 100644 --- a/daprdocs/content/en/reference/cli/cli-overview.md +++ b/daprdocs/content/en/reference/cli/cli-overview.md @@ -9,14 +9,13 @@ weight: 10 The Dapr CLI allows you to setup Dapr on your local dev machine or on a Kubernetes cluster, provides debugging support, and launches and manages Dapr instances. ```bash - - __ + ____/ /___ _____ _____ / __ / __ '/ __ \/ ___/ - / /_/ / /_/ / /_/ / / - \__,_/\__,_/ .___/_/ - /_/ - + / /_/ / /_/ / /_/ / / + \__,_/\__,_/ .___/_/ + /_/ + =============================== Distributed Application Runtime @@ -25,20 +24,20 @@ Usage: Available Commands: completion Generates shell completion scripts - components List all Dapr components - configurations List all Dapr configurations - dashboard Start Dapr dashboard + components List all Dapr components. Supported platforms: Kubernetes + configurations List all Dapr configurations. Supported platforms: Kubernetes + dashboard Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted help Help about any command - init Install Dapr on supported hosting platforms, currently: Kubernetes and self-hosted - invoke Invoke a method on a given Dapr application - list List all Dapr instances - logs Get Dapr sidecar logs for an application - mtls Check if mTLS is enabled - publish Publish a pub-sub event - run Run Dapr and (optionally) your application side by side - status Show the health status of Dapr services - stop Stop Dapr instances and their associated apps in self-hosted mode - uninstall Uninstall Dapr runtime + init Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted + invoke Invoke a method on a given Dapr application. Supported platforms: Self-hosted + list List all Dapr instances. Supported platforms: Kubernetes and self-hosted + logs Get Dapr sidecar logs for an application. Supported platforms: Kubernetes + mtls Check if mTLS is enabled. Supported platforms: Kubernetes + publish Publish a pub-sub event. Supported platforms: Self-hosted + run Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted + status Show the health status of Dapr services. Supported platforms: Kubernetes + stop Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted + uninstall Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted Flags: -h, --help help for dapr diff --git a/daprdocs/content/en/reference/cli/dapr-completion.md b/daprdocs/content/en/reference/cli/dapr-completion.md index 1fe27165a..11717bcb6 100644 --- a/daprdocs/content/en/reference/cli/dapr-completion.md +++ b/daprdocs/content/en/reference/cli/dapr-completion.md @@ -12,8 +12,8 @@ Generates shell completion scripts ## Usage ```bash - dapr completion [flags] - dapr completion [command] +dapr completion [flags] +dapr completion [command] ``` ## Examples diff --git a/daprdocs/content/en/reference/cli/dapr-components.md b/daprdocs/content/en/reference/cli/dapr-components.md index 36b8bbc49..e57fc337d 100644 --- a/daprdocs/content/en/reference/cli/dapr-components.md +++ b/daprdocs/content/en/reference/cli/dapr-components.md @@ -7,7 +7,7 @@ description: "Detailed information on the components CLI command" ## Description -List all Dapr components +List all Dapr components. Supported platforms: Kubernetes ## Usage @@ -15,6 +15,13 @@ List all Dapr components dapr components [flags] ``` +## Examples + +### List Kubernetes components +```bash +dapr components -k +``` + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-configurations.md b/daprdocs/content/en/reference/cli/dapr-configurations.md index 401c9d92b..ed0ca85b0 100644 --- a/daprdocs/content/en/reference/cli/dapr-configurations.md +++ b/daprdocs/content/en/reference/cli/dapr-configurations.md @@ -7,7 +7,7 @@ description: "Detailed information on the configurations CLI command" ## Description -List all Dapr configurations +List all Dapr configurations. Supported platforms: Kubernetes ## Usage @@ -15,6 +15,13 @@ List all Dapr configurations dapr configurations [flags] ``` +## Examples + +### List Kubernetes components +```bash +dapr components -k +``` + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-dashboard.md b/daprdocs/content/en/reference/cli/dapr-dashboard.md index b3dd41607..6625db085 100644 --- a/daprdocs/content/en/reference/cli/dapr-dashboard.md +++ b/daprdocs/content/en/reference/cli/dapr-dashboard.md @@ -7,14 +7,35 @@ description: "Detailed information on the dashboard CLI command" ## Description -Start Dapr dashboard +Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted ## Usage - ```bash dapr dashboard [flags] ``` +## Examples + +### Start dashboard locally +```bash +dapr dashboard +``` + +### Start dashboard locally in a specified port +```bash +dapr dashboard -p 9999 +``` + +### Port forward to dashboard in Kubernetes +```bash +dapr dashboard -k +``` + +### Port forward to dashboard in Kubernetes using a port +```bash +dapr dashboard -k -p 9999 +``` + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-init.md b/daprdocs/content/en/reference/cli/dapr-init.md index b34acd1dc..c1c60ca6c 100644 --- a/daprdocs/content/en/reference/cli/dapr-init.md +++ b/daprdocs/content/en/reference/cli/dapr-init.md @@ -7,14 +7,30 @@ description: "Detailed information on the init CLI command" ## Description -Install Dapr on supported hosting platforms, currently: Kubernetes and self-hosted +Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted ## Usage - ```bash dapr init [flags] ``` +## Examples + +### Initialize Dapr in self-hosted mode +```bash +dapr init +``` + +### Initialize Dapr in Kubernetes +```bash +dapr init -k +``` + +### Initialize Dapr in slim self-hosted mode +```bash +dapr init -s +``` + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-invoke.md b/daprdocs/content/en/reference/cli/dapr-invoke.md index 7969b15b4..918bb8797 100644 --- a/daprdocs/content/en/reference/cli/dapr-invoke.md +++ b/daprdocs/content/en/reference/cli/dapr-invoke.md @@ -7,14 +7,25 @@ description: "Detailed information on the invoke CLI command" ## Description -Invoke a method on a given Dapr application +Invoke a method on a given Dapr application. Supported platforms: Self-hosted ## Usage - ```bash dapr invoke [flags] ``` +## Examples + +### Invoke a sample method on target app with POST Verb +```bash +dapr invoke --app-id target --method sample --data '{"key":"value"}' +``` + +### Invoke a sample method on target app with GET Verb +```bash +dapr invoke --app-id target --method sample --verb GET +``` + ## Flags | Name | Environment Variable | Default | Description @@ -22,5 +33,5 @@ dapr invoke [flags] | `--app-id`, `-a` | | | The application id to invoke | | `--help`, `-h` | | | Print this help message | | `--method`, `-m` | | | The method to invoke | -| `--payload`, `-p` | | | The JSON payload (optional) | +| `--data`, `-d` | | | The JSON serialized data string (optional) | | `--verb`, `-v` | | `POST` | The HTTP verb to use | diff --git a/daprdocs/content/en/reference/cli/dapr-invokeGet.md b/daprdocs/content/en/reference/cli/dapr-invokeGet.md deleted file mode 100644 index 0cc75ea63..000000000 --- a/daprdocs/content/en/reference/cli/dapr-invokeGet.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -type: docs -title: "invokeGet CLI command reference" -linkTitle: "invokeGet" -description: "Detailed information on the invokeGet CLI command" ---- - -## Description - -Issue HTTP GET to Dapr app - -## Usage - -```bash -dapr invokeGet [flags] -``` - -## Flags - -| Name | Environment Variable | Default | Description -| --- | --- | --- | --- | -| `--app-id`, `-a` | | | The app ID to invoke | -| `--help`, `-h` | | | Help for invokeGet | -| `--method`, `-m` | | | The method to invoke | diff --git a/daprdocs/content/en/reference/cli/dapr-invokePost.md b/daprdocs/content/en/reference/cli/dapr-invokePost.md deleted file mode 100644 index b9a4866e4..000000000 --- a/daprdocs/content/en/reference/cli/dapr-invokePost.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -type: docs -title: "invokePost CLI command reference" -linkTitle: "invokePost" -description: "Detailed information on the invokePost CLI command" ---- - -## Description - -Issue HTTP POST to Dapr app with an optional payload - -## Usage - -```bash -dapr invokePost [flags] -``` - -## Flags - -| Name | Environment Variable | Default | Description -| --- | --- | --- | --- | -| `--app-id`, `-a` | | | The app ID to invoke | -| `--help`, `-h` | | | Help for invokePost | -| `--method`, `-m` | | | The method to invoke | -| `--payload`, `-p` | | | (optional) a json payload | diff --git a/daprdocs/content/en/reference/cli/dapr-list.md b/daprdocs/content/en/reference/cli/dapr-list.md index 857aaee87..3763ddc61 100644 --- a/daprdocs/content/en/reference/cli/dapr-list.md +++ b/daprdocs/content/en/reference/cli/dapr-list.md @@ -7,14 +7,25 @@ description: "Detailed information on the list CLI command" ## Description -List all Dapr instances +List all Dapr instances. Supported platforms: Kubernetes and self-hosted ## Usage - ```bash dapr list [flags] ``` +## Examples + +### List Dapr instances in self-hosted mode +```bash +dapr list +``` + +### List Dapr instances in Kubernetes mode +```bash +dapr list -k +``` + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-logs.md b/daprdocs/content/en/reference/cli/dapr-logs.md index 314bd1030..f18390fdb 100644 --- a/daprdocs/content/en/reference/cli/dapr-logs.md +++ b/daprdocs/content/en/reference/cli/dapr-logs.md @@ -7,14 +7,20 @@ description: "Detailed information on the logs CLI command" ## Description -Gets Dapr sidecar logs for an app in Kubernetes +Get Dapr sidecar logs for an application. Supported platforms: Kubernetes ## Usage - ```bash dapr logs [flags] ``` +## Examples + +### Get logs of sample app from target pod in custom namespace +```bash +dapr logs -k --app-id sample --pod-name target --namespace custom +``` + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-mtls--export.md b/daprdocs/content/en/reference/cli/dapr-mtls--export.md new file mode 100644 index 000000000..83e8fe267 --- /dev/null +++ b/daprdocs/content/en/reference/cli/dapr-mtls--export.md @@ -0,0 +1,29 @@ +--- +type: docs +title: "mtls export CLI command reference" +linkTitle: "mtls export" +description: "Detailed information on the mtls export CLI command" +--- + +## Description + +Export the root CA, issuer cert and key from Kubernetes to local files + +## Usage +```bash +dapr mtls export [flags] +``` + +## Examples + +### Check expiry of Kubernetes certs +```bash +dapr mtls export -o ./certs +``` + +## Flags + +| Name | Environment Variable | Default | Description +| --- | --- | --- | --- | +| `--help`, `-h` | | | help for export | +| `--out`, `-o` | | current directory | The output directory path to save the certs | diff --git a/daprdocs/content/en/reference/cli/dapr-mtls-expiry.md b/daprdocs/content/en/reference/cli/dapr-mtls-expiry.md new file mode 100644 index 000000000..1dce2ca7c --- /dev/null +++ b/daprdocs/content/en/reference/cli/dapr-mtls-expiry.md @@ -0,0 +1,28 @@ +--- +type: docs +title: "mtls expiry CLI command reference" +linkTitle: "mtls expiry" +description: "Detailed information on the mtls expiry CLI command" +--- + +## Description + +Checks the expiry of the root certificate + +## Usage +```bash +dapr mtls expiry [flags] +``` + +## Examples + +### Check expiry of Kubernetes certs +```bash +dapr mtls expiry +``` + +## Flags + +| Name | Environment Variable | Default | Description +| --- | --- | --- | --- | +| `--help`, `-h` | | | help for expiry | \ No newline at end of file diff --git a/daprdocs/content/en/reference/cli/dapr-mtls.md b/daprdocs/content/en/reference/cli/dapr-mtls.md index 7425c08ff..de31910ab 100644 --- a/daprdocs/content/en/reference/cli/dapr-mtls.md +++ b/daprdocs/content/en/reference/cli/dapr-mtls.md @@ -7,7 +7,7 @@ description: "Detailed information on the mtls CLI command" ## Description -Check if mTLS is enabled +Check if mTLS is enabled. Supported platforms: Kubernetes ## Usage @@ -16,6 +16,13 @@ dapr mtls [flags] dapr mtls [command] ``` +## Examples + +### Check if mTLS is enabled +```bash +dapr mtls -k +``` + ## Available Commands ```txt @@ -29,3 +36,10 @@ export Export the root CA, issuer cert and key from Kubernetes to local fil | --- | --- | --- | --- | | `--help`, `-h` | | | Print this help message | | `--kubernetes`, `-k` | | `false` | Check if mTLS is enabled in a Kubernetes cluster | + +## Command Reference + +You can learn more about each sub command from the links below. + + - [`dapr mtls expiry`]({{< ref dapr-mtls-expiry.md >}}) + - [`dapr mtls export`]({{< ref dapr-mtls-export.md >}}) \ No newline at end of file diff --git a/daprdocs/content/en/reference/cli/dapr-publish.md b/daprdocs/content/en/reference/cli/dapr-publish.md index d53b1df08..938074aca 100644 --- a/daprdocs/content/en/reference/cli/dapr-publish.md +++ b/daprdocs/content/en/reference/cli/dapr-publish.md @@ -7,7 +7,7 @@ description: "Detailed information on the publish CLI command" ## Description -Publish an event to multiple consumers +Publish a pub-sub event. Supported platforms: Self-hosted ## Usage @@ -15,11 +15,19 @@ Publish an event to multiple consumers dapr publish [flags] ``` +## Examples + +### Publish to sample topic in target pubsub +```bash +dapr publish --topic sample --pubsub target --data '{"key":"value"}' +``` + + ## Flags | Name | Environment Variable | Default | Description | --- | --- | --- | --- | -| `--data`, `-d` | | | The JSON serialized string (optional) | +| `--data`, `-d` | | | The JSON serialized data string (optional) | | `--help`, `-h` | | | Print this help message | -| `--pubsub` | | | The name of the pub/sub component +| `--pubsub`, `-p` | | | The name of the pub/sub component | `--topic`, `-t` | | | The topic to be published to | diff --git a/daprdocs/content/en/reference/cli/dapr-run.md b/daprdocs/content/en/reference/cli/dapr-run.md index df62029ca..52435bd92 100644 --- a/daprdocs/content/en/reference/cli/dapr-run.md +++ b/daprdocs/content/en/reference/cli/dapr-run.md @@ -7,7 +7,7 @@ description: "Detailed information on the run CLI command" ## Description -Run Dapr's sidecar and (optionally) an application. +Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted ## Usage @@ -17,19 +17,26 @@ dapr run [flags] [command] ## Examples -Run a Java application: +### Run a Java application + ```bash dapr run --app-id myapp -- java -jar myapp.jar ``` -Run a NodeJs application that listens to port 3000: + +### Run a NodeJs application that listens to port 3000 + ```bash dapr run --app-id myapp --app-port 3000 -- node myapp.js ``` -Run a Python application: + +### Run a Python application + ```bash dapr run --app-id myapp -- python myapp.py ``` -Run sidecar only: + +### Run sidecar only + ```bash dapr run --app-id myapp ``` @@ -38,7 +45,7 @@ dapr run --app-id myapp | Name | Environment Variable | Default | Description | --- | --- | --- | --- | -| `--app-id`, `-i` | | | The id for your application, used for service discovery | +| `--app-id`, `-a` | | | The id for your application, used for service discovery | | `--app-max-concurrency` | | `unlimited` | The concurrency level of the application, otherwise is unlimited | | `--app-port`, `-p` | | | The port your application is listening on | `--app-protocol`, `-P` | | `http` | The protocol (gRPC or HTTP) Dapr uses to talk to the application. Valid values are: `http` or `grpc` | @@ -49,7 +56,6 @@ dapr run --app-id myapp | `--dapr-http-port` | | `50001` | The HTTP port for Dapr to listen on | | `--enable-profiling` | | `false` | Enable `pprof` profiling via an HTTP endpoint | `--help`, `-h` | | | Print this help message | -| `--image` | | | The image to build the code in. Input is: `repository/image` | | `--log-level` | | `info` | The log verbosity. Valid values are: `debug`, `info`, `warning`, `error`, `fatal`, or `panic` | | `--placement-host-address` | `DAPR_PLACEMENT_HOST` | `localhost` | The host on which the placement service resides | | `--profile-port` | | `7777` | The port for the profile server to listen on | diff --git a/daprdocs/content/en/reference/cli/dapr-status.md b/daprdocs/content/en/reference/cli/dapr-status.md index ba7f438f2..ab0cc0559 100644 --- a/daprdocs/content/en/reference/cli/dapr-status.md +++ b/daprdocs/content/en/reference/cli/dapr-status.md @@ -7,16 +7,22 @@ description: "Detailed information on the status CLI command" ## Description -Show the health status of Dapr services +Show the health status of Dapr services. Supported platforms: Kubernetes ## Usage -This command only works for Kubernetes mode. - ```bash dapr status -k ``` +## Examples + +### Get status of Dapr services from Kubernetes +```bash +dapr status -k +``` + + ## Flags | Name | Environment Variable | Default | Description diff --git a/daprdocs/content/en/reference/cli/dapr-stop.md b/daprdocs/content/en/reference/cli/dapr-stop.md index ab1bf451e..838a4e2c0 100644 --- a/daprdocs/content/en/reference/cli/dapr-stop.md +++ b/daprdocs/content/en/reference/cli/dapr-stop.md @@ -7,7 +7,7 @@ description: "Detailed information on the stop CLI command" ## Description -Stop Dapr instances and their associated apps in self-hosted mode +Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted ## Usage @@ -15,9 +15,16 @@ Stop Dapr instances and their associated apps in self-hosted mode dapr stop [flags] ``` +## Examples + +### Stop Dapr application +```bash +dapr stop --app-id +``` + ## Flags | Name | Environment Variable | Default | Description | --- | --- | --- | --- | -| `--app-id` | | | The application id to be stopped | +| `--app-id`, `-a` | | | The application id to be stopped | | `--help`, `-h` | | | Print this help message | diff --git a/daprdocs/content/en/reference/cli/dapr-uninstall.md b/daprdocs/content/en/reference/cli/dapr-uninstall.md index a7ba139d0..1f6cd68a4 100644 --- a/daprdocs/content/en/reference/cli/dapr-uninstall.md +++ b/daprdocs/content/en/reference/cli/dapr-uninstall.md @@ -7,7 +7,7 @@ description: "Detailed information on the uninstall CLI command" ## Description -Uninstall Dapr runtime +Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted ## Usage @@ -15,6 +15,23 @@ Uninstall Dapr runtime dapr uninstall [flags] ``` +## Examples + +### Uninstall from self-hosted mode +```bash +dapr uninstall +``` + +### Uninstall from self-hosted mode and remove .dapr directory, Redis, Placement and Zipkin containers +```bash +dapr uninstall --all +``` + +### Uninstall from Kubernetes +```bash +dapr uninstall -k +``` + ## Flags | Name | Environment Variable | Default | Description