|
1 | | -= How to install a PostgreSQL via Helm |
| 1 | += How to install PostgreSQL on {product} |
2 | 2 |
|
3 | | -[INFO] |
4 | | -==== |
5 | | -PostgreSQL is https://docs.appcat.ch/vshn-managed/postgresql/create.html[available] on cloudscale.ch through VSHN AppCat. |
6 | | -Batteries and backups included. |
7 | | -==== |
| 3 | +== Managed PostgreSQL by VSHN |
8 | 4 |
|
9 | | -This page explains how to install a current PostgreSQL database via the Helm tool on the {product} platform. |
10 | | - |
11 | | -This guide is based on the older guide documented here: https://docs.appuio.ch/en/latest/app/helmcharts.html |
12 | | - |
13 | | -== Step 1: Install helm |
14 | | - |
15 | | -You need first to install the `helm` CLI tool: https://helm.sh/docs/intro/quickstart/ |
16 | | - |
17 | | -Make sure you add the Bitnami Helm Chart Repository, because we will use later the PostgreSQL Helm chart provided by Bitnami: |
18 | | - |
19 | | -[source,shell] |
20 | | ----- |
21 | | -helm repo add bitnami https://charts.bitnami.com/bitnami |
22 | | ----- |
23 | | - |
24 | | -== Step 2: Create an adapted YAML file |
25 | | - |
26 | | -We use the Bitnami provided PostgreSQL helm chart documented here: https://github.com/bitnami/charts/tree/master/bitnami/postgresql |
27 | | - |
28 | | -To ensure that PostgreSQL works on {product} we need to adjust some chart parameters, for example the `securityContext` parameter and the resource limits. |
29 | | - |
30 | | -If users don't explicitly configure limits, the {product} platform injects limits of `cpu: 200m` and `memory: 200Mi`. |
31 | | -See the reference docs of {product} for more details on xref:references/default-quota.adoc#_resource_limits_and_defaults[default resource limits]. |
32 | | - |
33 | | -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. |
34 | | - |
35 | | -Create a custom `postgresql-values.yaml` (filename doesn't matter) file to override the needed chart parameters. |
36 | | - |
37 | | -Below is a full working example for deploying the Bitnami PostgreSQL chart on {product}. |
38 | | - |
39 | | -.postgresql-values.yaml |
40 | | -[source,yaml] |
41 | | ----- |
42 | | -global: |
43 | | - postgresql: |
44 | | - postgresqlUsername: YOUR_USERNAME <1> |
45 | | -
|
46 | | -image: |
47 | | - tag: SOME_IMAGE_TAG <2> |
48 | | -
|
49 | | -resources: |
50 | | - limits: |
51 | | - cpu: 250m |
52 | | - memory: 256Mi |
53 | | -
|
54 | | -persistence: |
55 | | - size: 1Gi |
56 | | -
|
57 | | -volumePermissions: |
58 | | - enabled: false |
59 | | - securityContext: |
60 | | - runAsUser: "auto" |
61 | | -
|
62 | | -securityContext: |
63 | | - enabled: false |
64 | | -
|
65 | | -shmVolume: |
66 | | - chmod: |
67 | | - enabled: false |
68 | | -
|
69 | | -containerSecurityContext: |
70 | | - enabled: false |
71 | | ----- |
72 | | -<1> Set your database user name |
73 | | -<2> Set a valid PostgreSQL image tag |
74 | | - |
75 | | -By default the `storageClass` is empty and the {product} platform uses `ssd` as the default storage class. |
76 | | - |
77 | | -See the xref:explanation/storage-classes.adoc[documentation of available storage classes] on {product} for more details. |
78 | | - |
79 | | - |
80 | | -== Step 3: Install the Helm chart with the custom YAML file |
81 | | - |
82 | | -Install the PostgreSQL Helm chart with the following command: |
83 | | - |
84 | | -[source,shell] |
85 | | ----- |
86 | | -helm install -f postgresql-values.yaml --set global.postgresql.postgresqlPassword=<DB_PW> <MY_HELM_INSTANCE_NAME> --version 10 bitnami/postgresql |
87 | | ----- |
88 | | - |
89 | | -Replace the `<DB_PW>` with your database user password. |
90 | | - |
91 | | -Replace `<MY_HELM_INSTANCE_NAME>` with a descriptive name for your Helm installation, for example `service-xy-db`. |
92 | | - |
93 | | -The `-f postgresql-values.yaml` points to your custom YAML file, overriding the required Chart parameters. |
94 | | - |
95 | | - |
96 | | -== Step 4: Check your installation |
97 | | - |
98 | | -You can check your installation with the following command: |
99 | | - |
100 | | -[source,shell] |
101 | | ----- |
102 | | -helm list |
103 | | ----- |
104 | | - |
105 | | - |
106 | | -== Related Links |
107 | | - |
108 | | -Check also for more details here: |
109 | | - |
110 | | -* https://github.com/appuio/appuio-cloud-community/discussions/27 |
111 | | -* https://dev.to/tylerauerbeck/deploying-bitnami-s-postgres-helm-chart-on-openshift-1mcl |
112 | | -* https://github.com/bitnami/charts/issues/1336 |
113 | | -* https://github.com/bitnami/bitnami-docker-postgresql/issues/103 |
| 5 | +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^]. |
0 commit comments