Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WSL2 instructions #807

Draft
wants to merge 36 commits into
base: master
Choose a base branch
from
Draft

Conversation

adamoutler
Copy link
Contributor

@adamoutler adamoutler commented Feb 15, 2021

Man, this had me tearing out my hair! I saw a lot of complaints in the forums while searching as well.

Proposed change

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Removed stale or deprecated documentation

Additional information

  • This PR fixes or closes issue: fixes #
  • Link to relevant existing code or pull request:

Summary by CodeRabbit

  • Documentation
    • Added detailed instructions for developing the Supervisor, including environment setup with Windows WSL2, tool installation, and development workflow using Visual Studio Code.

Man, this had me tearing out my hair!   I saw a lot of complaints in the forums while searching as well.
@adamoutler adamoutler marked this pull request as draft February 15, 2021 23:16
@adamoutler adamoutler marked this pull request as ready for review February 17, 2021 15:31
@adamoutler
Copy link
Contributor Author

Added full reset instructions to begin anew, quick setup instructions, enumerated minimum dependencies, and everything should be good to go factually. It's now a matter of how to present the information.

@MartinHjelmare MartinHjelmare changed the title Adding WSL2 instructions Add WSL2 instructions Mar 17, 2021
@adamoutler adamoutler requested a review from frenck March 19, 2021 21:58
frenck
frenck previously requested changes Apr 4, 2021
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has open comments. Dismissing review request to get it out of my "to review" list.

@frenck
Copy link
Member

frenck commented Apr 4, 2021

I already gave feedback on that above.

@adamoutler adamoutler requested a review from frenck April 4, 2021 20:00
@frenck
Copy link
Member

frenck commented Apr 5, 2021

I'm ok with this PR (language/content-wise). However, as said, I'm the proud owner of no-Windows enabled machines for 13 years already. The factual content has to be verified and approved by someone else.

@frenck frenck removed their request for review April 5, 2021 10:31
@frenck frenck dismissed their stale review April 5, 2021 10:31

Can't approve content

@ikifar2012
Copy link
Member

Does this still need to be reviewed?

@adamoutler
Copy link
Contributor Author

Yes.

@adamoutler adamoutler dismissed a stale review via 4826efe July 31, 2022 22:08
Copy link
Contributor

coderabbitai bot commented Jun 21, 2024

Walkthrough

Walkthrough

The Documentation for developing the Supervisor has been revamped to include comprehensive guidelines on setting up the development environment. This includes instructions for configuring Windows WSL2, installing essential tools such as NVM, Node, Yarn, and Docker, and setting up Visual Studio Code to run and test the Supervisor and Home Assistant within a Debian environment on WSL2.

Changes

File Change Summary
docs/supervisor/development.md Updated with detailed instructions on setting up the development environment, including WSL2 configuration, installing necessary tools, and running/testing the Supervisor and Home Assistant.

Sequence Diagrams

No sequence diagrams are necessary for these documentation-specific changes.


Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 9e8315d and 671ac00.

Files selected for processing (1)
  • docs/supervisor/development.md (1 hunks)
Additional context used
LanguageTool
docs/supervisor/development.md

[misspelling] ~6-~6: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ..., the Supervisor frontend panel and the hassio integration, by interacting with a dev...


[misspelling] ~6-~6: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...pment, these instructions will also use devcontainer and other tools that rely on Docker, so...


[uncategorized] ~10-~10: The verb “is” doesn’t seem to fit in this context, “are” is probably more formally correct. (AI_HYDRA_LEO_CPT_IS_ARE)
Context: ...isor development The instructions here is for development of the Supervisor itsel...


[misspelling] ~13-~13: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: .... Open the repo with Visual Studio Code devcontainer. 3. Create a branch in your fork. 4. Do...


[grammar] ~15-~15: Collocation: With the noun “changes”, you should use the verb “make”. (MAKE_A_CHANGE)
Context: ...er. 3. Create a branch in your fork. 4. Do your changes. 5. Test your changes with...


[misspelling] ~21-~21: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...n instance of the Supervisor inside the devcontainer you can use to test your changes. When ...


