diff --git a/example/README.md b/example/README.md index f3e520b..1835b95 100644 --- a/example/README.md +++ b/example/README.md @@ -8,8 +8,21 @@ kubectl apply -f https://github.com/kubedb/postgres-docker/raw/release-11.16-alpine-cron/example/catalog.yaml ``` -3. Deploy a demo PostgreSQL database. +3. need to provide `shared_preload_libraries = 'pg_cron'` config inside `postgreSQL` `conf` file to enable pg-corn extension. At first, let’s create a secret with `user.conf` as key and set `shared_preload_libraries` there. +``` +kubectl apply -f https://github.com/kubedb/postgres-docker/raw/release-11.16-alpine-cron/example/custom-config.yaml +``` + +4. Deploy a demo PostgreSQL database. ``` kubectl apply -f https://github.com/kubedb/postgres-docker/raw/release-11.16-alpine-cron/example/demo.yaml ``` + +5. Then We need to create extension for our server. For This we need to exec into primary and create pgcron Extension + +```shell +$ kubectl exec -it -n demo demo-pgcron-0 -- bash +$ psql +postgres=# CREATE EXTENSION pg_cron; +``` \ No newline at end of file diff --git a/example/custom-config.yaml b/example/custom-config.yaml new file mode 100644 index 0000000..3a20561 --- /dev/null +++ b/example/custom-config.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: demo +--- +apiVersion: v1 +kind: Secret +metadata: + name: postgres-configuration + namespace: demo +stringData: + user.conf: |- + # ref: https://github.com/citusdata/pg_cron#setting-up-pg_cron + # required to load pg_cron background worker on start-up + shared_preload_libraries = 'pg_cron' + # optionally, specify the database in which the pg_cron background worker should run (defaults to postgres) + cron.database_name = 'postgres' \ No newline at end of file diff --git a/example/demo.yaml b/example/demo.yaml index 03ecd6f..d38f991 100644 --- a/example/demo.yaml +++ b/example/demo.yaml @@ -11,6 +11,8 @@ metadata: spec: version: "11.16-alpine-cron" replicas: 3 + configSecret: + name: postgres-configuration standbyMode: Hot storageType: Durable storage: