(feat) add postgresql to homeassistant (#1128)
* (feat) add postgresql to homeassistant * bump
This commit is contained in:
@@ -4,6 +4,10 @@ dependencies:
|
||||
- name: common
|
||||
repository: https://truecharts.org
|
||||
version: 8.3.5
|
||||
- condition: postgresql.enabled
|
||||
name: postgresql
|
||||
repository: https://truecharts.org/
|
||||
version: 3.0.14
|
||||
deprecated: false
|
||||
description: home-assistant App for TrueNAS SCALE
|
||||
home: https://github.com/truecharts/apps/tree/master/charts/stable/home-assistant
|
||||
@@ -25,4 +29,4 @@ sources:
|
||||
- https://github.com/home-assistant/home-assistant
|
||||
- https://github.com/cdr/code-server
|
||||
type: application
|
||||
version: 8.0.8
|
||||
version: 8.1.0
|
||||
|
||||
@@ -9,6 +9,24 @@ image:
|
||||
pullPolicy: IfNotPresent
|
||||
tag: v2021.10.4@sha256:6f5892e307edd0b135f4ccab1ecee70518e0418b26e6264c23c67d1982eece86
|
||||
|
||||
initContainers:
|
||||
init-db:
|
||||
image: "{{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}"
|
||||
command: ["/usr/sbin/init.sh"]
|
||||
volumeMounts:
|
||||
- name: init
|
||||
mountPath: /usr/sbin
|
||||
- name: config
|
||||
mountPath: /config
|
||||
|
||||
# -- Enable and configure postgresql database subchart under this key.
|
||||
# For more options see [postgresql chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/postgresql)
|
||||
# @default -- See values.yaml
|
||||
postgresql:
|
||||
enabled: true
|
||||
postgresqlUsername: home-assistant
|
||||
postgresqlDatabase: home-assistant
|
||||
|
||||
##
|
||||
# Most other defaults are set in questions.yaml
|
||||
# For other options please refer to the wiki, default_values.yaml or the common library chart
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
{{/* Define the configmap */}}
|
||||
{{- define "hass.configmap" -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-init
|
||||
data:
|
||||
init.sh: |-
|
||||
#!/bin/sh
|
||||
echo "postgresql password: {{ ( printf "%v%v:%v@%v-%v:%v/%v?client_encoding=utf8" "postgresql://" .Values.postgresql.postgresqlUsername .Values.postgresql.Password .Release.Name "postgresql" "5432" .Values.postgresql.postgresqlDatabase ) | quote }}"
|
||||
if test -f "/config/configuration.yaml"; then
|
||||
echo "configuration.yaml exists."
|
||||
if grep -q recorder: "/config/configuration.yaml"; then
|
||||
echo "configuration.yaml already contains recorder"
|
||||
fi
|
||||
else
|
||||
echo "configuration.yaml does NOT exist."
|
||||
cp /config/init/configuration.yaml.default /config/configuration.yaml
|
||||
fi
|
||||
configuration.yaml.default: |-
|
||||
# Configure a default setup of Home Assistant (frontend, api, etc)
|
||||
default_config:
|
||||
|
||||
# Text to speech
|
||||
tts:
|
||||
- platform: google_translate
|
||||
|
||||
# Example Includes
|
||||
# group: !include groups.yaml
|
||||
# automation: !include automations.yaml
|
||||
# script: !include scripts.yaml
|
||||
# scene: !include scenes.yaml
|
||||
|
||||
recorder:
|
||||
db_url: {{ ( printf "%s?client_encoding=utf8" ( .Values.postgresql.url.complete | trimAll "\"" ) ) | quote }}
|
||||
|
||||
{{- end -}}
|
||||
@@ -1 +1,22 @@
|
||||
{{ include "common.all" . }}
|
||||
{{/* Make sure all variables are set properly */}}
|
||||
{{- include "common.setup" . }}
|
||||
|
||||
{{/* Render configmap for hass */}}
|
||||
{{- include "hass.configmap" . }}
|
||||
|
||||
{{/* Append the general secret volumes to the volumes */}}
|
||||
{{- define "hass.initvolume" -}}
|
||||
enabled: "true"
|
||||
mountPath: "/config/init"
|
||||
readOnly: true
|
||||
type: "custom"
|
||||
volumeSpec:
|
||||
configMap:
|
||||
name: {{ include "common.names.fullname" . }}-init
|
||||
defaultMode: 0777
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set .Values.persistence "init" (include "hass.initvolume" . | fromYaml) -}}
|
||||
|
||||
{{/* Render the templates */}}
|
||||
{{ include "common.postSetup" . }}
|
||||
|
||||
@@ -14,6 +14,16 @@ service:
|
||||
main:
|
||||
port: 8123
|
||||
|
||||
initContainers:
|
||||
init-db:
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
command: ["/config/init/init.sh"]
|
||||
volumeMounts:
|
||||
- name: init
|
||||
mountPath: /config/init
|
||||
- name: config
|
||||
mountPath: /config
|
||||
|
||||
# # Enable devices to be discoverable
|
||||
# hostNetwork: true
|
||||
|
||||
@@ -44,27 +54,14 @@ persistence:
|
||||
varrun:
|
||||
enabled: true
|
||||
|
||||
# # Path to your Z-Wave / Zigbee device in the container
|
||||
# additionalVolumeMounts:
|
||||
# - name: zwave-usb
|
||||
# mountPath: /dev/serial/by-id/usb-0658_0200-if00
|
||||
|
||||
# # Path to your Z-Wave / Zigbee device on the host
|
||||
# additionalVolumes:
|
||||
# - name: zwave-usb
|
||||
# hostPath:
|
||||
# path: /dev/serial/by-id/usb-0658_0200-if00
|
||||
|
||||
# Enabled postgres
|
||||
# ... for more options see https://github.com/bitnami/charts/tree/master/bitnami/postgresql
|
||||
# -- Enable and configure postgresql database subchart under this key.
|
||||
# For more options see [postgresql chart documentation](https://github.com/bitnami/charts/tree/master/bitnami/postgresql)
|
||||
# @default -- See values.yaml
|
||||
postgresql:
|
||||
enabled: false
|
||||
enabled: true
|
||||
postgresqlUsername: home-assistant
|
||||
postgresqlPassword: home-assistant-pass
|
||||
postgresqlDatabase: home-assistant
|
||||
persistence:
|
||||
enabled: false
|
||||
# storageClass: ""
|
||||
existingSecret: "dbcreds"
|
||||
|
||||
# Enable influxdb
|
||||
# ... for more options see https://github.com/bitnami/charts/tree/master/bitnami/influxdb
|
||||
|
||||
Reference in New Issue
Block a user