[uncategorized] ~25-~25: A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Context: ... If you need to rebuild the base of the Supervisor run the task "Build Supervisor" and the...


[style] ~32-~32: Consider using “incapable” to avoid wordiness. (NOT_ABLE_PREMIUM)
Context: ...tip You must use WSL2. WSL version 1 is not capable of running Docker and therefore is inco...


[uncategorized] ~35-~35: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE_2)
Context: ...of Debian for Home Assistant development but any problems may be difficult to troubl...


[misspelling] ~57-~57: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...from the Windows command prompt execute del %HOMEPATH%\AppData\Roaming\Code. After removing y...


[misspelling] ~57-~57: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...Data\Roaming\Code`. After removing your VSCode settings, launch VS Code, and remove al...


[typographical] ~57-~57: Consider adding a comma after ‘Finally’ for more clarity. (RB_LY_COMMA)
Context: ...nch VS Code, and remove all extensions. Finally either execute net stop LxssManager f...


[misspelling] ~57-~57: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ... all extensions. Finally either execute net stop LxssManager from an administrative cmd prompt or...


[uncategorized] ~72-~72: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...lose Visual Studio Code and reopen with code command from Debian. 3. Observe "W...


[uncategorized] ~75-~75: Consider adding a hyphen. (TOP_LEFT_CORNER)
Context: ...isor. When offered Dev Container in the lower right corner, click to open dev container. If...


[uncategorized] ~75-~75: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ... not presented with this option, verify extensions are installed then close Visual Studio ...


[uncategorized] ~75-~75: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...with this option, verify extensions are installed then close Visual Studio Code and reope...


[grammar] ~75-~75: The correct preposition appears to be “on”. (IN_WINDOWS)
Context: ...Code and reopen with the code command in Debian. :::note When working in Dev Con...


[uncategorized] ~80-~80: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...iner enabled Visual Studio Code, select menu option Terminal->New Terminal, then run...


[misspelling] ~80-~80: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...nal->New Terminal, then run the command sudo update-alternatives -set iptables /usr/sbin/iptables-legacy; sudo dockerd to ...


[misspelling] ~85-~85: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...ugging. Try setting a line break within supervisor/addons/utils.py and then visit Home Assistant...


[uncategorized] ~85-~85: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...ervisor/addons/utils.py` and then visit Home Assistant Supervisor Addon Store pages ...


[misspelling] ~85-~85: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...nd then visit Home Assistant Supervisor Addon Store pages to verify proper operation....


[style] ~88-~88: Consider a shorter alternative to avoid wordiness. (IN_ORDER_TO_PREMIUM)
Context: ...without sacrificing your dev container. In order to access a windows folder, you must type ...


[grammar] ~88-~88: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized. (A_WINDOWS)
Context: ...our dev container. In order to access a windows folder, you must type a folder name usi...


[misspelling] ~88-~88: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...st type a folder name using this format /mnt/<drive>/path-to/project. For example, ...


[misspelling] ~88-~88: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...ple, C:\Users\example\project becomes /mnt/c/Users/example/project. ::: ### Test...


[typographical] ~92-~92: Use a comma after an introductory phrase. (COMMA_INTRODUCTORY_WORDS_PHRASES)
Context: ...`. ::: ### Testing on a remote system For this you first need to create an account at ...


[uncategorized] ~126-~126: A comma might be missing here. (AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
Context: ... --no-cache ``` 4. On your remote system change the channel to dev with `ha su...


[misspelling] ~134-~134: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...o-supervisor:latest ``` 7. Restart the hassio-supervisor service with `systemctl restart hassos...


[uncategorized] ~139-~139: This verb does not appear to agree with the subject. Consider using a different form. (AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)
Context: ...tion development The instructions here is for development of the hassio integra...


[misspelling] ~139-~139: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...ructions here is for development of the hassio integration, we're going to assume tha...


[misspelling] ~139-~139: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...e Assistant Core development environment](development_environment.mdx) set up, and that you have [Supervisor ...


[uncategorized] ~143-~143: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...starting Home Assistant: - SUPERVISOR: Set to the IP of the machine running Ho...


[uncategorized] ~154-~154: The verb “is” doesn’t seem to fit in this context, “are” is probably more formally correct. (AI_HYDRA_LEO_CPT_IS_ARE)
Context: ...tend development The instructions here is for development of the Supervisor panel...


[misspelling] ~154-~154: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...rontend/development.md) set up with the devcontainer, and that you have [Supervisor API Acce...


[misspelling] ~157-~157: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...the task "Run HA Core for Supervisor in devcontainer" 3. When asked for the IP, use the IP o...


[misspelling] ~161-~161: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...visor-api-access) ### Without frontend devcontainer Update the hassio integration config...


[misspelling] ~163-~163: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...thout frontend devcontainer Update the hassio integration configuration in your `con...


