Improve dapr init experience on Windows machines running WSL#1641
Improve dapr init experience on Windows machines running WSL#1641WhitWaldo wants to merge 14 commits intodapr:masterfrom
dapr init experience on Windows machines running WSL#1641Conversation
… elevated prompts on Windows to address port-busy errors for Dapr scheduler when WSL is installed on the system. If not elevated and the error is encountered on Windows, the output suggests launching as an elevated process and retrying (and why). Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1641 +/- ##
==========================================
+ Coverage 15.15% 15.75% +0.60%
==========================================
Files 64 65 +1
Lines 7191 7247 +56
==========================================
+ Hits 1090 1142 +52
- Misses 6016 6017 +1
- Partials 85 88 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR improves the dapr init experience on Windows by detecting and remediating a common scheduler port-binding failure associated with WSL2/WinNAT, including tailored guidance when the CLI is not running elevated.
Changes:
- Added Windows-specific helpers to detect elevation/WSL availability and to restart WSL/WinNAT as a remediation step.
- Added a pre-flight port availability check for scheduler ports on non-elevated Windows when WSL is present, emitting guidance to rerun elevated.
- Added unit tests for the new port-check helper logic and OS-specific stubs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/standalone/standalone.go | Adds scheduler port checks and Windows elevated remediation (WSL shutdown + WinNAT stop/start) around scheduler container startup. |
| pkg/standalone/wsl_windows.go | Implements Windows elevation detection and WSL/WinNAT control helpers. |
| pkg/standalone/wsl_nowindows.go | Adds non-Windows no-op stubs for the Windows-specific helpers. |
| pkg/standalone/wsl_windows_test.go | Adds Windows-only tests ensuring the Windows helper functions are callable/non-blocking. |
| pkg/standalone/wsl_nowindows_test.go | Adds non-Windows tests verifying the stubbed helper behavior. |
| pkg/standalone/wsl_test.go | Adds cross-platform unit tests for port-check helper behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…er service Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
…ue in addition to other three outstanding constraints Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Signed-off-by: Whit Whit <whit.waldo@innovian.net>
Description
Implementing additional functionality for
dapr initwhen running in elevated prompts on Windows to address port-busy errors for Dapr scheduler when WSL is installed on the system. If not elevated and the error is encountered on Windows, the output suggests launching as an elevated process and retrying (and why).Otherwise, if the user is running the CLI in Windows, using an elevated command prompt and runs
dapr initand has WSL2 installed, this will run as normal, but before it starts running the scheduler, it will:It will then proceed to run the Dapr Scheduler service as normal and this is expected to work this time. Then, it will restart WSL and start the Windows NAT service again, and complete as normal.
This was authored in Claude, but I gave it a manual pass to fix several things that just didn't look right and validated that tests appear comprehensive and pass locally.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #1630
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: