Skip to content

Commit

Permalink
[stable/wordpress] Enable configuration of AllowOverride (helm#11155)
Browse files Browse the repository at this point in the history
* [stable/wordpress] Enable configuration of AllowOverride

Signed-off-by: Javier J. Salmeron Garcia <[email protected]>

* Add custom htaccess cm

Signed-off-by: Javier J. Salmeron Garcia <[email protected]>

* Add helper

Signed-off-by: Javier J. Salmeron Garcia <[email protected]>

* Update allowOverride values

Signed-off-by: Javier J. Salmeron Garcia <[email protected]>
Signed-off-by: Samir Musali <[email protected]>
  • Loading branch information
javsalgar authored and Samir Musali committed Feb 6, 2019
1 parent 2cacf4e commit f2aad38
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/wordpress/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wordpress
version: 5.1.3
version: 5.2.0
appVersion: 5.0.3
description: Web publishing platform for building blogs and websites.
icon: https://bitnami.com/assets/stacks/wordpress/img/wordpress-stack-220x234.png
Expand Down
22 changes: 22 additions & 0 deletions stable/wordpress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ The following table lists the configurable parameters of the WordPress chart and
| `wordpressBlogName` | Blog name | `User's Blog!` |
| `wordpressTablePrefix` | Table prefix | `wp_` |
| `allowEmptyPassword` | Allow DB blank passwords | `true` |
| `allowOverrideNone` | Set Apache AllowOverride directive to None | `no` |
| `customHTAccessCM` | Configmap with custom wordpress-htaccess.conf directives | `nil` |
| `smtpHost` | SMTP host | `nil` |
| `smtpPort` | SMTP port | `nil` |
| `smtpUser` | SMTP user | `nil` |
Expand Down Expand Up @@ -264,6 +266,26 @@ readinessProbeHeaders:
Any number of name/value pairs may be specified; they are all copied into the liveness or readiness probe definition.
## Disabling `.htaccess`
For performance and security reasons, it is a good practice to configure Apache with `AllowOverride None`. Instead of using `.htaccess` files, Apache will load the same dircetives at boot time. These directives are located in `/opt/bitnami/wordpress/wordpress-htaccess.conf`. The container image includes by default these directives all of the default `.htaccess` files in WordPress (together with the default plugins). To enable this feature, install the chart with the following value:
```
helm install stable/wordpress --set allowOverrideNone=yes
```
However, some plugins may include `.htaccess` directives that will not be loaded when `AllowOverride` is set to `None`. A way to make them work would be to create your own `wordpress-htaccess.conf` file with all the required dircectives to make the plugin work. After creating it, then create a ConfigMap with it.
```
kubectl create cm custom-htaccess --from-file=/path/to/wordpress-htaccess.conf
```
Then, install the chart:
```
helm install stable/wordpress --set allowOverrideNone=yes --set customHTAccessCM=custom-htaccess
```
## Upgrading
### To 3.0.0
Expand Down
7 changes: 7 additions & 0 deletions stable/wordpress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "wordpress.customHTAcessCM" -}}
{{- printf "%s" .Values.customHTAcessCM -}}
{{- end -}}

{{/*
Return the proper image name (for the metrics image)
*/}}
Expand Down
12 changes: 12 additions & 0 deletions stable/wordpress/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ spec:
value: {{ .Values.wordpressFirstName | quote }}
- name: WORDPRESS_LAST_NAME
value: {{ .Values.wordpressLastName | quote }}
- name: WORDPRESS_HTACCESS_OVERRIDE_NONE
value: {{ .Values.allowOverrideNone | quote }}
- name: WORDPRESS_BLOG_NAME
value: {{ .Values.wordpressBlogName | quote }}
- name: WORDPRESS_TABLE_PREFIX
Expand Down Expand Up @@ -171,6 +173,11 @@ spec:
- mountPath: /bitnami/php
name: wordpress-data
subPath: php
{{- if and .Values.allowOverrideNone .Values.customHTAccessCM}}
- mountPath: /opt/bitnami/wordpress
name: custom-htaccess
subPath: wordpress-htaccess.conf
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.metrics.enabled }}
Expand All @@ -197,6 +204,11 @@ spec:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
volumes:
{{- if and .Values.allowOverrideNone .Values.customHTAccessCM}}
- name: custom-htaccess
configMap:
name: {{ template "wordpress.customHTAccessCM" . }}
{{- end }}
- name: wordpress-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
Expand Down
6 changes: 6 additions & 0 deletions stable/wordpress/values-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ wordpressTablePrefix: wp_
## ref: https://github.com/bitnami/bitnami-docker-wordpress#environment-variables
allowEmptyPassword: "yes"

## Set Apache allowOverride to None
allowOverrideNone: yes

# ConfigMap with custom wordpress-htaccess.conf file (requires allowOverrideNone to true)
customHTAccessCM:

## SMTP mail delivery configuration
## ref: https://github.com/bitnami/bitnami-docker-wordpress/#smtp-configuration
##
Expand Down
6 changes: 6 additions & 0 deletions stable/wordpress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ wordpressTablePrefix: wp_
## ref: https://github.com/bitnami/bitnami-docker-wordpress#environment-variables
allowEmptyPassword: true

## Set Apache allowOverride to None
allowOverrideNone: no

# ConfigMap with custom wordpress-htaccess.conf file (requires allowOverrideNone to true)
customHTAccessCM:

## SMTP mail delivery configuration
## ref: https://github.com/bitnami/bitnami-docker-wordpress/#smtp-configuration
##
Expand Down

0 comments on commit f2aad38

Please sign in to comment.