expaso / hassos-addon-timescaledb

A HomeAssistant add-on containing PostgreSQL, psql client and TimeScaleDb
Apache License 2.0
53 stars 14 forks source link

pg_hba.conf - In which directory of HA #49

Open GG29071974 opened 6 days ago

GG29071974 commented 6 days ago

Hi together,

i installed succesfull timescaledb and pgadmin on my Homeassistant NUC. I even installed the filebrowser to make some configs. For postgreSQL that I can admin it with pgadmin I have to edit the pg_hba.conf => 127.0.0.1/32 Localhost for edit with pgadmin over port 5432. At the moment it is not possible because in pg_hba.conf is 0.0.0.0/32 is written So my problem as "beginner for postgreSQL and HA" is: Where is the pg_hba.conf file ? In description of your timescale there is only said, that it is in "data" In the mein data directory I dont find something... Can you tell me the path of directory for pg_hba.conf.

Thank you very much.

Regards Gunter

expaso commented 6 days ago

Hi Gunter!!

Thanks for reaching out!

Altering pg_hba.conf should not be needed for your usecase (connecting with pgAdmin).

Assuming you are running HassOS: The addon is reachable from other home-assistant addons like my pdAdmin Addon by it's internal hostname: 77b2833f-timescaledb on port 5432:

image

If you want to open-up the postgresql port to the outside world, use the port mapping option in the Addon-Config:

image

And finally , if you are using this docker image standalone, outside of home assistant, you should use the docker port map flag: -p 5432:5432 to map port 5432 on the host to 5432 on the container, so you can use pgAdmin.

Should you need to alter the pg_hba.conf file, it's within the container in it's /data/postgres directory. But be aware, changes to this fire are reverted everytime the container starters. So any alterations to this file should be done using an addon init command:

image

GG29071974 commented 4 days ago

Hi Expasio

Thanks for the very usefull support !

Last questioms:

1.) There I have two packages of you in your repository pgAdmin and TimescalaDB If I install pgAdmin then everything is already installed even your tool ? I can reach your addon then ? Or where I see this addon ? Regards Gunter

GG29071974 commented 3 days ago

ok fine everything works ! If I use local on homeassistant the hostname '77b2833f-timescaledb' in pgAdmin I can use and configure everything in postgreSQL DB. But if I want to access to postgresql DB from external client in network... What is the best way to configure ? At the moment connection will be refused ..

THX Regards Gunter

expaso commented 3 days ago

But if I want to access to postgresql DB from external client in network... What is the best way to configure ? At the moment connection will be refused ..

Thats in my first reply, you should open-up the postresql port:

image

In this example I map 45678 for example, so you can reach the PostgreSQL database from your LAN on port 45678