postgresql-container icon indicating copy to clipboard operation
postgresql-container copied to clipboard

document how to install pgxn extensions

Open ibotty opened this issue 9 years ago • 4 comments

I am pretty sure, that's only possible using a separate docker image and "RUN pgxn install ...". If you think that ought to be documented, I can supply an example and write some documentation.

ibotty avatar Feb 27 '16 18:02 ibotty

@bparees setting P2, we really need to document how you can add extensions to postgres (postgis was a hot topic in v2)...

mfojtik avatar Apr 04 '16 20:04 mfojtik

@ibotty yes that's correct, you'd have to add a layer, so something like:

FROM centos/postgresql-94-centos7
USER root
RUN command to install extension
USER 26

a pull to the readme would be quite welcome.

bparees avatar Apr 04 '16 21:04 bparees

This works for me:

cat Dockerfile 
FROM registry.access.redhat.com/rhscl/postgresql-10-rhel7
USER root
RUN mkdir -p ${CONTAINER_SCRIPTS_PATH}/init
COPY install-uuid-ossp.sh ${CONTAINER_SCRIPTS_PATH}/init/install-uuid-ossp.sh
RUN chmod +x ${CONTAINER_SCRIPTS_PATH}/init/install-uuid-ossp.sh 
USER 26
cat install-uuid-ossp.sh 
psql -U postgres template1 -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'

Azulinho avatar Aug 08 '18 11:08 Azulinho

My application requires the pg_trgm extension. Is the only mechanism for adding an extension to create a new image as described in the above comment?

I am using openshift online as basis of tutorial and had wanted to simply use the postgresql in the catalog (with the nice UI flow). For my case, should I just have the user change the namespace to my project and have them import the image beforehand?

Any advice welcome, thanks!

Edit: Since I can rsh/terminal into the pod, I can add the extension manually. This is acceptable for the tutorial flow.

thomasmckay avatar Feb 28 '19 12:02 thomasmckay