Document how to run backend and frontend in WSL2
raman325 opened this issue · comments
Notes that @petro provided:
-
Install VSCode on windows.
-
Get/Enable WSL2 on windows.
-
Install Ubuntu WSL2 image.
-
Start ubuntu wsl2 image.
-
Install Docker.
0. In docker...- Settings -> General -> Check Use the WSL2 based engine
- Settings -> Resources -> WSL Integration:
- Check Enable integration with my default WSL Distro
- Turn on the toggle for your Ubuntu wsl2 image.
-
Install Home Assistant Core Dev Container
0. Open VSCode-
Click the <> arrows in the lower left corner.
-
Select Connect to WSL
- This may take a moment, it's connecting to ubuntu in WSL. Once it's finished, vscode will be running from ubuntu.
- The vscode instance will be running from /home//
-
Open a new terminal in vscode and run
git clone <path to your github fork of HA core>
- this will create a core folder located at /home//core
-
Hit file -> open folder, from the dropdown select
core
, then clickOK
. -
Hit F1 to open the command pallet and then search for
Dev Containers: Reopen in Container
- This will build your container, it takes a moment.
-
Keep this window open, this is the HA backend. We will be coming back here after installing the frontend.
-
-
Install Frontend
0. Open a new VSCode window.-
Click the <> arrows in the lower left corner.
-
Select Connect to WSL
- This may take a moment, it's connecting to ubuntu in WSL. Once it's finished, vscode will be running from ubuntu.
- The vscode instance will be running from /home//
-
Open a new terminal in vscode
-
Install nvm
-
run this to install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
-
run this to get it to run:
source ~/.nvm/nvm.sh
-
-
Make a clone of HA fronend, run
git clone <path to your github fork of HA Frontend>
-
Hit file -> open folder, from the dropdown select
frontend
, then clickOK
. -
Open a new terminal in vscode (or use your existing one and type
cd frontend
-
Run the following commands to install dependencies for the frontend.
nvm use script/bootstrap
-
Run the frontend
script/develop
-
-
Go back to HA's vscode window.
-
Open
.devcontainer/devcontainer.json
. Add"mounts": [ "source=/home/<your windows username>/frontend,target=/workspaces/frontend,type=bind,consistency=cached" ],
-
Open
config/configuration.yaml
, change the frontend section to# Load frontend themes from the themes folder frontend: themes: !include_dir_merge_named themes development_repo: /workspaces/frontend/
-
Run Home Assistant from the Run and Debug button in VSCode.
Copy Snippet
Edit Snippet
Wordwrap
Install VSCode on windows.
Get/Enable WSL2 on windows.
Install Ubuntu WSL2 image.
Start ubuntu wsl2 image.
Install Docker.
In docker...
Settings -> General -> Check Use the WSL2 based engine
Settings -> Resources -> WSL Integration:
Check Enable integration with my default WSL Distro
Turn on the toggle for your Ubuntu wsl2 image.
Install Home Assistant Core Dev Container
Open VSCode
Click the <> arrows in the lower left corner.
Select Connect to WSL
This may take a moment, it's connecting to ubuntu in WSL. Once it's finished, vscode will be running from ubuntu.
The vscode instance will be running from /home//
Open a new terminal in vscode and run
git clone
this will create a core folder located at /home//core
Hit file -> open folder, from the dropdown select core, then click OK.
Hit F1 to open the command pallet and then search for Dev Containers: Reopen in Container
This will build your container, it takes a moment.
Keep this window open, this is the HA backend. We will be coming back here after installing the frontend.
Install Frontend
Open a new VSCode window.
Click the <> arrows in the lower left corner.
Select Connect to WSL
This may take a moment, it's connecting to ubuntu in WSL. Once it's finished, vscode will be running from ubuntu.
The vscode instance will be running from /home//
Open a new terminal in vscode
Install nvm
run this to install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
run this to get it to run:
source ~/.nvm/nvm.sh
Make a clone of HA fronend, run
git clone
Hit file -> open folder, from the dropdown select frontend, then click OK.
Open a new terminal in vscode (or use your existing one and type cd frontend
Run the following commands to install dependencies for the frontend.
nvm use
script/bootstrap
Run the frontend
script/develop
Go back to HA's vscode window.
Open .devcontainer/devcontainer.json. Add
"mounts": [
"source=/home//frontend,target=/workspaces/frontend,type=bind,consistency=cached"
],
Open config/configuration.yaml, change the frontend section to
Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
development_repo: /workspaces/frontend/
Run Home Assistant from the Run and Debug button in VSCode.