Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./postgresql.conf missing? #570

Open
chrisl8 opened this issue Dec 20, 2024 · 12 comments
Open

./postgresql.conf missing? #570

chrisl8 opened this issue Dec 20, 2024 · 12 comments

Comments

@chrisl8
Copy link
Contributor

chrisl8 commented Dec 20, 2024

The new compose file references ./postgresql.conf, but no such file is provided. Instead a file called postgres.conf.example is provided instead. Is that the file that we are supposed to use?

It seems strange to require renaming the file to use settings that I presume are good defaults.

@mkaltner
Copy link

You should be able to rename that to postgresql.conf and map it in your volumes. I ran into an issue in my setup where the permissions were wrong so I was getting a health check failure. If you do, chmod/chown it. I just 777'd it and everything started working fine.

@BeastleeUK
Copy link

BeastleeUK commented Dec 21, 2024

I had made the changes manually to mine on the previous version but with the mapped file it just kept failing. I got a config error at line 1 and because the container loops I couldn't get onto it to check what it thinks is mounted. eventually worked out it was the name of the file hadn't updated once I realised I'd typed it incorrectly.

If the original file is not present in the image and the mounted version is required to run the service it should be included in the image instead, IMO. If this is a recommendation to update the default file then it shouldn't be considered a breaking change and just a note in the install instructions.

Thanks @Freika for the work you're putting into this,

@Beer17HWAM
Copy link

I think it's all unclear. I run the dockers with an older docker-compose.yml. That is the only file I have from where I start the containers. I don't understand where to place the postgresql.conf file. I know the dockers and files are somewhere but do I have to go there? Do I have to add two lines to the docker-compose.yml file?? Can I place the renamed example postgresql.conf file next to the docker-compose.yml file? It should be very nice to make it all a lot easier or at least more clear. I hope someone can explain me in detail what I have to do. Thanks in advance.

@Freika
Copy link
Owner

Freika commented Dec 22, 2024

The new compose file references ./postgresql.conf, but no such file is provided. Instead a file called postgres.conf.example is provided instead. Is that the file that we are supposed to use?

It seems strange to require renaming the file to use settings that I presume are good defaults.

The line in the docker-compose should be used as a reference, you can take postgres.conf.example, put it somewhere to your convenience and provide path to it in the compose file. I get it, it's probably confusing, I'll probably comment it out in the next release or do something to make it more clear it's optional.

If the original file is not present in the image and the mounted version is required to run the service it should be included in the image instead, IMO. If this is a recommendation to update the default file then it shouldn't be considered a breaking change and just a note in the install instructions.

The thing is, there is basically no way to put the file into dawarich docker image so it could be then used in dawarich_db container which uses postgres:14.2-alpine docker image. So it's a piece you have to do yourself, using the example file.

I don't understand where to place the postgresql.conf file.

Wherever you want, literally. Just provide correct file to it in your docker-compose. I'd say it's one of these cases where you learn something new about how docker and docker compose works. I know your struggle, went this road :)

Anyway, it's clear to me current situation with postgres config isn't really obvious so I'll fix it, hopefully soon.

@chrisl8
Copy link
Contributor Author

chrisl8 commented Dec 23, 2024

there is basically no way to put the file into dawarich docker image so it could be then used in dawarich_db container which uses postgres:14.2-alpine docker image.

I don't understand this statement at all. Why is it not as simple as adding:
- ./postgres.conf.example:/etc/postgresql/postgresql.conf
and
command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config
to the dawarich_db section of the compose file?

That is essentially what I did. My only complaint was that the example compose file you provided gave a different file name than what is actually in the repo.

What am I misunderstanding?

@Freika
Copy link
Owner

Freika commented Dec 23, 2024

@chrisl8 hmm maybe I got mixed up here... Let's make it clear for both of us.

We have postgres.conf.example that is a part of docker image, that runs dawarich_app container. Am I getting this right: in dawarich_db container you're absolutely sure it's being dragged into the database container and postgres actually uses this file configuration? My understanding is that your database container uses default postgresql.conf file, am I wrong here? I'm really not sure.

Can you please show output of cat /etc/postgresql/postgresql.conf from within your database container? Also, can you show output of this as well?

psql -U postgres

SHOW config_file;

@chrisl8
Copy link
Contributor Author

chrisl8 commented Dec 24, 2024

Sorry, maybe I confused what you were saying to me vs. what others are saying?

Anyway, for me I think the config file is working fine. My only concern was why the file in the repo is named differently than the file in your example compose file.

❯ docker exec -it dawarich_db sh
/ # psql -U postgres
psql (14.2)
Type "help" for help.

postgres=# SHOW config_file;
           config_file
---------------------------------
 /etc/postgresql/postgresql.conf
(1 row)

postgres=#

@Freika
Copy link
Owner

Freika commented Dec 24, 2024

@chrisl8 and what's the output for cat /etc/postgresql/postgresql.conf?

@Freika
Copy link
Owner

Freika commented Dec 24, 2024

Meanwhile in 0.21.1 I made custom config optional in docker compose

@chrisl8
Copy link
Contributor Author

chrisl8 commented Dec 24, 2024

Sorry, that should have been obvious. It appears to be the contents of the postgres.conf.example file as I would expect:

docker exec -it dawarich_db sh
/ # cat /etc/postgresql/postgresql.conf
listen_addresses = '*'
max_connections = 50

shared_buffers = 512MB

work_mem = 128MB
maintenance_work_mem = 128MB


dynamic_shared_memory_type = posix
checkpoint_timeout = 10min              # range 30s-1d
max_wal_size = 2GB
min_wal_size = 80MB
max_parallel_workers_per_gather = 4

log_min_duration_statement = 500        # -1 is disabled, 0 logs all statements
                                        # -1 disables, 0 logs all temp files
log_timezone = 'UTC'


autovacuum_vacuum_scale_factor = 0.05   # fraction of table size before vacuum
autovacuum_analyze_scale_factor = 0.05  # fraction of table size before analyze


datestyle = 'iso, dmy'

timezone = 'UTC'

lc_messages = 'en_US.utf8'                      # locale for system error message
                                        # strings
lc_monetary = 'en_US.utf8'                      # locale for monetary formatting
lc_numeric = 'en_US.utf8'                       # locale for number formatting
lc_time = 'en_US.utf8'                          # locale for time formatting


default_text_search_config = 'pg_catalog.english'

I feel like we are talking past each other here a little bit, like I'm missing what the disconnect is.

Anyway, as always, thank you for the amazing tool!

@Freika
Copy link
Owner

Freika commented Dec 25, 2024

Aha, so it really is working like that, I'll have to try it for my own instance. Thank you!

I feel like we are talking past each other here a little bit, like I'm missing what the disconnect is.

Yeah it seems so 😅

@Pr0mises
Copy link

Pr0mises commented Dec 31, 2024

I think @chrisl8 is confused why the postgresql.conf file is called postgresql.conf in the docker compose file, even though the file which is provided by the repo is called postgres.conf.example (Defeats plug and play)

Nonetheless making it optional inside the docker compose as already done, resolves this confusion and docker-compose should work out of the box again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants