How to install a PostgreSQL via Helm
PostgreSQL is available on cloudscale.ch through VSHN AppCat. Batteries and backups included.
This page explains how to install a current PostgreSQL database via the Helm tool on the APPUiO Cloud platform.
This guide is based on the older guide documented here: docs.appuio.ch/en/latest/app/helmcharts.html
Step 1: Install helm
You need first to install the helm
CLI tool: helm.sh/docs/intro/quickstart/
Make sure you add the Bitnami Helm Chart Repository, because we will use later the PostgreSQL Helm chart provided by Bitnami:
helm repo add bitnami https://charts.bitnami.com/bitnami
Step 2: Create an adapted YAML file
We use the Bitnami provided PostgreSQL helm chart documented here: github.com/bitnami/charts/tree/master/bitnami/postgresql
To ensure that PostgreSQL works on APPUiO Cloud we need to adjust some chart parameters, for example the securityContext
parameter and the resource limits.
If users don’t explicitly configure limits, the APPUiO Cloud platform injects limits of cpu: 200m
and memory: 200Mi
.
See the reference docs of APPUiO Cloud for more details on default resource limits.
See also the YAML file of the PostgreSQL Helm chart for more details on configurable values.
Create a custom postgresql-values.yaml
(filename doesn’t matter) file to override the needed chart parameters.
Below is a full working example for deploying the Bitnami PostgreSQL chart on APPUiO Cloud.
global:
postgresql:
postgresqlUsername: YOUR_USERNAME (1)
image:
tag: SOME_IMAGE_TAG (2)
resources:
limits:
cpu: 250m
memory: 256Mi
persistence:
size: 1Gi
volumePermissions:
enabled: false
securityContext:
runAsUser: "auto"
securityContext:
enabled: false
shmVolume:
chmod:
enabled: false
containerSecurityContext:
enabled: false
1 | Set your database user name |
2 | Set a valid PostgreSQL image tag |
By default the storageClass
is empty and the APPUiO Cloud platform uses ssd
as the default storage class.
See the documentation of available storage classes on APPUiO Cloud for more details.
Step 3: Install the Helm chart with the custom YAML file
Install the PostgreSQL Helm chart with the following command:
helm install -f postgresql-values.yaml --set global.postgresql.postgresqlPassword=<DB_PW> <MY_HELM_INSTANCE_NAME> --version 10 bitnami/postgresql
Replace the <DB_PW>
with your database user password.
Replace <MY_HELM_INSTANCE_NAME>
with a descriptive name for your Helm installation, for example service-xy-db
.
The -f postgresql-values.yaml
points to your custom YAML file, overriding the required Chart parameters.