Files
homelab-infra/docs/runbooks/smart-home-bootstrap.md
T

3.1 KiB

Smart-Home Bootstrap

Ziel: Den Stack smart-home/ auf Kallilabcore initial startklar machen, ohne Secrets oder UI-State ins Git zu schreiben.

1. Fachrepo auf dem Host bereitstellen

cd /mnt/user/services
git clone https://git.kaleschke.info/Micha/smart-home-kalli.git smart-home-kalli
cd smart-home-kalli
git checkout main

Der Home-Assistant-Container mountet daraus einzelne YAML-Dateien read-only nach /config.

2. Home-Assistant-Appdata vorbereiten

mkdir -p /mnt/user/appdata/homeassistant
cp /mnt/user/services/smart-home-kalli/secrets-template/secrets.yaml.example \
  /mnt/user/appdata/homeassistant/secrets.yaml
cp /mnt/user/services/smart-home-kalli/secrets-template/trusted_proxies.yaml.example \
  /mnt/user/appdata/homeassistant/trusted_proxies.yaml

Danach trusted_proxies.yaml auf das echte Traefik-/frontend_net-Subnetz anpassen:

docker network inspect frontend_net

3. Mosquitto vorbereiten

mkdir -p /mnt/user/appdata/mosquitto/config \
  /mnt/user/appdata/mosquitto/data \
  /mnt/user/appdata/mosquitto/log

docker run --rm -it \
  -v /mnt/user/appdata/mosquitto/config:/mosquitto/external_config \
  eclipse-mosquitto:2.0.22 \
  mosquitto_passwd -c /mosquitto/external_config/passwordfile homeassistant

cat > /mnt/user/appdata/mosquitto/config/aclfile <<'EOF'
user homeassistant
topic readwrite #
EOF

Das initiale Passwort anschliessend in /mnt/user/appdata/homeassistant/secrets.yaml eintragen. LAN-Port 1883 bleibt in Phase 1 geschlossen.

4. Stack deployen

Komodo-Stack:

  • Repo: homelab-infra
  • Pfad: smart-home/docker-compose.yml
  • Branch: nach Review master

Nach dem Start pruefen:

docker ps --filter name=homeassistant
docker ps --filter name=smarthome-mosquitto
docker logs --tail=100 homeassistant
docker logs --tail=100 smarthome-mosquitto

5. Smoke-Test

  • https://home.kaleschke.info zeigt die Home-Assistant-Oberflaeche.
  • Keine Trusted-Proxy-Fehler im HA-Log.
  • MQTT-Integration verbindet sich mit Host smarthome-mosquitto, Port 1883.
  • HA-native Backup-Erstellung funktioniert.

6. Fachrepo-Update

Das Fachrepo /mnt/user/services/smart-home-kalli ist kein eigener Komodo-Stack. Aenderungen wirken erst nach diesem Host-Ablauf:

cd /mnt/user/services/smart-home-kalli
git pull --ff-only origin main
docker restart homeassistant

Der Restart ist Pflicht, weil configuration.yaml, automations.yaml, scripts.yaml und scenes.yaml als Einzeldateien in den Container gemountet werden. Nach einem git pull kann Docker sonst noch den alten Datei-Inode sehen.

7. UI-Editor-Politik

automations.yaml, scripts.yaml und scenes.yaml sind read-only aus Git gemountet. Der Home-Assistant-UI-Editor fuer diese Dateien ist deshalb nicht der primaere Schreibweg. Automationen und Scripts werden in Git gepflegt; UI-State und Integrations-State bleiben in .storage und werden per Borg gesichert.

8. Abnahmebedingung

Vor produktiven Energie-Automationen muss ein Restore-Test fuer /mnt/user/appdata/homeassistant, /mnt/user/appdata/mosquitto und den Clone /mnt/user/services/smart-home-kalli dokumentiert sein.