Skip to content

Commit

Permalink
feat(helm): Add probes and nginx rules (#146)
Browse files Browse the repository at this point in the history
* feat(helm): Add probes and nginx rules

* feat(helm): Add probes and nginx rules
  • Loading branch information
sylus authored Jul 29, 2024
1 parent 0bd9ce5 commit 0ce63a2
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/drupal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: drupal
apiVersion: v2
type: application
version: 1.0.0-beta7
version: 1.0.0-beta8
appVersion: 5.2.3
description: Drupal 10 variant of the Web Experience Toolkit (WxT).
keywords:
Expand Down
29 changes: 28 additions & 1 deletion charts/drupal/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# drupal

![Version: 1.0.0-beta7](https://img.shields.io/badge/Version-1.0.0--beta7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.2.0](https://img.shields.io/badge/AppVersion-5.2.0-informational?style=flat-square)
![Version: 1.0.0-beta8](https://img.shields.io/badge/Version-1.0.0--beta8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.2.3](https://img.shields.io/badge/AppVersion-5.2.3-informational?style=flat-square)

Drupal 10 variant of the Web Experience Toolkit (WxT).

Expand Down Expand Up @@ -98,6 +98,18 @@ helm install --name drupal -f values-<override>.yaml
| drupal.extensions.enabled | bool | `true` | |
| drupal.extraSettings | string | `""` | |
| drupal.healthcheck.enabled | bool | `true` | |
| drupal.healthcheck.probes.livenessProbe.exec.command[0] | string | `"php-fpm-healthcheck"` | |
| drupal.healthcheck.probes.livenessProbe.failureThreshold | int | `3` | |
| drupal.healthcheck.probes.livenessProbe.initialDelaySeconds | int | `1` | |
| drupal.healthcheck.probes.livenessProbe.periodSeconds | int | `5` | |
| drupal.healthcheck.probes.livenessProbe.successThreshold | int | `1` | |
| drupal.healthcheck.probes.livenessProbe.timeoutSeconds | int | `1` | |
| drupal.healthcheck.probes.readinessProbe.exec.command[0] | string | `"php-fpm-healthcheck"` | |
| drupal.healthcheck.probes.readinessProbe.failureThreshold | int | `3` | |
| drupal.healthcheck.probes.readinessProbe.initialDelaySeconds | int | `1` | |
| drupal.healthcheck.probes.readinessProbe.periodSeconds | int | `5` | |
| drupal.healthcheck.probes.readinessProbe.successThreshold | int | `1` | |
| drupal.healthcheck.probes.readinessProbe.timeoutSeconds | int | `1` | |
| drupal.image | string | `"drupalwxt/site-wxt"` | |
| drupal.imagePullPolicy | string | `"IfNotPresent"` | |
| drupal.install | bool | `true` | |
Expand Down Expand Up @@ -163,6 +175,21 @@ helm install --name drupal -f values-<override>.yaml
| nginx.client_max_body_size | string | `"20m"` | |
| nginx.customLocations | string | `""` | |
| nginx.gzip | bool | `true` | |
| nginx.healthcheck.enabled | bool | `true` | |
| nginx.healthcheck.livenessProbe.failureThreshold | int | `3` | |
| nginx.healthcheck.livenessProbe.httpGet.path | string | `"/_healthz"` | |
| nginx.healthcheck.livenessProbe.httpGet.port | int | `8080` | |
| nginx.healthcheck.livenessProbe.initialDelaySeconds | int | `1` | |
| nginx.healthcheck.livenessProbe.periodSeconds | int | `5` | |
| nginx.healthcheck.livenessProbe.successThreshold | int | `1` | |
| nginx.healthcheck.livenessProbe.timeoutSeconds | int | `1` | |
| nginx.healthcheck.readinessProbe.failureThreshold | int | `3` | |
| nginx.healthcheck.readinessProbe.httpGet.path | string | `"/_healthz"` | |
| nginx.healthcheck.readinessProbe.httpGet.port | int | `8080` | |
| nginx.healthcheck.readinessProbe.initialDelaySeconds | int | `1` | |
| nginx.healthcheck.readinessProbe.periodSeconds | int | `5` | |
| nginx.healthcheck.readinessProbe.successThreshold | int | `1` | |
| nginx.healthcheck.readinessProbe.timeoutSeconds | int | `1` | |
| nginx.image | string | `"drupalwxt/site-wxt"` | |
| nginx.imagePullPolicy | string | `"IfNotPresent"` | |
| nginx.nodeSelector | object | `{}` | |
Expand Down
17 changes: 10 additions & 7 deletions charts/drupal/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,14 @@ http {
#IPv6
listen [::]:8080;

# Filesystem root of the site and index with fallback.
# Filesystem root of the site and index with fallback
{{- if not (eq .Values.drupal.siteRoot "/") }}
root /webroot;
{{- else }}
root /var/www/html;
{{- end }}
index index.php index.html index.htm;

# Make site accessible from http://drupal.dev;
server_name _;

set_real_ip_from 0.0.0.0/0;
real_ip_header {{ .Values.nginx.real_ip_header }};

Expand All @@ -71,18 +68,21 @@ http {
return 200 "OK";
}

# Root location
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# as directory, then fall back to displaying a 404
{{- if not (eq .Values.drupal.siteRoot "/") }}
try_files $uri $uri/ /index.html {{ .Values.drupal.siteRoot }}/index.php?$query_string;
{{- else }}
try_files $uri $uri/ /index.html /index.php?$query_string;
{{- end }}
{{- if .Values.nginx.rootLocationRules }}
{{ tpl .Values.nginx.rootLocationRules . | nindent 10 }}
{{- end }}
}

{{ .Values.nginx.customLocations }}

# Handles PHP requests
location ~ \.php$ {
proxy_intercept_errors on;
include fastcgi_params;
Expand All @@ -96,8 +96,11 @@ http {
try_files $uri =404;
}

# Block restricted files and directories
location ~ /\.ht {
deny all;
}

{{ .Values.nginx.customLocations }}
}
}
6 changes: 5 additions & 1 deletion charts/drupal/templates/deploy/drupal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ spec:
name: tcp-php-fpm
protocol: TCP
{{- if .Values.drupal.healthcheck.enabled }}
{{- if .Values.drupal.healthcheck.probes }}
{{- toYaml .Values.drupal.healthcheck.probes | nindent 8 }}
{{- else }}
livenessProbe:
exec:
command:
- php-fpm-healthcheck
initialDelaySeconds: 0
initialDelaySeconds: 1
periodSeconds: 5
readinessProbe:
exec:
Expand All @@ -69,6 +72,7 @@ spec:
initialDelaySeconds: 1
periodSeconds: 5
{{- end }}
{{- end }}
env:
{{- include "drupal.env" . | nindent 10 }}
{{- if .Values.extraEnvVars }}
Expand Down
44 changes: 44 additions & 0 deletions charts/drupal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,25 @@ drupal:
# Requires https://github.com/renatomefi/php-fpm-healthcheck in the container.
healthcheck:
enabled: true
probes:
livenessProbe:
exec:
command:
- php-fpm-healthcheck
initialDelaySeconds: 1
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
exec:
command:
- php-fpm-healthcheck
initialDelaySeconds: 1
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3

# Enable all of the WxT extension modules
extensions:
Expand Down Expand Up @@ -417,6 +436,31 @@ nginx:

serviceType: ClusterIP

healthcheck:
enabled: true
livenessProbe:
httpGet:
path: /_healthz
port: 8080
initialDelaySeconds: 1
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /_healthz
port: 8080
initialDelaySeconds: 1
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3

# rootLocationRules: |
# deny 5.181.182.0/24;
# allow all;

customLocations: ""

volumes:
Expand Down
2 changes: 1 addition & 1 deletion charts/solr/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.9
version: 0.1.10

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion charts/solr/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# solr

![Version: 0.1.9](https://img.shields.io/badge/Version-0.1.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.11.3](https://img.shields.io/badge/AppVersion-8.11.3-informational?style=flat-square)
![Version: 0.1.10](https://img.shields.io/badge/Version-0.1.10-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.11.3](https://img.shields.io/badge/AppVersion-8.11.3-informational?style=flat-square)

A Helm chart for a Solr instance using the official Solr Operator.

Expand Down
7 changes: 4 additions & 3 deletions charts/solr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ solr:
# timeoutSeconds: 5
# resources:
# limits:
# memory: 5Gi
# memory: "5Gi"
# requests:
# cpu: 250m
# memory: 256Mi
# cpu: "250m"
# memory: "256Mi"

storage:
size: 5Gi

Expand Down

0 comments on commit 0ce63a2

Please sign in to comment.