-
Notifications
You must be signed in to change notification settings - Fork 34
X[DEPRECATED] old Dev Setup
Here's a short description on how I run my development setup for Home Assistant.
I run everything in docker using docker-compose.
My development root directory contains:
-
config/
- My dev configuration for Home Assistant -
home-assistant-polymer/
- clone of https://github.com/home-assistant/home-assistant-polymer -
home-assistant.io/
- clone of https://github.com/home-assistant/home-assistant.io -
home-assistant/
- clone of https://github.com/home-assistant/home-assistant -
docker-compose.yml
- The docker-compose file running everything
version: '3'
services:
hass:
container_name: homeassistant-hass
image: homeassistant/home-assistant:dev
volumes:
- ./home-assistant:/usr/src/app
- ./config:/config
- ./home-assistant-polymer:/frontend
environment:
TS: Europe/Stockholm # adjust this to your liking, obviously
restart: always
ports:
- "8123:8123"
polymer:
container_name: homeassistant-polymer
build: ./home-assistant-polymer
image: home-assistant-polymer:latest
volumes:
- ./home-assistant-polymer:/frontend
restart: always
command: script/develop
To get started; in your root directory, run
$ docker-compose build
$ docker-compose run polymer script/bootstrap
$ docker-compose up
Once home-assistant and home-assistant-polymer has finished booting, stop everything with ctrl+c and set up config/configuration.yaml
. It will have been created by Home Assistant.
The important setting in the Home Assistant configuration is to add
frontend:
development_repo: /frontend
But you may also want to add:
demo:
to get some demo entities to experiment with.
To start the dev server, simply run
$ docker-compose up -d
If you wish to see the log output, either omit the -d
or run
$ docker-compose logs -f
To get the latest version of the backend or frontend, simply perform a git pull
.
Since ./home-assistant
is bound to /usr/src/app
in the container, you will always run whatever code you currently have checked out, rather than the version installed in the container.
After changes to the backend you can restart the service with
$ docker-compose stop hass
$ docker-compose up -d hass
If there have been any changes to the node modules of the home-assistant-polymer repo, you may need to run script/bootstrap
or yarn
inside that container.
If it's already running, this can be done with
$ docker-compose execute polymer script/bootstrap
$ docker-compose execute polymer yarn
If not, use
$ docker-compose run polymer script/bootstrap
$ docker-compose run polymer yarn
The home-assistant-polymer repo has a number of git hooks installed that runs various linters and code formaters when many actions are performed. If you don't have the correct dependencies installed on your system, you will get an error message but the command will go through.
To make sure you're not pushing any code that hasn't gone through the formaters, make sure to run:
$ docker-compose execute polymer git commit --amend
before pushing your code. This will open vim to allow you to edit the latest commit message. Accept it without changes by pressing ZZ
.