Skip to content

Commit

Permalink
Update devcontainer and force it to use root to resolve permission is…
Browse files Browse the repository at this point in the history
…sues
  • Loading branch information
ekutner committed Jan 28, 2023
1 parent 96c3454 commit 6eab57c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Opening multiple projects inside of a devcontainer is a bit cluncky so follow th

1. Create a parent directory that will contain both the integration and the API library.
2. Create a folder for the integration. Make sure it follows the structure required by HACS, in particular it must have "custome_components" subfolder where all the integration code will reside. The .devcontainer folder should also be here.
3. Create a folder for the API library. Since this library has to be pubuilshed to
3. Create a folder for the API library. Since this library has to be published to
pypi make sure it has a setup.py file at its root.
At this point your folder structure should look something like this:
```
Expand Down
9 changes: 5 additions & 4 deletions .devcontainer/config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ tts:

# Dev config starts here
logger:
default: warn
default: info
logs:
home_connect_async: debug
home_connect_alt: debug
custom_components.home_connect_alt: debug
home_connect_async: error
home_connect_alt: error
custom_components.home_connect_alt: error
homeassistant.helpers.config_entry_oauth2_flow: debug

# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
#debugpy:
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "3.9",
"VARIANT": "3.10",
"LOCAL_INTEGRATION_FOLDER": "${localWorkspaceFolder}"
},
"context": ".."
Expand All @@ -21,6 +21,7 @@
"source=${localWorkspaceFolderBasename}_config,target=/config,type=volume", // create a persistent named volume for the configuration folder
"source=${localWorkspaceFolder}/../home-connect-async,target=${containerWorkspaceFolder}/../home-connect-async,type=bind,consistency=consistent"
],
"remoteUser": "root",
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/post-create.sh",
"postStartCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/post-start.sh",
"extensions": [
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/scripts/install-ha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ if [ "$hassver" = "" ]; then
fi

# Update Home Assistant to the latest version
python3 -m pip --disable-pip-version-check install --upgrade git+https://github.com/home-assistant/home-assistant.git@$hassver
hass --script ensure_config -c /config
sudo python3 -m pip --disable-pip-version-check install --upgrade git+https://github.com/home-assistant/home-assistant.git@$hassver
sudo hass --script ensure_config -c /config
4 changes: 2 additions & 2 deletions .devcontainer/scripts/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pip3 install isort colorlog

SCRIPT_PATH=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# This chmod is a safety measure for scripts that are added after the container was first created
chmod +x $SCRIPT_PATH/*
$SCRIPT_PATH/install-ha.sh
sudo chmod +x $SCRIPT_PATH/*
sudo $SCRIPT_PATH/install-ha.sh



Expand Down

0 comments on commit 6eab57c

Please sign in to comment.