cli icon indicating copy to clipboard operation
cli copied to clipboard

Proposal: app-port watch mode

Open youngbupark opened this issue 5 years ago • 13 comments

Describe the proposal

Current CLI is not easy to develop Dapr user application because it always needs to have user app executable. The problem is that a developer always needs to build the binary for the testing and it is hard to debug user app from IDE's debuggers without attaching debugger to process. It results in the low productivity in order to develop user app.

In order to resolve this problem, this proposes app-port watch mode to cli.

For example,

dapr watch --app-id mynode --app-port 3000 --port 3500
  1. dapr cli will monitor localhost:3000 port. cli will not run daprd unless 3000 port is available.
  2. When 3000 port is available, Dapr cli runs daprd and then daprd connects to user app.
  3. cli will monitor the port on the background and if the port is unavailable, cli will kill daprd process

youngbupark avatar Oct 29 '19 16:10 youngbupark

We can simplify this by removing the minimum arguments from the run command and "watch" when no args are provided.

yaron2 avatar Oct 29 '19 16:10 yaron2

We can simplify this by removing the minimum arguments from the run command and "watch" when no args are provided.

sure, we can allow no args, but if someone would run multiple dapr, he or she needs to specify the ports..

youngbupark avatar Oct 29 '19 16:10 youngbupark

The ports are anyway specified with --app-port.

yaron2 avatar Oct 29 '19 16:10 yaron2

The ports are anyway specified with --app-port.

yeah that's what I said :)

youngbupark avatar Oct 29 '19 16:10 youngbupark

Is there a reason why the Dapr CLI shouldn't always monitor the port, whether dapr run specifies a command line to start or not? I'm thinking of the case where someone starts an application using a stack-specific watcher, such as dapr run --app-id <id> --app-port <port> dotnet watch run.

This also brings up the question of the granularity of such port monitoring; stack-specific watchers may take down, rebuild, and restart applications fairly quickly. If the Dapr CLI can't capture such recycling, then the port monitoring may not be very useful. As an alternative, what if the application had the option of being more direct in telling Dapr that it's restarting, such as by POST'ing to a designated Dapr "restart" endpoint (e.g. POST http://localhost:3500/v1.0/lifecycle/restart). Applications could then add this to their startup logic (when in development mode, obviously) to indicate to Dapr that the application was (re)started and that daprd should be restarted.

philliphoff avatar Nov 11 '19 18:11 philliphoff

Is there a reason why the Dapr CLI shouldn't always monitor the port,

Do you mean that daprd monitors the port ?

youngbupark avatar Nov 12 '19 16:11 youngbupark

@youngbupark In your original proposal, you suggested that the Dapr CLI monitor the port and start/restart daprd accordingly. I was just asking whether it matters how the Dapr CLI was invoked (e.g. with a "watch" option or otherwise"); it seems like it'd be useful for Dapr to comprehend that the application has been restarted regardless.

philliphoff avatar Nov 13 '19 17:11 philliphoff

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Jan 04 '22 01:01 dapr-bot

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Feb 03 '22 01:02 dapr-bot

@yaron2 @youngbupark Is this issue still valid and requires attention?

mukundansundar avatar Feb 18 '22 02:02 mukundansundar

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Mar 20 '22 02:03 dapr-bot

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

dapr-bot avatar Mar 27 '22 02:03 dapr-bot

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Apr 26 '22 04:04 dapr-bot