alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.57k stars 224 forks source link

🐛 [Postgres] Custom configuration cannot be applied (and overwritten instead) #971

Closed interkelstar closed 1 year ago

interkelstar commented 1 year ago

Description

I need to set up ssl mode for postgresql db. Nut when i tried modifying config file I noticed that it's not being picked up and it is overriten instead, each run. I tried to specify other config locations (like /config/addons_config/postgres/new.conf) with pre-configured new.conf file, but to no avaail.

Reproduction steps

1. Install PostgreSQL addon
2. Start the addon
3. You will see `WARNING: A default config.env file was copied in /config/addons_config/postgres. Please customize according to https://hub.docker.com/_/postgres and restart the add-on` in logs
4. Try to change anything in the postgresql.conf
5. Restart the addon
6. See the same warning message and postgresql.conf file is being overwritten to default state

Addon Logs

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Postgres
 Postgres 15
-----------------------------------------------------------
 Add-on version: 15.3-test6
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.5  (amd64 / generic-x86-64)
 Home Assistant Core: 2023.8.4
 Home Assistant Supervisor: 2023.08.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
CONFIG_LOCATION='/config/addons_config/postgres/postgresql.conf'
POSTGRES_DB='db'
POSTGRES_PASSWORD=******
POSTGRES_USER='db'
/etc/cont-init.d/01-custom_script.sh: executing
[20:30:39] INFO: Execute /config/addons_autoscripts/postgres.sh if existing
[20:30:39] INFO: ... no script found
/etc/cont-init.d/20-folders.sh: executing
/etc/cont-init.d/99-run.sh: executing
[20:30:39] WARNING: A default config.env file was copied in /config/addons_config/postgres. Please customize according to https://hub.docker.com/_/postgres and restart the add-on

[20:30:39] INFO: Starting the app

PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-08-28 20:30:39.559 CEST [173] LOG:  starting PostgreSQL 15.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
2023-08-28 20:30:39.559 CEST [173] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-08-28 20:30:39.560 CEST [173] LOG:  listening on IPv6 address "::", port 5432
2023-08-28 20:30:39.565 CEST [173] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-08-28 20:30:39.575 CEST [191] LOG:  database system was interrupted; last known up at 2023-08-28 19:53:56 CEST
2023-08-28 20:30:39.650 CEST [191] LOG:  database system was not properly shut down; automatic recovery in progress
2023-08-28 20:30:39.654 CEST [191] LOG:  redo starts at 0/193BBA8
2023-08-28 20:30:39.654 CEST [191] LOG:  invalid record length at 0/193BBE0: wanted 24, got 0
2023-08-28 20:30:39.654 CEST [191] LOG:  redo done at 0/193BBA8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2023-08-28 20:30:39.661 CEST [189] LOG:  checkpoint starting: end-of-recovery immediate wait
2023-08-28 20:30:39.681 CEST [189] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.007 s, sync=0.003 s, total=0.022 s; sync files=2, longest=0.002 s, average=0.002 s; distance=0 kB, estimate=0 kB
2023-08-28 20:30:39.692 CEST [173] LOG:  database system is ready to accept connections

Architecture

amd64

OS

HAos

alexbelgium commented 1 year ago

Hi sorry I hadn't time to look yet, pretty sure it's because the code overwrites it by default. I'll have to adapt to code to prevent that

interkelstar commented 1 year ago

May be so. But it shouldn't overwrite if the specified config file already exists, but it overwrites and uses the default one every time!

alexbelgium commented 1 year ago

It was just a typo. Should be ok now!

interkelstar commented 1 year ago

Actually after update it cannot run anymore with

env: can't execute '/ha_entrypoint.sh': No such file or directory
alexbelgium commented 1 year ago

Argh i see thanks

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.