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 instructions for using devcontainer from WSL #1949

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/development_environment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,29 @@ If the Dev Container was set up correctly - it supports debugging by default, ou

It is also possible to debug a remote Home Assistance instance (e.g., production instance) by following the procedure described [here](https://www.home-assistant.io/integrations/debugpy/).

### Use devcontainer from Windows Subsystem for Linux (WSL)

It is possible to start a devcontainer from a Windows Subsystem for Linux (WSL) distribution (e.g. Ubuntu).
This allows you to [work on the home assistant frontend](https://developers.home-assistant.io/docs/frontend/development).
You can do this by forking the frontend project inside Ubuntu and [mount its directory into the devcontainer](https://developers.home-assistant.io/docs/frontend/development#configuring-home-assistant).

**Prerequisites**

- [Docker](https://docs.docker.com/get-docker/)
Copy link
Contributor

Choose a reason for hiding this comment

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

since WSL2 supports systemd now, we should point the user both options for docker - Docker Desktop and Docker-Engine (i prefer the installing the docker engine over docker desktop, since docker desktop comes with some unneeded overhead)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't consider that option yet.
So far "Docker" in these instructions has meant "Docker desktop installed on windows".

I'm not sure if mentioning docker-engine here is helpful for most people.
There is already a lot of information and I'm afraid adding more options makes it even more overwhelming.

Copy link
Contributor

Choose a reason for hiding this comment

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

Consider mentioning Docker Engine as an alternative to Docker Desktop.

Given that Docker Engine might be preferred by some users due to its lower overhead compared to Docker Desktop, consider mentioning it as an alternative, especially now that WSL2 supports systemd. This could provide users with more flexibility in choosing their setup.

- [Visual Studio code](https://code.visualstudio.com/)
- WSL + A WSL Distribution of your choice (Note: The instructions will be based on Ubuntu). Refer to the [Developing on Windows](#developing-on-windows) section below for further instructions and tips.

1. Follow the [instructions in the Docker documentation](https://docs.docker.com/desktop/wsl/#enabling-docker-support-in-wsl-2-distros) to ensure your WSL distribution is running in WSL 2 mode and enable Docker-WSL integration.
2. Go to [Home Assistant core repository](https://github.com/home-assistant/core) and click "fork".
3. Open the terminal of your WSL distro, and clone your fork with `git clone <url from your fork>`.
4. Use the command `code core/` to open Visual Studio Code. In the bottom left corner you will see `WSL: <name of the distribution you are using>`.
5. Reopen the project in a development container. In Visual Studio Code, either use the "Reopen in Container" message in the bottom right corner or press the f1 key and select `Dev Containers: Reopen in Container`. After Visual Studio Code has reopened you should see `Dev Container: Home Assistant Dev` in the bottom left corner.
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify UI navigation instructions.

The instructions for reopening the project in a development container could be clearer. Specifically, the description of UI elements could benefit from the use of bold text to highlight buttons and labels, improving readability and user guidance.

- In Visual Studio Code, either use the "Reopen in Container" message in the bottom right corner or press the f1 key and select `Dev Containers: Reopen in Container`.
+ In Visual Studio Code, either use the **Reopen in Container** message in the **bottom-right corner** or press the **F1** key and select **Dev Containers: Reopen in Container**.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
5. Reopen the project in a development container. In Visual Studio Code, either use the "Reopen in Container" message in the bottom right corner or press the f1 key and select `Dev Containers: Reopen in Container`. After Visual Studio Code has reopened you should see `Dev Container: Home Assistant Dev` in the bottom left corner.
5. Reopen the project in a development container. In Visual Studio Code, either use the **Reopen in Container** message in the **bottom-right corner** or press the **F1** key and select **Dev Containers: Reopen in Container**. After Visual Studio Code has reopened you should see **Dev Container: Home Assistant Dev** in the **bottom-left corner**.
Tools
LanguageTool

[uncategorized] ~78-~78: Consider adding a hyphen. (TOP_LEFT_CORNER)
Context: ...he "Reopen in Container" message in the bottom right corner or press the f1 key and select `...


[uncategorized] ~78-~78: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...ontainer. After Visual Studio Code has reopened you should see Dev Container: Home Ass...


[uncategorized] ~78-~78: Consider adding a hyphen. (TOP_LEFT_CORNER)
Context: ...v Container: Home Assistant Dev` in the bottom left corner. 6. You can verify that your dev...

6. You can verify that your dev container is set up properly by the following:
* Open the command palette in Visual Studio Code - `Shift`+`Command`+`P`(Mac) / `Ctrl`+`Shift`+`P` (Windows/Linux).
* Select `Tasks: Run Task` -> `Run Home Assistant Core`
* A terminal should open and begin outputting activity. Check for errors and wait for the output to stop/slow down.
* Navigate a web browser to `http://localhost:8123`, and you should see the Home Assistant setup screen.

## Manual Environment

_You only need these instructions if you do not want to use devcontainers._
Expand Down