Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 3 additions & 111 deletions docs/modules/ROOT/pages/how-to/install-postgres-db-helm.adoc
Original file line number Diff line number Diff line change
@@ -1,113 +1,5 @@
= How to install a PostgreSQL via Helm
= How to install PostgreSQL on {product}

[INFO]
====
PostgreSQL is https://docs.appcat.ch/vshn-managed/postgresql/create.html[available] on cloudscale.ch through VSHN AppCat.
Batteries and backups included.
====
== Managed PostgreSQL by VSHN

This page explains how to install a current PostgreSQL database via the Helm tool on the {product} platform.

This guide is based on the older guide documented here: https://docs.appuio.ch/en/latest/app/helmcharts.html

== Step 1: Install helm

You need first to install the `helm` CLI tool: https://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:

[source,shell]
----
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: https://github.com/bitnami/charts/tree/master/bitnami/postgresql

To ensure that PostgreSQL works on {product} we need to adjust some chart parameters, for example the `securityContext` parameter and the resource limits.

If users don't explicitly configure limits, the {product} platform injects limits of `cpu: 200m` and `memory: 200Mi`.
See the reference docs of {product} for more details on xref:references/default-quota.adoc#_resource_limits_and_defaults[default resource limits].

See also the https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml[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 {product}.

.postgresql-values.yaml
[source,yaml]
----
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 {product} platform uses `ssd` as the default storage class.

See the xref:explanation/storage-classes.adoc[documentation of available storage classes] on {product} for more details.


== Step 3: Install the Helm chart with the custom YAML file

Install the PostgreSQL Helm chart with the following command:

[source,shell]
----
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.


== Step 4: Check your installation

You can check your installation with the following command:

[source,shell]
----
helm list
----


== Related Links

Check also for more details here:

* https://github.com/appuio/appuio-cloud-community/discussions/27
* https://dev.to/tylerauerbeck/deploying-bitnami-s-postgres-helm-chart-on-openshift-1mcl
* https://github.com/bitnami/charts/issues/1336
* https://github.com/bitnami/bitnami-docker-postgresql/issues/103
Do you want a managed PostgreSQL that includes Backups, Monitoring, Updates, and optionally 24x7 Support? Check out the https://products.vshn.ch/appcat/postgresql.html[PostgreSQL by VSHN product description^] and https://docs.appcat.ch/vshn-managed/postgresql/create.html[technical documentation including how to instantiate^].