lildude / ha-addon-teslamate

Home Assistant add-on for TeslaMate
MIT License
8 stars 0 forks source link

ERROR: PostgreSQL is not ready #22

Open SpencerBaker opened 4 days ago

SpencerBaker commented 4 days ago

I can't seem to get it to start past Postgres. It seems like it fails trying to connect to Postgres and I'm unsure if postgres has successfully launched. Given the logs it says it's ready for connections and that the database system has shutdown. I assume it does that to not keep any connections open.

Any idea as to what could be causing this?

Postgres configuration yaml:

user: admin
password: {password}
database: teslamate

Teslamate configuration:

database_user: admin
database_pass: {password}
database_name: teslamate
database_host: 29b65938-postgres
database_port: 5432
database_ssl: false
grafana_import_dashboards: true
grafana_folder_name: TeslaMate
grafana_host: a0d7b954-grafana
grafana_port: 3000
grafana_user: admin
grafana_pass: {grafana_password}
disable_mqtt: false
mqtt_host: core-mosquitto
mqtt_user: homeassistant
mqtt_pass: {mqtt_user_password}
mqtt_tls: false
mqtt_tls_accept_invalid_certs: false
mqtt_namespace: ""
timezone: America/Denver
import_dir: /share/teslamate
default_geofence: ""
encryption_key: {key}

TeslaMate logs:

[...]
[21:16:32] INFO: Finished Importing Grafana Dashboards
[21:16:36] ERROR: PostgreSQL is not ready
[21:16:36] WARNING: TeslaMate crashed, halting add-on
[21:16:36] INFO: TeslaMate stopped, restarting...
s6-rc: info: service legacy-services: stopping
[21:16:36] INFO: Nginx stopped, restarting...
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Postgres logs:

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /data/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... America/Denver
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2024-07-03 17:08:40.252 MDT [44] WARNING:  no usable system locales were found
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

    pg_ctl -D /data/postgres -l logfile start

waiting for server to start....2024-07-03 17:08:44.627 MDT [49] LOG:  starting PostgreSQL 12.5 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit
2024-07-03 17:08:44.633 MDT [49] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-07-03 17:08:44.706 MDT [50] LOG:  database system was shut down at 2024-07-03 17:08:41 MDT
2024-07-03 17:08:44.720 MDT [49] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

waiting for server to shut down....2024-07-03 17:08:45.690 MDT [49] LOG:  received fast shutdown request
2024-07-03 17:08:45.695 MDT [49] LOG:  aborting any active transactions
2024-07-03 17:08:45.697 MDT [49] LOG:  background worker "logical replication launcher" (PID 56) exited with exit code 1
2024-07-03 17:08:45.697 MDT [51] LOG:  shutting down
2024-07-03 17:08:45.749 MDT [49] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2024-07-03 17:08:45.832 MDT [7] LOG:  starting PostgreSQL 12.5 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit
2024-07-03 17:08:45.832 MDT [7] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-07-03 17:08:45.832 MDT [7] LOG:  listening on IPv6 address "::", port 5432
2024-07-03 17:08:45.862 MDT [7] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-07-03 17:08:45.932 MDT [63] LOG:  database system was shut down at 2024-07-03 17:08:45 MDT
2024-07-03 17:08:45.947 MDT [7] LOG:  database system is ready to accept connections
SpencerBaker commented 4 days ago

It appears I can't get my PostgreSQL addon working correctly?

SpencerBaker commented 4 days ago

I can't get Grafana to connect to postgres either.

I just reinstalled HAOS and these are my logs from grafana when trying to connect to the data source:

logger=tsdb.postgres t=2024-07-04T15:34:49.99796952-06:00 level=error msg="Query error" err="dial tcp: lookup 29b65938-postgres on 127.0.0.11:53: no such host"
logger=tsdb.postgres endpoint=queryData pluginId=grafana-postgresql-datasource dsName=TeslaMate dsUID=edqrw5hxl6mf4b uname=admin t=2024-07-04T15:34:49.997763745-06:00 level=error msg="Query error" err="dial tcp: lookup 29b65938-postgres on 127.0.0.11:53: no such host"
logger=tsdb.postgres endpoint=queryData pluginId=grafana-postgresql-datasource dsName=TeslaMate dsUID=edqrw5hxl6mf4b uname=admin t=2024-07-04T15:34:49.997641469-06:00 level=error msg="Query error" err="dial tcp: lookup 29b65938-postgres on 127.0.0.11:53: no such host"