Configure Home Assistant Podman container

The default Home Assistant configuration does not allow running a
reverse proxy in front of the application.  To enable this, the
`use_x_forwarded_for` and `trusted_proxies` options have to be set.

Since we want `/var/lib/homeassistant` to be a Btrfs subvolume, we can't
simply include the necessary files in the correct location in the rootfs
image.  Instead, we must define "copy tree" (`C`) actions for
`systemd-tmpfiles` to copy them from `/usr/share/factory`.
Unfortunately, `systemd-tmpfiles` considers `v` and `C` actions
conflicting, and thus will not copy the directory contents recursively.
Each file has to be listed explicitly.
gentoo
Dustin 2023-03-26 12:15:50 -05:00
parent d6580cfdf4
commit b1afb4adf1
11 changed files with 50 additions and 1 deletions

View File

@ -37,7 +37,7 @@ usr/share/aclocal
usr/share/baselayout usr/share/baselayout
usr/share/bash-completion usr/share/bash-completion
usr/share/doc usr/share/doc
usr/share/factory usr/share/factory/etc
usr/share/gdb usr/share/gdb
usr/share/info usr/share/info
usr/share/locale/*/*/*python* usr/share/locale/*/*/*python*

View File

@ -0,0 +1,19 @@
[Unit]
After=network-online.target
Wants=network-online.target
[Container]
Image=ghcr.io/home-assistant/yellow-homeassistant:stable
Network=host
Volume=/var/lib/homeassistant:/config:Z
User=300
Group=300
ReadOnly=true
VolatileTmp=yes
[Service]
TimeoutStartSec=5min
UMask=0077
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,2 @@
u homeassistant 300 "Home Assistant" /var/lib/homeassistant /bin/sh
g homeassistant 300

View File

@ -0,0 +1,8 @@
v /var/lib/homeassistant 0700 homeassistant homeassistant - -
C /var/lib/homeassistant/automations.yaml - - - -
C /var/lib/homeassistant/configuration.yaml - - - -
C /var/lib/homeassistant/groups.yaml - - - -
C /var/lib/homeassistant/http.yaml - - - -
C /var/lib/homeassistant/scenes.yaml - - - -
C /var/lib/homeassistant/scripts.yaml - - - -
C /var/lib/homeassistant/secrets.yaml - - - -

View File

@ -0,0 +1,14 @@
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
http: !include http.yaml
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

View File

@ -0,0 +1,4 @@
server_host: '::1'
trusted_proxies:
- '::1'
use_x_forwarded_for: true