billimek / home-assistant-config

Personal Configuration for Home Assistant
https://home-assistant.io/
Apache License 2.0
29 stars 4 forks source link

How does this repo work? #46

Closed joshuaspence closed 4 years ago

joshuaspence commented 4 years ago

I was just wondering how you are using this repo? I had assumed that it would be pulled into https://github.com/billimek/k8s-gitops by setting git.repo on the Helm chart, but I can't see this repo mentioned in k8s-gitops at all? Awesome repositories by the way!

billimek commented 4 years ago

Hi @joshuaspence,

Excellent question and perhaps an update to the README is in-order.

This repo essentially represents most of the files in the home assistant config directory. I leverage the vscode-server (running as a sidecar in the home-assistant pod) to easily access and modify the files running 'live' in the home-assistant pod. Even though the data is persisted to rook-based storage for the home-assistant kubernetes configuration, I also like having most of the configuration also saved & versioned to github for sharing purposes.

Here is an example of what the vscode config web interface looks like when running alongside home-assistant:

image

The .gitignore config is very restrictive in that by defaults all files are ignored and only certain files are permitted (mostly all of the yaml files. You will also note that the secrets.yaml is specifically ignored as obviously we don't want to save that to git.

*
!*.yaml
!*.py
!*.png
!*.md
!automation
!config
!scripts
!shell
!images
!tensorflow
!cameras
!**/*/*.yaml
!.gitignore
secrets.yaml
known_devices.yaml
entity_registry.yaml
!.storage
!.storage/lovelace
joshuaspence commented 4 years ago

Thanks for your response. I was wondering if you bootstrap the process at all? Or if you decided to bring up a new Kubernetes cluster, I guess you would just restore backups of your persistent storage?

billimek commented 4 years ago

@joshuaspence In the case of a fresh deployment of home-assistant, I see a couple of approaches to boot-strap a git-backed configuration:

  1. Assuming the underlying persistent storage for home-assistant configuration is accessible, you could access that storage and git init the config directory, taking take to exclude sensitive data with the .gitignore file
  2. Install home-assistant chart with either the configurator sidecar or the vcsode sidecar and do the git initialize/setup the same as above.

In my case, I was using home-assistant with a git-backed configuration before adopting kubernetes and the helm chart, so I had to 'copy' the configuration data from the host to the pod (via kubectl cp)

joshuaspence commented 4 years ago

Thanks for the info :+1: