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

Container image ignores additional shared_preload_libraries added via postgresql.conf #403

Open
kiguigui opened this issue Mar 3, 2024 · 6 comments
Labels
type/question 🙋 Further information is requested

Comments

@kiguigui
Copy link

kiguigui commented Mar 3, 2024

In the dockerfile, psql is started with CMD ["postgres" "-c" "shared_preload_libraries=vectors.so" "-c" "search_path=\"$user\", public, vectors"].

When adding shared_preload_libraries like pg_stat_statements to postgresql.conf, these settings are ignored.

postgresql.conf:

#local_preload_libraries = ''
#session_preload_libraries = ''
shared_preload_libraries = 'vectors.so,pg_stat_statements'
#jit_provider = 'llvmjit'               # JIT library to use

output of pg_settings:

grafik

However it is possible to overwrite this in Kubernetes by specifying:

          args:
          - "postgres"
          - "-c" 
          - "shared_preload_libraries=vectors.so,pg_stat_statements"
          - "-c" 
          - "search_path=\"$user\", public, vectors"

in your stateful set or deployment.

After that, all libraries are loaded:

grafik

EDIT: args were not complete

@gaocegege gaocegege added the type/question 🙋 Further information is requested label Mar 4, 2024
@usamoi
Copy link
Collaborator

usamoi commented Mar 4, 2024

@VoVAllen Should it be expected?

@VoVAllen
Copy link
Member

VoVAllen commented Mar 4, 2024

I didn't see what we can fix here. Probably mention it in the documentations should be enough? If we put it in the postgresql.conf, then use -c vectors.so will overrider that. Only one will work.

@usamoi
Copy link
Collaborator

usamoi commented Mar 4, 2024

We could just remove -c ... -c ... in dockerfile. But users have to read documentation before using the image (it sounds weird that users could use it without reading documentation).

@gaocegege
Copy link
Member

How about using entrypoint and cmd in dockerfile: https://spacelift.io/blog/docker-entrypoint-vs-cmd

@gaocegege
Copy link
Member

ENTRYPOINT ['postgres']
CMD ["-c" "shared_preload_libraries=vectors.so" "-c" "search_path=\"$user\", public, vectors"]

@LancerComet
Copy link

I have encountered this problem when I was configuring the container on my NAS:

image

The solution is simple, just execute psql -U postgres -c 'ALTER SYSTEM SET shared_preload_libraries = "vectors.so"' and restart the container, but I remember this wasn't happened in 0.1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question 🙋 Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants