diff --git a/.github/workflows/rw-build-image.yaml b/.github/workflows/rw-build-image.yaml index 328742f0..af345ee4 100644 --- a/.github/workflows/rw-build-image.yaml +++ b/.github/workflows/rw-build-image.yaml @@ -121,6 +121,8 @@ jobs: npm run production --if-present --prefix ./wordpress/wp-content/themes/justicejobs npm install --prefix ./wordpress/wp-content/themes/hale-dash npm run production --if-present --prefix ./wordpress/wp-content/themes/hale-dash + npm install --prefix ./wordpress/wp-content/themes/ppo + npm run production --if-present --prefix ./wordpress/wp-content/themes/ppo - name: Build and Push Wordpress Image run: | docker build --pull --no-cache --tag $REGISTRY/$REPOSITORY:hale-platform_wordpress-$IMAGE_TAG --file wp.dockerfile . diff --git a/README.md b/README.md index 24c1d82c..8428db7f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Hale Platform -This repository provides all the code required to run an instance of WordPress multisite in kubernetes. It uses the [WordPress official Alpine image](https://hub.docker.com/_/wordpress), and is modified to launch a multisite network. It uses PHP dependency manager Composer to pull in all the themes and plugins used by the multisite. +This repository provides all the code required to run an instance of WordPress multisite in kubernetes. It uses the [WordPress official Alpine image](https://hub.docker.com/_/wordpress), and is modified to launch a multisite network. It uses PHP dependency manager Composer to pull in all the themes and plugins used by the multisite. For further technical details around the architecture, visit our wiki [overview](https://github.com/ministryofjustice/hale-platform/wiki). diff --git a/composer.json b/composer.json index 907dbb68..13fd95f4 100644 --- a/composer.json +++ b/composer.json @@ -47,20 +47,32 @@ "ministryofjustice/ppo": "dev-main", "ministryofjustice/hale-components": "dev-main", "ministryofjustice/hale-dash": "dev-main", - "wpackagist-plugin/wordpress-seo": "*", + "ministryofjustice/ppo": "dev-main", + "ministryofjustice/hale-components": "dev-main", + "wpackagist-plugin/advanced-custom-fields-table-field":"1.3.20", + "wpackagist-plugin/advanced-responsive-video-embedder": "*", + "wpackagist-plugin/analytify-analytics-dashboard-widget":"*", + "wpackagist-plugin/classic-editor":"1.6.3", + "wpackagist-plugin/cms-tree-page-view": "*", + "wpackagist-plugin/custom-search-plugin": "*", + "wpackagist-plugin/duplicate-post":"4.5", + "wpackagist-plugin/ewww-image-optimizer": "*", + "wpackagist-plugin/expandable-menus": "*", + "wpackagist-plugin/fitvids-for-wordpress": "*", "wpackagist-plugin/footnotes-made-easy": "*", - "wpackagist-plugin/simple-301-redirects": "*", + "wpackagist-plugin/option-tree": "*", "wpackagist-plugin/query-monitor": "*", - "wpackagist-plugin/ewww-image-optimizer": "*", + "wpackagist-plugin/redirection": "*", + "wpackagist-plugin/remove-category-url": "*", + "wpackagist-plugin/safe-svg":"*", + "wpackagist-plugin/simple-301-redirects": "*", + "wpackagist-plugin/tao-schedule-update": "*", "wpackagist-plugin/unconfirmed": "*", + "wpackagist-plugin/wordpress-seo": "*", + "wpackagist-plugin/wp-accessibility":"2.0.1", + "wpackagist-plugin/wp-analytify":"*", "wpackagist-plugin/wp-force-login": "*", - "wpackagist-plugin/safe-svg":"*", - "wpackagist-plugin/redirection": "*", "wpackagist-plugin/wps-hide-login": "*", - "wpackagist-plugin/classic-editor":"1.6.3", - "wpackagist-plugin/duplicate-post":"4.5", - "wpackagist-plugin/wp-accessibility":"2.0.1", - "wpackagist-plugin/advanced-custom-fields-table-field":"1.3.20", "ministryofjustice/wp-moj-components": "dev-hale-platform", "ministryofjustice/wp-user-roles": "*", "ministryofjustice/cookie-compliance-for-wordpress": "*", @@ -80,6 +92,7 @@ "type:wordpress-muplugin", "ministryofjustice/wp-user-roles", "ministryofjustice/wp-gov-uk-notify", + "ministryofjustice/hale-components", "ministryofjustice/wp-s3-uploads" ], "wordpress/wp-content/plugins/{$name}/": ["type:wordpress-plugin"], diff --git a/helm_deploy/wordpress/templates/deployment.yaml b/helm_deploy/wordpress/templates/deployment.yaml index c57417b2..efe14b7b 100644 --- a/helm_deploy/wordpress/templates/deployment.yaml +++ b/helm_deploy/wordpress/templates/deployment.yaml @@ -52,27 +52,34 @@ spec: - secretRef: name: hale-wp-secrets-{{ .Release.Revision }} {{- if or (eq .Values.configmap.envtype "prod") (eq .Values.configmap.envtype "staging") }} - livenessProbe: - httpGet: - port: 443 - path: /hale-wpms-2020 - scheme: HTTPS - host: {{ .Values.domain }} - initialDelaySeconds: 120 - periodSeconds: 30 - timeoutSeconds: 5 - failureThreshold: 3 + # livenessProbe: + # exec: + # command: + # - sh + # - -c + # - | + # if [ -f /var/www/html/wp-load.php ]; then + # exit 0 + # else + # exit 1 + # fi + # initialDelaySeconds: 120 + # periodSeconds: 10 + # timeoutSeconds: 5 + # failureThreshold: 6 + # successThreshold: 1 readinessProbe: exec: command: - - sh - - -c - - | - if ! ps aux | grep '[p]hp-fpm: master process' >/dev/null; then - exit 1 - else - exit 0 - fi + - /bin/sh + - -c + - | + if [ -f /var/www/html/wp-load.php ] && ps aux | grep -q "[p]hp-fpm" + then + exit 0 + else + exit 1 + fi initialDelaySeconds: 30 periodSeconds: 3 timeoutSeconds: 10 diff --git a/helm_deploy/wordpress/templates/hpa-wordpress.yaml b/helm_deploy/wordpress/templates/hpa-wordpress.yaml index 2f4457ee..ab85e36f 100644 --- a/helm_deploy/wordpress/templates/hpa-wordpress.yaml +++ b/helm_deploy/wordpress/templates/hpa-wordpress.yaml @@ -10,11 +10,11 @@ spec: kind: Deployment name: wordpress {{- if eq .Values.configmap.envtype "prod" }} - minReplicas: 3 - maxReplicas: 12 + minReplicas: 4 + maxReplicas: 5 {{- else if eq .Values.configmap.envtype "staging" }} minReplicas: 2 - maxReplicas: 4 + maxReplicas: 3 {{- else if eq .Values.configmap.envtype "demo" }} minReplicas: 2 maxReplicas: 3 diff --git a/helm_deploy/wordpress/templates/ingress.yaml b/helm_deploy/wordpress/templates/ingress.yaml index 2ed6fc7c..4b447ee0 100644 --- a/helm_deploy/wordpress/templates/ingress.yaml +++ b/helm_deploy/wordpress/templates/ingress.yaml @@ -65,6 +65,30 @@ spec: - hosts: - www.prisonandprobationjobs.gov.uk secretName: ppj-www-cert + - hosts: + - nationalpreventivemechanism.org.uk + secretName: nationalpreventivemechanism-cert + - hosts: + - www.nationalpreventivemechanism.org.uk + secretName: nationalpreventivemechanism-www-cert + - hosts: + - lawcom.gov.uk + secretName: lawcom-cert + - hosts: + - www.lawcom.gov.uk + secretName: lawcom-www-cert + - hosts: + - jobs.justice.gov.uk + secretName: justicejobs-cert + - hosts: + - www.jobs.justice.gov.uk + secretName: justicejobs-www-cert + - hosts: + - ppo.gov.uk + secretName: ppo-cert + - hosts: + - www.ppo.gov.uk + secretName: ppo-www-cert {{- end }} rules: - host: {{ .Values.domain }} @@ -218,5 +242,85 @@ spec: name: wordpress port: number: 8080 + - host: nationalpreventivemechanism.org.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: www.nationalpreventivemechanism.org.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: lawcom.gov.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: www.lawcom.gov.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: jobs.justice.gov.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: www.jobs.justice.gov.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: ppo.gov.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 + - host: www.ppo.gov.uk + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + service: + name: wordpress + port: + number: 8080 {{- end }} {{- end }} diff --git a/helm_deploy/wordpress/values.yaml b/helm_deploy/wordpress/values.yaml index 0d720558..d8d9d302 100644 --- a/helm_deploy/wordpress/values.yaml +++ b/helm_deploy/wordpress/values.yaml @@ -20,7 +20,7 @@ wp: # Default if HPA is not turned on replicaCount: prod: 3 - staging: 3 + staging: 2 dev: 1 demo: 2 diff --git a/opt/php/load.php b/opt/php/load.php index ae25bbe4..f300c6f1 100644 --- a/opt/php/load.php +++ b/opt/php/load.php @@ -4,6 +4,7 @@ require WPMU_PLUGIN_DIR .'/wp-gov-uk-notify/wp-gov-uk-notify.php'; require WPMU_PLUGIN_DIR .'/wp-moj-components/wp-moj-components.php'; +require WPMU_PLUGIN_DIR .'/hale-components/hale-components.php'; require WPMU_PLUGIN_DIR .'/wp-user-roles/wp-user-roles.php'; # Turn off s3 upload plugin in the local environment diff --git a/opt/php/www.conf b/opt/php/www.conf index 19024b37..91e2e3e5 100644 --- a/opt/php/www.conf +++ b/opt/php/www.conf @@ -20,8 +20,8 @@ ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. -; user = hale -; group = hale +user = hale +group = hale ; The address on which to accept FastCGI requests. ; Valid syntaxes are: @@ -111,7 +111,7 @@ pm = dynamic ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. -pm.max_children = 90 +pm.max_children = 80 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' @@ -121,7 +121,7 @@ pm.start_servers = 10 ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 5 +pm.min_spare_servers = 10 ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic'