Skip to content

Commit

Permalink
feat: Add pg_cron and Postgis (#44)
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Noël <[email protected]>
  • Loading branch information
philippemnoel authored Oct 13, 2024
1 parent cd0589a commit 9ab277f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/paradedb-test-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
jobs:
paradedb-test-eks:
name: Test ParadeDB Helm Chart on AWS EKS via LocalStack
runs-on: ubuntu-latest
runs-on: ubuntu-22.04 # As of October 2024, the LocalStack GitHub Action is not compatible with Ubuntu 24.04
if: github.event.pull_request.draft == false

steps:
Expand All @@ -35,7 +35,7 @@ jobs:
uses: azure/setup-helm@v4

- name: Start LocalStack
uses: LocalStack/[email protected].2
uses: LocalStack/[email protected].3
with:
image-tag: "latest"
install-awslocal: "true"
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ This will launch a shell inside the instance. You can connect via `psql` with:
psql -d paradedb
```

## Development

To test changes to the Chart on a local Minikube cluster, follow the instructions from [Getting Started](#getting-started), replacing the `helm upgrade` step by the path to the directory of the modified `Chart.yaml`.

```bash
helm upgrade --install paradedb --namespace paradedb-database --create-namespace ./charts/paradedb
```

## License

ParadeDB is licensed under the [GNU Affero General Public License v3.0](LICENSE) and as commercial software. For commercial licensing, please contact us at [[email protected]](mailto:[email protected]).
12 changes: 12 additions & 0 deletions charts/paradedb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ This will launch a shell inside the instance. You can connect via `psql` with:
psql -d paradedb
```

## Development

To test changes to the Chart on a local Minikube cluster, follow the instructions from [Getting Started](#getting-started), replacing the `helm upgrade` step by the path to the directory of the modified `Chart.yaml`.

```bash
helm upgrade --install paradedb --namespace paradedb-database --create-namespace ./charts/paradedb
```

Cluster Configuration
---------------------

Expand Down Expand Up @@ -258,3 +266,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| Name | Email | Url |
| ---- | ------ | --- |
| ParadeDB | <[email protected]> | <https://paradedb.com> |

## License

ParadeDB is licensed under the [GNU Affero General Public License v3.0](LICENSE) and as commercial software. For commercial licensing, please contact us at [[email protected]](mailto:[email protected]).
19 changes: 18 additions & 1 deletion charts/paradedb/templates/_bootstrap.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@
bootstrap:
initdb:
{{- with .Values.cluster.initdb }}
{{- with (omit . "postInitApplicationSQL" "postInitTemplateSQL" "owner") }}
{{- with (omit . "postInitSQL" "postInitApplicationSQL" "postInitTemplateSQL" "owner") }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
{{- if .Values.cluster.initdb.owner }}
owner: {{ tpl .Values.cluster.initdb.owner . }}
{{- end }}
postInitSQL:
{{- if eq .Values.type "paradedb" }}
- CREATE EXTENSION IF NOT EXISTS pg_cron;
{{- end }}
{{- with .Values.cluster.initdb }}
{{- range .postInitSQL }}
{{- printf "- %s" . | nindent 6 }}
{{- end -}}
{{- end }}
postInitApplicationSQL:
{{- if eq .Values.type "paradedb" }}
- CREATE EXTENSION IF NOT EXISTS pg_search;
- CREATE EXTENSION IF NOT EXISTS pg_analytics;
- CREATE EXTENSION IF NOT EXISTS pg_ivm;
- CREATE EXTENSION IF NOT EXISTS vector;
- CREATE EXTENSION IF NOT EXISTS postgis;
- CREATE EXTENSION IF NOT EXISTS postgis_topology;
- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
- ALTER DATABASE "{{ default "paradedb" .Values.cluster.initdb.database }}" SET search_path TO public,paradedb;
{{- end }}
{{- with .Values.cluster.initdb }}
Expand All @@ -29,6 +42,10 @@ bootstrap:
- CREATE EXTENSION IF NOT EXISTS pg_analytics;
- CREATE EXTENSION IF NOT EXISTS pg_ivm;
- CREATE EXTENSION IF NOT EXISTS vector;
- CREATE EXTENSION IF NOT EXISTS postgis;
- CREATE EXTENSION IF NOT EXISTS postgis_topology;
- CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
- ALTER DATABASE template1 SET search_path TO public,paradedb;
{{- end }}
{{- with .Values.cluster.initdb }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ spec:
postgresql:
parameters:
max_connections: "42"
cron.database_name: "postgres"
pg_hba:
- host all 1.2.3.4/32 trust
pg_ident:
- mymap /^(.*)@mydomain\.com$ \1
shared_preload_libraries:
- pgaudit
- pg_cron
bootstrap:
initdb:
database: mydb
Expand All @@ -32,6 +34,7 @@ spec:
postInitTemplateSQL:
- CREATE TABLE mytable (id serial PRIMARY KEY, name VARCHAR(255));
postInitSQL:
- CREATE EXTENSION IF NOT EXISTS pg_cron;
- CREATE TABLE mytable (id serial PRIMARY KEY, name VARCHAR(255));
superuserSecret:
name: supersecret-secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ cluster:
postgresql:
parameters:
max_connections: "42"
cron.database_name: "postgres"
pg_hba:
- host all 1.2.3.4/32 trust
pg_ident:
- mymap /^(.*)@mydomain\.com$ \1
shared_preload_libraries:
- pgaudit
- pg_cron
initdb:
database: mydb
owner: dante
Expand All @@ -71,6 +73,7 @@ cluster:
postInitTemplateSQL:
- CREATE TABLE mytable (id serial PRIMARY KEY, name VARCHAR(255));
postInitSQL:
- CREATE EXTENSION IF NOT EXISTS pg_cron;
- CREATE TABLE mytable (id serial PRIMARY KEY, name VARCHAR(255));
additionalLabels:
foo: bar
Expand Down
7 changes: 4 additions & 3 deletions charts/paradedb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ cluster:

postgresql:
# -- PostgreSQL configuration options (postgresql.conf)
parameters: {}
parameters:
# Required by pg_cron
cron.database_name: postgres
# max_connections: 300
# -- PostgreSQL Host Based Authentication rules (lines to be appended to the pg_hba.conf file)
pg_hba: []
Expand All @@ -259,8 +261,7 @@ cluster:
# name: "" # Name of the secret containing the initial credentials for the owner of the user database. If empty a new secret will be created from scratch
# options: []
# encoding: UTF8
# postInitSQL:
# - CREATE EXTENSION IF NOT EXISTS vector;
# postInitSQL: []
# postInitApplicationSQL: []
# postInitTemplateSQL: []

Expand Down

0 comments on commit 9ab277f

Please sign in to comment.