Skip to content

Commit 026e299

Browse files
tompizmorSameer Naik
authored andcommitted
[stable/ghost] allow use of external database (helm#2816)
* Allow Ghost helm chart to use an existing database * Fix wrong docker image * Fix wrong database name and username * Refactor properties to configure external database * update requirements.lock * add guide in README for external dbs
1 parent 91e4fcb commit 026e299

File tree

6 files changed

+107
-24
lines changed

6 files changed

+107
-24
lines changed

stable/ghost/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: ghost
2-
version: 2.0.4
2+
version: 2.1.0
33
appVersion: 1.17.3
44
description: A simple, powerful publishing platform that allows you to share your
55
stories with the world

stable/ghost/README.md

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,33 @@ The command removes all the Kubernetes components associated with the chart and
4545

4646
The following tables lists the configurable parameters of the Ghost chart and their default values.
4747

48-
| Parameter | Description | Default |
49-
| --------------------------------- | ----------------------------------------------------- | --------------------------------------------------------- |
50-
| `image` | Ghost image | `bitnami/ghost:{VERSION}` |
51-
| `imagePullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` |
52-
| `ghostHost` | Ghost host to create application URLs | `nil` |
53-
| `ghostPort` | Ghost port to create application URLs along with host | `80` |
54-
| `ghostLoadBalancerIP` | `loadBalancerIP` for the Ghost Service | `nil` |
55-
| `ghostUsername` | User of the application | `user@example.com` |
56-
| `ghostPassword` | Application password | Randomly generated |
57-
| `ghostEmail` | Admin email | `user@example.com` |
58-
| `ghostBlogTitle` | Ghost Blog name | `User's Blog` |
59-
| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` |
60-
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
61-
| `persistence.enabled` | Enable persistence using PVC | `true` |
62-
| `persistence.storageClass` | PVC Storage Class for Ghost volume | `nil` (uses alpha storage annotation) |
63-
| `persistence.accessMode` | PVC Access Mode for Ghost volume | `ReadWriteOnce` |
64-
| `persistence.size` | PVC Storage Request for Ghost volume | `8Gi` |
65-
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
48+
| Parameter | Description | Default |
49+
|-------------------------------|---------------------------------------------------------------|----------------------------------------------------------|
50+
| `image` | Ghost image | `bitnami/ghost:{VERSION}` |
51+
| `imagePullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` |
52+
| `ghostHost` | Ghost host to create application URLs | `nil` |
53+
| `ghostPort` | Ghost port to create application URLs along with host | `80` |
54+
| `ghostLoadBalancerIP` | `loadBalancerIP` for the Ghost Service | `nil` |
55+
| `ghostUsername` | User of the application | `user@example.com` |
56+
| `ghostPassword` | Application password | Randomly generated |
57+
| `ghostEmail` | Admin email | `user@example.com` |
58+
| `ghostBlogTitle` | Ghost Blog name | `User's Blog` |
59+
| `allowEmptyPassword` | Allow DB blank passwords | `yes` |
60+
| `externalDatabase.host` | Host of the external database | `nil` |
61+
| `externalDatabase.user` | Existing username in the external db | `bn_ghost` |
62+
| `externalDatabase.password` | Password for the above username | `nil` |
63+
| `externalDatabase.database` | Name of the existing database | `bitnami_ghost` |
64+
| `mariadb.enabled` | Whether or not to install MariaDB (disable if using external) | `true` |
65+
| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` |
66+
| `mariadb.mariadbDatabase` | MariaDB Database name to create | `bitnami_ghost` |
67+
| `mariadb.mariadbUser` | MariaDB Database user to create | `bn_ghost` |
68+
| `mariadb.mariadbPassword` | MariaDB Password for user | _random 10 character long alphanumeric string_ |
69+
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
70+
| `persistence.enabled` | Enable persistence using PVC | `true` |
71+
| `persistence.storageClass` | PVC Storage Class for Ghost volume | `nil` (uses alpha storage annotation) |
72+
| `persistence.accessMode` | PVC Access Mode for Ghost volume | `ReadWriteOnce` |
73+
| `persistence.size` | PVC Storage Request for Ghost volume | `8Gi` |
74+
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
6675

6776
The above parameters map to the env variables defined in [bitnami/ghost](https://github.com/bitnami/bitnami-docker-ghost). For more information please refer to the [bitnami/ghost](https://github.com/bitnami/bitnami-docker-ghost) image documentation.
6877

@@ -98,6 +107,15 @@ $ helm install --name my-release -f values.yaml stable/ghost
98107
99108
> **Tip**: You can use the default [values.yaml](values.yaml)
100109
110+
## Using an existing database
111+
112+
Sometimes you may want to have Ghost connect to an external database rather than installing one inside your cluster, e.g. to use a managed database service, or use run a single database server for all your applications. To do this, the chart allows you to specify credentials for an external database under the [`externalDatabase` parameter](#configuration). You should also disable the MariaDB installation with the `mariadb.enabled` option. For example:
113+
114+
```console
115+
$ helm install stable/ghost \
116+
--set mariadb.enabled=false,externalDatabase.host=myexternalhost,externalDatabase.user=myuser,externalDatabase.password=mypassword,externalDatabase.database=mydatabase
117+
```
118+
101119
## Persistence
102120
103121
The [Bitnami Ghost](https://github.com/bitnami/bitnami-docker-ghost) image stores the Ghost data and configurations at the `/bitnami/ghost` and `/bitnami/apache` paths of the container.

stable/ghost/requirements.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ dependencies:
22
- name: mariadb
33
repository: https://kubernetes-charts.storage.googleapis.com/
44
version: 0.7.0
5-
digest: sha256:e1af13ac4ac21f67582006f12d2b4eb78a1a2a59b34338fac850f2bec0b08b41
6-
generated: 2017-08-09T22:52:49.011896557-04:00
5+
digest: sha256:f59f68030aa5c50b9e776b813804875fac911f91c2aa384e991f37a795c5ae34
6+
generated: 2017-11-27T16:40:56.867665764Z

stable/ghost/requirements.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dependencies:
22
- name: mariadb
33
version: 0.7.0
44
repository: https://kubernetes-charts.storage.googleapis.com/
5+
condition: mariadb.enabled

stable/ghost/templates/deployment.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,41 @@ spec:
2828
image: "{{ .Values.image }}"
2929
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
3030
env:
31+
- name: ALLOW_EMPTY_PASSWORD
32+
{{- if .Values.allowEmptyPassword }}
33+
value: "yes"
34+
{{- else }}
35+
value: "no"
36+
{{- end }}
3137
- name: MARIADB_HOST
38+
{{- if .Values.mariadb.enabled }}
3239
value: {{ template "ghost.mariadb.fullname" . }}
40+
{{- else }}
41+
value: {{ default "" .Values.externalDatabase.host | quote }}
42+
{{- end }}
3343
- name: MARIADB_PORT_NUMBER
3444
value: "3306"
35-
- name: MARIADB_PASSWORD
45+
- name: GHOST_DATABASE_NAME
46+
{{- if .Values.mariadb.enabled }}
47+
value: {{ default "" .Values.mariadb.mariadbDatabase | quote }}
48+
{{- else }}
49+
value: {{ default "" .Values.externalDatabase.database | quote }}
50+
{{- end }}
51+
- name: GHOST_DATABASE_USER
52+
{{- if .Values.mariadb.enabled }}
53+
value: {{ default "" .Values.mariadb.mariadbUser | quote }}
54+
{{- else }}
55+
value: {{ default "" .Values.externalDatabase.user | quote }}
56+
{{- end }}
57+
- name: GHOST_DATABASE_PASSWORD
58+
{{- if .Values.mariadb.enabled }}
3659
valueFrom:
3760
secretKeyRef:
3861
name: {{ template "ghost.mariadb.fullname" . }}
39-
key: mariadb-root-password
62+
key: mariadb-password
63+
{{- else }}
64+
value: {{ default "" .Values.externalDatabase.password | quote }}
65+
{{- end }}
4066
- name: GHOST_HOST
4167
value: {{ include "ghost.host" . | quote }}
4268
- name: GHOST_PORT_NUMBER

stable/ghost/values.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Bitnami Ghost image version
22
## ref: https://hub.docker.com/r/bitnami/ghost/tags/
33
##
4-
image: bitnami/ghost:1.17.3-r0
4+
image: bitnami/ghost:1.17.3-r1
55

66
## Busybox image used to configure volume permissions
77
##
@@ -53,6 +53,10 @@ ghostEmail: user@example.com
5353
##
5454
ghostBlogTitle: User's Blog
5555

56+
## Set to `yes` to allow the container to be started with blank passwords
57+
## ref: https://github.com/bitnami/bitnami-docker-wordpress#environment-variables
58+
allowEmptyPassword: yes
59+
5660
## SMTP mail delivery configuration
5761
## ref: https://github.com/bitnami/bitnami-docker-redmine/#smtp-configuration
5862
##
@@ -62,14 +66,48 @@ ghostBlogTitle: User's Blog
6266
# smtpPassword:
6367
# smtpService:
6468

69+
##
70+
## External database configuration
71+
##
72+
externalDatabase:
73+
## Database host
74+
# host:
75+
76+
## Database user
77+
# user: bn_ghost
78+
79+
## Database password
80+
# password:
81+
82+
## Database name
83+
# database: bitnami_ghost
84+
6585
##
6686
## MariaDB chart configuration
6787
##
6888
mariadb:
89+
## Whether to use the database specified as a requirement or not. For example, to configure the chart with an existing database server.
90+
enabled: true
91+
6992
## MariaDB admin password
7093
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run
7194
##
7295
# mariadbRootPassword:
96+
## Create a database
97+
98+
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-on-first-run
99+
##
100+
mariadbDatabase: bitnami_ghost
101+
102+
## Create a database user
103+
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
104+
##
105+
mariadbUser: bn_ghost
106+
107+
## Password for mariadbUser
108+
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
109+
##
110+
# mariadbPassword:
73111

74112
## Enable persistence using Persistent Volume Claims
75113
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/

0 commit comments

Comments
 (0)