Skip to content

Commit

Permalink
Add initdbScript to create the hstore extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Grossar authored and strixBE committed Feb 24, 2020
1 parent 6261060 commit 75052d4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion caluma/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,41 @@ affinity: {}

postgresql:
enabled: true

postgresqlDatabase: caluma
postgresqlUsername: caluma
postgresqlPassword: CHANGEME

## This is one of those hacks where you're both proud and shocked about the
## thing you created at the same time.
##
## First this is required because the Bitnami PostgreSQL image is not running
## the initdb scripts passed as .sql with SUPERUSER privileges in PostgreSQL.
## ref: https://github.com/bitnami/bitnami-docker-postgresql/issues/155
##
## Next we thought that we could just override the pg_hba.conf via
## files/pg_hba.conf and switch socket connections to trust, but that didn't
## work either because somehow the .Files variable doesn't work in included
## subcharts.
## ref: https://github.com/helm/helm/issues/4994
##
## So now we're stuck with this piece of shell code to activate the hstore
## extension required by Caluma.
initdbScripts:
create_extension_hstore.sh: |
#!/bin/sh
#
# This script is being used to temporarily switch socket connections to trusted
# to enable the hstore extension in the database above.
set -xeuf -o pipefail
sed -E -i 's/local +all +all +md5/local all all trust/' /opt/bitnami/postgresql/conf/pg_hba.conf
pg_ctl reload
psql --username=postgres --dbname="${POSTGRES_DB}" --command 'CREATE EXTENSION IF NOT EXISTS hstore;' --echo-errors
sed -E -i 's/local +all +all +trust/local all all md5/' /opt/bitnami/postgresql/conf/pg_hba.conf
pg_ctl reload
##
## MinIO chart configuration
##
Expand All @@ -84,7 +115,6 @@ minio:
ingress:
enabled: true
annotations: {}
path: /minio
hosts:
- caluma.chart-example.local
tls: []

0 comments on commit 75052d4

Please sign in to comment.