h-a: Add init container to wait for PostgreSQL
When Home Assistant starts, if PostgreSQL is unavailable, it will come up successfully, but without the history component. It never tries again to connect and enable the component. This makes it difficult to detect the problem and thus easy to overlook the missing functionality. To avoid having extended periods of missing state history, we'll force Home Assistant to wait for PostgreSQL to come up before starting.
This commit is contained in:
@@ -47,6 +47,28 @@ patches:
|
|||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: waitfordb
|
||||||
|
image: docker.io/library/postgres:15
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- until pg_isready; do sleep 1; done
|
||||||
|
env:
|
||||||
|
- name: PGHOST
|
||||||
|
value: default.postgresql
|
||||||
|
- name: PGGDATABASE
|
||||||
|
value: homeassistant
|
||||||
|
- name: PGUSER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: home-assistant.homeassistant.default.credentials.postgresql.acid.zalan.do
|
||||||
|
key: username
|
||||||
|
- name: PGPASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: home-assistant.homeassistant.default.credentials.postgresql.acid.zalan.do
|
||||||
|
key: password
|
||||||
containers:
|
containers:
|
||||||
- name: home-assistant
|
- name: home-assistant
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user