[style] ~179-~179: Consider shortening or rephrasing this to strengthen your wording. (MAKE_CHANGES)
Context: ...isor panel will be rebuilt whenever you make changes to the source files. ## Supervisor API ac...


[misspelling] ~183-~183: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...pervisor API access To develop for the hassio integration and the Supervisor panel, ...


[misspelling] ~183-~183: Possible spelling mistake found. (MORFOLOGIK_RULE_EN_US)
Context: ...e done on a running system or with the devcontainer. [![Open your Home As...


[grammar] ~195-~195: Did you mean “fewer”? The noun “privileges” is countable. (FEWER_LESS)
Context: ...The Remote API proxy token has slightly less privileges than Home Assistant Core has...


[uncategorized] ~201-~201: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ... can change after a reboot or update of OS/container.

Markdownlint
docs/supervisor/development.md

54-54: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


24-24: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines


126-126: Expected: 1; Actual: 4; Style: 1/2/3 (MD029, ol-prefix)
Ordered list item prefix


127-127: Expected: 2; Actual: 5; Style: 1/2/3 (MD029, ol-prefix)
Ordered list item prefix


128-128: Expected: 3; Actual: 6; Style: 1/2/3 (MD029, ol-prefix)
Ordered list item prefix


134-134: Expected: 1; Actual: 7; Style: 1/2/3 (MD029, ol-prefix)
Ordered list item prefix


135-135: Expected: 2; Actual: 8; Style: 1/2/3 (MD029, ol-prefix)
Ordered list item prefix


75-75: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


79-79: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines


12-12: null (MD034, no-bare-urls)
Bare URL used


17-17: null (MD034, no-bare-urls)
Bare URL used

Gitleaks
docs/supervisor/development.md

147-147: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved
docs/supervisor/development.md Show resolved Hide resolved

:::tip
Always run scripts line by line to figure out where the problem lies. If you need to completely start over, you can uninstall the Debian app, then from the Windows command prompt execute `del %HOMEPATH%\AppData\Roaming\Code`. After removing your VSCode settings, launch VS Code, and remove all extensions. Finally either execute `net stop LxssManager` from an administrative `cmd` prompt or reboot your computer and try again.
:::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a really brute force kill all your setting approach. This will break other things in your system. I really don't want to promote such actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a full reset to stock.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you recommend?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking peoples vscode setups is not acceptable.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - #Add yarn repo certificate
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list #Add Yarn repo
sudo apt update; sudo apt install yarn -y; #Install yarn
curl -fsSL https://get.docker.com |sudo bash #install docker Community Edition
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird. Why is docker installed inside wsl. Any docker instance on windows is fully accessable from inside wsl instances.

It should be installed the official way in windows. Can you explain why that does not work?

Ps. Never done any supervisor development, so i might miss something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that you can use the command line tools.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker works inside wsl2 by default. Standard desktop install will inject the cli commands into your wsl2 images

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure enough. Good catch! I created a new instance of Ubuntu Preview and enabled in Settings->WSL->Integrations. Docker was running immediately. I can work with this.

image

Will get the system operational with this new guidance. But probably this weekend.

sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
sudo service docker start
code
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If stuff like this is needed, this instruction should really not use the standard wsl instance since it will break normal wsl uses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was required for wsl1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to do an integration coming soon. I'll be able to update for WSL 2

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft June 21, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants