Charts: [stable/postgresql] PostGIS support

Created on 17 Jan 2019  路  13Comments  路  Source: helm/charts

Is this a request for help?:

Yes

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
FEATURE REQUEST

Version of Helm and Kubernetes:
Helm: 2.8.2
K8s: v1.10.12

Which chart:
postgresql v 3.9.1

What happened:
I've tried to enable the postgis extension by running a script at the start up as user 0 (root). This was necessary for installing packages with apt-get.

My values.yaml :

postgresql:
  securityContext:
    runAsUser: 0
  initdbScripts:
    setup_postgis_extension.sh: |
      apt-get update
      apt-get install wget gcc make build-essential libxml2-dev libgeos-dev libproj-dev libgdal-dev -y
      su - postgres
      cd /tmp
      wget "http://download.osgeo.org/postgis/source/postgis-2.4.6.tar.gz"
      export C_INCLUDE_PATH=/opt/bitnami/postgresql/include/:/opt/bitnami/common/include/
      export LIBRARY_PATH=/opt/bitnami/postgresql/lib/:/opt/bitnami/common/lib/
      export LD_LIBRARY_PATH=/opt/bitnami/postgresql/lib/:/opt/bitnami/common/lib/
      tar zxf postgis-2.4.6.tar.gz && cd postgis-2.4.6
      ./configure --with-pgconfig=/opt/bitnami/postgresql/bin/pg_config
      make
      make install

Works fine - Until the postgresql pod gets killed.
The new pod gets a Permission denied on the file postmaster.pid:

Welcome to the Bitnami postgresql container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
 nami    INFO  Initializing postgresql
postgre INFO  ==> No injected postgresql.conf file found. Creating default postgresql.conf file...
postgre INFO  ==> No injected pg_hba.conf file found. Creating default pg_hba.conf file...
postgre INFO  ==> Deploying PostgreSQL with persisted data...
postgre INFO  ==> Configuring PostgreSQL...
postgre INFO  ==> Configuring replication parameters...
postgre INFO  ==> Configuring permissions for config files...
postgre INFO 
postgre INFO  ########################################################################
postgre INFO   Installation parameters for postgresql:
postgre INFO     Persisted data and properties have been restored.
postgre INFO     Any input specified will not take effect.
postgre INFO   This installation requires no credentials.
postgre INFO  ########################################################################
postgre INFO 
nami    INFO  postgresql successfully initialized
INFO  ==> Starting postgresql... 
nami    ERROR Unable to start com.bitnami.postgresql: pg_ctl: could not open PID file "/opt/bitnami/postgresql/data/postmaster.pid": Permission denied

I tried to change the permission in my setup_postgis_extension.sh script by adding things like

sudo chown -R 1001:1001 /opt/bitnami/postgresql
sudo chmod 700 /opt/bitnami/postgresql/data

with no luck.

What you expected to happen:
I expected that the pod can be restarted without any problems.

How to reproduce it (as minimally and precisely as possible):
Use the values.yaml form above and kill the pod once.

Anything else we need to know:
I use an alias in my deployment.yaml.

There is also a feature request for Postgis at the bitnami repo (https://github.com/bitnami/bitnami-docker-postgresql/issues/106)

I hope you can help me! Thank you very much in advance!

lifecyclstale

Most helpful comment

Good to know @SDC2021!!

We will update this and the linked issue once we have more information about PostgreSQL + Postgis.

All 13 comments

Hello @SDC2021,

I am afraid that this approach is not suitable to install the postgis extension. The scripts specified using initdbScripts are only executed during the first database initialization so even if we fix the permission issue with the postmaster.pid file, the postgis extension won't be available in the new pod.

Regarding the request to include postgis in the container, we are evaluating it. At this moment we are not sure if it would be better to just include postgis in the bitnami container or create a different postgres container with postgis installed.

Hello @tompizmor ,

thanks for your reply.

I already solved the problem by creating my own bitnami image with the installed postgis extension. Works fine so far!

Nevertheless, I am looking forward for your solution. It would be great to have an officially maintained postgis helm chart! :+1:

Greetings
SDC2021

Good to know @SDC2021!!

We will update this and the linked issue once we have more information about PostgreSQL + Postgis.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

This issue is being automatically closed due to inactivity.

No update on this @tompizmor ?

I am afraid we couldn't work on this yet. However, we still see the value and plan to do it.
This issue has been already close by the bot but we still have the task opened in our work board.

@SDC2021 - Hi! Is your image publicly available?

Best regards

Jone

@lurajon Sry, it's not...

any news on this @tompizmor ?

Hello @SDC2021,

I am afraid that this approach is not suitable to install the postgis extension. The scripts specified using initdbScripts are only executed during the first database initialization so even if we fix the permission issue with the postmaster.pid file, the postgis extension won't be available in the new pod.

Regarding the request to include postgis in the container, we are evaluating it. At this moment we are not sure if it would be better to just include postgis in the bitnami container or create a different postgres container with postgis installed.

Hi ,
regarding " include postgis in the bitnami container "
Can you please explain how this done ?
Thanks

Regarding the request to include postgis in the container, we are evaluating it. At this moment we are not sure if it would be better to just include postgis in the bitnami container or create a different postgres container with postgis installed.

Please also consider including uuid-ossp extension as it's another popular extension.

Hello @tompizmor ,

thanks for your reply.

I already solved the problem by creating my own bitnami image with the installed postgis extension. Works fine so far!

Nevertheless, I am looking forward for your solution. It would be great to have an officially maintained postgis helm chart! 馃憤

Greetings
SDC2021

Hi SDC2021,

Please let me know how you solve this problem, because after creating my own image, the postgis is working fine,but as soon as we delete the pod, we again need to install the postgis.

Was this page helpful?
0 / 5 - 0 ratings