mirror of https://github.com/dapr/cli.git
Normalize "dapr run" flags (#420)
* Normalize flags * deprecate port, grpc-port, placement-host * Fix build * Add short hands for protocols Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
This commit is contained in:
parent
48f9e64520
commit
35b9a824d2
10
README.md
10
README.md
|
@ -136,7 +136,7 @@ $ docker network create dapr-network
|
|||
$ dapr init --network dapr-network
|
||||
```
|
||||
|
||||
> Note: When installed to a specific Docker network, you will need to add the `--placement-host` arguments to `dapr run` commands run in any containers within that network.
|
||||
> Note: When installed to a specific Docker network, you will need to add the `--placement-host-address` arguments to `dapr run` commands run in any containers within that network.
|
||||
|
||||
#### Install with a specific host on which the Redis service resides
|
||||
```bash
|
||||
|
@ -227,20 +227,20 @@ $ dapr run --app-id nodeapp --app-port 3000 node app.js
|
|||
Example of launching Dapr on HTTP port 6000:
|
||||
|
||||
```
|
||||
$ dapr run --app-id nodeapp --app-port 3000 --port 6000 node app.js
|
||||
$ dapr run --app-id nodeapp --app-port 3000 --dapr-http-port 6000 node app.js
|
||||
```
|
||||
|
||||
Example of launching Dapr on gRPC port 50002:
|
||||
|
||||
```
|
||||
$ dapr run --app-id nodeapp --app-port 3000 --grpc-port 50002 node app.js
|
||||
$ dapr run --app-id nodeapp --app-port 3000 --dapr-grpc-port 50002 node app.js
|
||||
```
|
||||
|
||||
Example of launching Dapr within a specific Docker network:
|
||||
|
||||
```bash
|
||||
$ dapr init --redis-host dapr_redis --network dapr-network
|
||||
$ dapr run --app-id nodeapp --placement-host dapr_placement node app.js
|
||||
$ dapr run --app-id nodeapp --placement-host-address dapr_placement node app.js
|
||||
```
|
||||
|
||||
> Note: When in a specific Docker network, the Redis and placement service containers are given specific network aliases, `dapr_redis` and `dapr_placement`, respectively.
|
||||
|
@ -402,7 +402,7 @@ The default is `info`.
|
|||
You can run Dapr's sidecar only (`daprd`) by omitting the application's command in the end:
|
||||
|
||||
```
|
||||
$ dapr run --app-id myapp --port 3005 --grpc-port 50001
|
||||
$ dapr run --app-id myapp --dapr-http-port 3005 --dapr-grpc-port 50001
|
||||
```
|
||||
|
||||
### Generate shell completion scripts
|
||||
|
|
25
cmd/run.go
25
cmd/run.go
|
@ -232,19 +232,30 @@ Run sidecar only:
|
|||
}
|
||||
|
||||
func init() {
|
||||
RunCmd.Flags().IntVarP(&appPort, "app-port", "", -1, "the port your application is listening on")
|
||||
RunCmd.Flags().StringVarP(&appID, "app-id", "", "", "an id for your application, used for service discovery")
|
||||
RunCmd.Flags().StringVarP(&configFile, "config", "", standalone.DefaultConfigFilePath(), "Dapr configuration file. Default is $HOME/.dapr/config.yaml or %USERPROFILE%\\.dapr\\config.yaml")
|
||||
RunCmd.Flags().IntVarP(&port, "port", "p", -1, "the HTTP port for Dapr to listen on")
|
||||
RunCmd.Flags().IntVarP(&grpcPort, "grpc-port", "", -1, "the gRPC port for Dapr to listen on")
|
||||
RunCmd.Flags().IntVarP(&appPort, "app-port", "p", -1, "the port your application is listening on")
|
||||
RunCmd.Flags().StringVarP(&appID, "app-id", "i", "", "an id for your application, used for service discovery")
|
||||
RunCmd.Flags().StringVarP(&configFile, "config", "c", standalone.DefaultConfigFilePath(), "Dapr configuration file. Default is $HOME/.dapr/config.yaml or %USERPROFILE%\\.dapr\\config.yaml")
|
||||
RunCmd.Flags().IntVarP(&port, "dapr-http-port", "H", -1, "the HTTP port for Dapr to listen on")
|
||||
RunCmd.Flags().IntVarP(&grpcPort, "dapr-grpc-port", "G", -1, "the gRPC port for Dapr to listen on")
|
||||
RunCmd.Flags().StringVarP(&image, "image", "", "", "the image to build the code in. input is repository/image")
|
||||
RunCmd.Flags().BoolVar(&enableProfiling, "enable-profiling", false, "Enable pprof profiling via an HTTP endpoint")
|
||||
RunCmd.Flags().IntVarP(&profilePort, "profile-port", "", -1, "the port for the profile server to listen on")
|
||||
RunCmd.Flags().StringVarP(&logLevel, "log-level", "", "info", "Sets the log verbosity. Valid values are: debug, info, warn, error, fatal, or panic. Default is info")
|
||||
RunCmd.Flags().IntVarP(&maxConcurrency, "max-concurrency", "", -1, "controls the concurrency level of the app. Default is unlimited")
|
||||
RunCmd.Flags().StringVarP(&protocol, "protocol", "", "http", "tells Dapr to use HTTP or gRPC to talk to the app. Default is http")
|
||||
RunCmd.Flags().StringVarP(&componentsPath, "components-path", "", standalone.DefaultComponentsDirPath(), "Path for components directory. Default is $HOME/.dapr/components or %USERPROFILE%\\.dapr\\components")
|
||||
RunCmd.Flags().StringVarP(&protocol, "app-protocol", "P", "http", "tells Dapr to use HTTP or gRPC to talk to the app. Default is http")
|
||||
RunCmd.Flags().StringVarP(&componentsPath, "components-path", "d", standalone.DefaultComponentsDirPath(), "Path for components directory. Default is $HOME/.dapr/components or %USERPROFILE%\\.dapr\\components")
|
||||
RunCmd.Flags().String("placement-host-address", "localhost", "the host on which the placement service resides")
|
||||
|
||||
// deprecated flags
|
||||
RunCmd.Flags().IntVarP(&port, "port", "", -1, "the HTTP port for Dapr to listen on")
|
||||
RunCmd.Flags().IntVarP(&grpcPort, "grpc-port", "", -1, "the gRPC port for Dapr to listen on")
|
||||
RunCmd.Flags().String("placement-host", "localhost", "the host on which the placement service resides")
|
||||
RunCmd.Flags().StringVarP(&protocol, "protocol", "", "http", "tells Dapr to use HTTP or gRPC to talk to the app. Default is http")
|
||||
|
||||
RunCmd.Flags().MarkDeprecated("port", "this flag is deprecated and will be removed in v1.0. Use dapr-http-port instead")
|
||||
RunCmd.Flags().MarkDeprecated("grpc-port", "this flag is deprecated and will be removed in v1.0. Use dapr-grpc-port instead")
|
||||
RunCmd.Flags().MarkDeprecated("placement-host", "this flag is deprecated and will be removed in v1.0. Use placement-host-address instead")
|
||||
RunCmd.Flags().MarkDeprecated("protocol", "this flag is deprecated and will be removed in v1.0. Use app-protocol instead")
|
||||
|
||||
RootCmd.AddCommand(RunCmd)
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ dapr run [flags] [command]
|
|||
| `--components-path` | | `Linux & Mac: $HOME/.dapr/components`, `Windows: %USERPROFILE%\.dapr\components` | Path for components directory |
|
||||
| `--config` | | `Linux & Mac: $HOME/.dapr/config.yaml`, `Windows: %USERPROFILE%\.dapr\config.yaml` | Dapr configuration file |
|
||||
| `--enable-profiling` | | | Enable `pprof` profiling via an HTTP endpoint |
|
||||
| `--grpc-port` | | `-1` | The gRPC port for Dapr to listen on |
|
||||
| `--dapr-grpc-port` | | `-1` | The gRPC port for Dapr to listen on |
|
||||
| `--help`, `-h` | | | Help for run |
|
||||
| `--image` | | | The image to build the code in. Input is: `repository/image` |
|
||||
| `--log-level` | | `info` | Sets the log verbosity. Valid values are: `debug`, `info`, `warning`, `error`, `fatal`, or `panic` |
|
||||
| `--max-concurrency` | | `-1` | Controls the concurrency level of the app |
|
||||
| `--placement-host` | `DAPR_PLACEMENT_HOST` | `localhost` | The host on which the placement service resides |
|
||||
| `--placement-host-address` | `DAPR_PLACEMENT_HOST` | `localhost` | The host on which the placement service resides |
|
||||
| `--port`, `-p` | | `-1` | The HTTP port for Dapr to listen on |
|
||||
| `--profile-port` | | `-1` | The port for the profile server to listen on |
|
||||
| `--protocol` | | `http` | Tells Dapr to use HTTP or gRPC to talk to the app. Valid values are: `http` or `grpc` |
|
||||
|
|
Loading…
Reference in New Issue