Overview
PostGIS extends PostgreSQL with geographic object types, spatial indexes and spatial SQL functions, making it the standard choice for location-aware applications. This template deploys one PostgreSQL 18 server with PostGIS 3.6 on a persistent volume, and an optional cron job that writes compressedpg_dumpall backups to AWS S3 or Google Cloud Storage.
Database credentials are not template values. The server reads its username, password and database name from a dictionary secret you create before installing, so no password passes through Helm or lands in the release. The template creates no credential secret of its own.
What Gets Created
Prerequisites
One secret must exist before you install. It holds the credentials your applications put in their connection strings. Secrets are org-level, so no GVC flag is involved.Create the database credentials secret
username, password and database. The first time the volume is initialized, the server creates that user (as a superuser) and that database, and loads the PostGIS extensions into it:config.credentialsSecretName to this name. Read it back later with cpln secret reveal SECRET_NAME -o yaml — a bare cpln secret reveal prints only a summary table, not the values.Installation
Install the chart from the marketplace registry, pointing it at the secret you created:UI
CLI
Terraform
Pulumi
Configuration
Each block below is the shipped default for that part ofvalues.yaml.
Server and Resources
maxCpu to minCpu may not exceed 4:1. Raising maxCpu without raising minCpu can cross that limit and is rejected when the workload is applied.Credentials
Storage
Internal Access
internalAccess can take several minutes to take effect — re-test before concluding it did not apply.
Backup
A cron workload runspg_dumpall on the schedule and uploads a gzip-compressed SQL dump of every database and role to the bucket for the chosen provider. It authenticates with the username and password from your credentials secret. Each provider’s bucket, cloud account and policy steps are under Backing Up.
backup.image must match the server’s major version: tag 18.1.0 for postgis/postgis:18-*, 17.1.0 for postgis/postgis:17-*. A mismatched client refuses to dump a newer server.Connecting
This template exposes no public endpoint. Everything below is reachable from inside the GVC, subject tointernalAccess.type.
postgis and postgis_topology extensions (plus fuzzystrmatch and postgis_tiger_geocoder on PostGIS 3.6) loaded at first boot. The image also creates a template_postgis template database with the same extensions, so CREATE DATABASE newdb TEMPLATE template_postgis; gives any additional database spatial support without running CREATE EXTENSION yourself.
To verify from your own machine, tunnel to the server and connect with psql:
psql inside the container, where local connections need no password:
Operations
Backing Up
Backups are off by default. Enable them withbackup.enabled: true, pick a backup.provider, and complete that provider’s setup below first. The job writes postgres-TIMESTAMP.sql.gz objects under backup.PROVIDER.prefix in your bucket on every run of backup.schedule.
AWS S3
-
Create an S3 bucket. Set
backup.aws.bucketto its name andbackup.aws.regionto its region. -
If you do not have one yet, create a Control Plane cloud account for the AWS account holding the bucket. Set
backup.aws.cloudAccountNameto its name. -
Create an IAM policy scoped to exactly that bucket, replacing
YOUR_BUCKET_NAME:
- Set
backup.aws.policyNameto that policy’s name. The template attaches it to the workload identity and nothing else — the bucket in your policy is the only storage the backup job can reach.
GCS
-
Create a GCS bucket. Set
backup.gcp.bucketto its name. -
Create a Control Plane cloud account for the GCP project holding the bucket, and set
backup.gcp.cloudAccountNameto its name. -
Grant the cloud account’s service account the Storage Admin (
roles/storage.admin) role. The template additionally binds the identity toroles/storage.objectAdminon exactly the bucket inbackup.gcp.bucket.
On-Demand Dump
Without scheduled backups, or before a risky change, take a single-database dump withpg_dump inside the container. Binary output must be wrapped in base64 on both sides — cpln workload exec corrupts raw binary streams:
pg_restore -l DATABASE.dump lists its contents and fails on a corrupted archive.
Restoring a Backup
Each scheduled backup is a gzip-compressedpg_dumpall script, so it is restored by connecting to the postgres maintenance database as the superuser from your credentials secret; the script recreates the roles and databases it contains, including the CREATE EXTENSION statements for PostGIS. Run the commands from a client that can reach both the bucket and the server — a workload inside the GVC, or your own machine with cpln port-forward RELEASE_NAME-postgis 5432:5432 --gvc GVC_NAME open and --host=127.0.0.1 in place of the internal hostname.
- AWS S3
- GCS
already exists errors for the role, the database and the template_postgis template that the server created at first boot are expected; the rest of the script loads normally. Restore into an empty server (a fresh install, or one whose databases you have dropped) to avoid duplicate-object errors on existing tables.
To restore an on-demand dump, send it back through cpln workload exec with --stdin — stdin is off by default and a file piped in without it is silently discarded. Restore into an empty database; CREATE DATABASE DATABASE TEMPLATE template_postgis; gives you one with the extensions already loaded:
Rotating the Password
The server reads the secret only when the volume is first initialized, so change the password inside PostgreSQL first, then update the secret to match:Upgrading From 1.3.2 or Earlier
Template versions up to 1.3.2 took the database credentials as plain Helm values with a working default password, and wrote them into a chart-owned secret named after the release. Version 1.4.0 removed both, and an upgrade that still carries the old keys is refused at render — your existing release is left running rather than restarted against a different password.Read the credentials the database already uses
Create the prerequisite secret with those same values
username, password and database. Different values here do not change the database — they only leave the workload unable to authenticate.Remove the old keys from your values
config.username, config.password and config.database, and set config.credentialsSecretName to your secret’s name. If you set resources.cpu or resources.memory, rename them to resources.maxCpu and resources.maxMemory.Upgrade, then rotate any default password
Upgrading From 1.4.0
Version 1.4.1 removes theaws::ReadOnlyAccess managed policy from the backup identity. That policy granted read access to every bucket in your AWS account and contained no write actions, so it never carried the backup itself — but it was silently supplying any read action your own bucket-scoped policy happened to omit. The identity now carries cpln-connector and your backup.aws.policyName policy only.
Before upgrading an AWS-backed release, check that your IAM policy contains the full action list under AWS S3. If it already matches, no action is needed. GCS-backed releases and releases without backups are unaffected.
Scaling and Availability
- The server is pinned to one replica. Do not raise it — a single volume set backs a single server, and a second replica cannot mount it. A second replica would be an isolated instance, not a member of a cluster.
- Every
cpln helm upgraderestarts the server, including the first upgrade after an install even when nothing changed. Plan each one as a short write outage. - A node failure reschedules the server and reattaches the same volume. The exposure is minutes of downtime, not data loss.
Troubleshooting
Workload never becomes ready and cpln logs returns nothing
Workload never becomes ready and cpln logs returns nothing
cpln logs '{gvc="GVC_NAME", workload="RELEASE_NAME-postgis"}' --limit 50 --since 10m returns zero lines.Cause: config.credentialsSecretName names a secret that does not exist, so the container is never started. The message is only visible in status.versions[].message:cpln workload force-redeployment RELEASE_NAME-postgis --gvc GVC_NAME.Upgrade fails with 'config.username and config.password were REMOVED'
Upgrade fails with 'config.username and config.password were REMOVED'
cpln helm upgrade stops before touching any resource:Password changed in the secret but the old one still works
Password changed in the secret but the old one still works
password key in the credentials secret, but the server still accepts the previous password and rejects the new one.Cause: the secret is applied only when the volume is first initialized. Afterwards the stored password lives in the database, not the secret.Fix: change it inside PostgreSQL and then update the secret to match — see Rotating the Password.Backup job fails with 'aborting because of server version mismatch'
Backup job fails with 'aborting because of server version mismatch'
cpln logs '{gvc="GVC_NAME", workload="RELEASE_NAME-postgis-backup"}' --limit 50 --since 1d shows the run ending in aborting because of server version mismatch, and no new object appears in the bucket.Cause: backup.image carries an older PostgreSQL major than image. pg_dumpall refuses to dump a server newer than itself.Fix: set backup.image to the tag matching your server — 18.1.0 for a PostgreSQL 18 image, 17.1.0 for 17 — and upgrade the release.Apply rejected with 'The ratio between cpu and minCpu must be less than 4:1'
Apply rejected with 'The ratio between cpu and minCpu must be less than 4:1'
resources.maxCpu is more than four times resources.minCpu, which the platform rejects on a stateful workload.Fix: raise resources.minCpu or lower resources.maxCpu so the ratio is at most 4:1.Important Notes
- Create the credentials secret before installing. A reference to a secret that does not exist wedges the workload with no log output; see Prerequisites for the one command that shows the reason.
- Credentials are read only when the volume is first initialized. Rotate with
ALTER ROLEinside PostgreSQL, then update the secret — see Rotating the Password. - Do not scale the server past one replica. It is a single instance on a single volume, not a replicated cluster.
cpln helm uninstalldeletes the volume set and the database with it; a final snapshot is kept for 7 days. Your credentials secret is yours and is left alone.- Every
cpln helm upgraderestarts the server. Treat each one as a short planned write outage. - Match
backup.imageto the server’s major version (18.1.0for PostgreSQL 18,17.1.0for 17), or the backup job fails on every run. - Upgrading from 1.3.2 or earlier is a breaking change — the removed keys stop the upgrade rather than resetting a password. See Upgrading From 1.3.2 or Earlier.
External References
PostGIS Documentation
PostGIS Docker Image
template_postgis setupPostgreSQL Backup and Restore
pg_dumpall dumps and restores