Skip to content

Commit

Permalink
feat(cnpg): add experiment with CloudNativePG
Browse files Browse the repository at this point in the history
  • Loading branch information
mborne committed May 31, 2024
1 parent 5c38f7d commit fe0bceb
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cnpg/k8s-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

helm repo add cnpg https://cloudnative-pg.github.io/charts

helm repo update

helm upgrade --install cnpg \
--namespace cnpg \
--create-namespace \
cnpg/cloudnative-pg

kubectl -n cnpg apply -f "${SCRIPT_DIR}/manifest/postgis-cluster.yaml"
43 changes: 43 additions & 0 deletions cnpg/manifest/postgis-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# https://cloudnative-pg.io/documentation/current/samples/
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgis-cluster
spec:
instances: 3

imageName: ghcr.io/cloudnative-pg/postgis:15

postgresql:
# https://pgtune.leopard.in.ua/
parameters:
max_connections: "100"
shared_buffers: "256MB"
effective_cache_size: "768MB"
maintenance_work_mem: "128MB"
checkpoint_completion_target: "0.9"
wal_buffers: "7864kB"
default_statistics_target: "500"
random_page_cost: "1.1"
effective_io_concurrency: "200"
work_mem: "655kB"
huge_pages: "off"
min_wal_size: "4GB"
max_wal_size: "16GB"

resources:
requests:
memory: "1024Mi"
cpu: 1
limits:
memory: "1024Mi"
cpu: 1

# https://cloudnative-pg.io/documentation/current/bootstrap/
bootstrap:
initdb:
database: gis
postInitTemplateSQL:
- CREATE EXTENSION postgis;
storage:
size: 10Gi

0 comments on commit fe0bceb

Please sign in to comment.