Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0745c02
SLT-1103: Add mailpit dependency to Drupal chart
k4lv15 Mar 27, 2025
394f9ac
SLT-1103: Update values.schema.json to fix validation issues
k4lv15 Mar 27, 2025
a973916
SLT-1103: Enable mailpit for the feature branch.
k4lv15 Mar 27, 2025
43eb005
SLT-1103: Set default resource requests and limits for mailpit.
k4lv15 Mar 27, 2025
b602cc5
SLT-1103: Enable mailhog for comparison.
k4lv15 Mar 27, 2025
56d33a1
SLT-1103: Check if release name doesn't contain 'mailpit' when defini…
k4lv15 Mar 27, 2025
c1439fa
SLT-1103: Add mailpit links to release notes.
k4lv15 Mar 27, 2025
bfdf0d8
SLT-1103: Disable mailhog so that it doesn't overlap with mailpit.
k4lv15 Mar 27, 2025
d7da3d1
SLT-1103: Update smtp.env template in helpers - set SMTP_ADDRESS to <…
k4lv15 Mar 27, 2025
7c61e45
SLT-1103: Fix failing tests.
k4lv15 Mar 27, 2025
8d824d7
SLT-1103: Fix the check that generates smtp-secret, otherwise secret …
k4lv15 Mar 27, 2025
a58b455
SLT-1103: Update checks.yaml
k4lv15 Mar 27, 2025
70cd445
SLT-1103: Update nginx config in drupal-configmap - proxy /mailpit pa…
k4lv15 Mar 27, 2025
19e1f95
SLT-1103: Pass /mailpit path in varnish.
k4lv15 Mar 27, 2025
7af192f
SLT-1103: Set extra env vars for mailpit as Drupal's e-mails are not …
k4lv15 Mar 28, 2025
1b1b653
SLT-1103: Override the default webroot for mailpit, update Drupal's n…
k4lv15 Mar 28, 2025
cb5c647
SLT-1103: Adjust nginx config to have proxy_pass working properly, ad…
k4lv15 Mar 29, 2025
b2c94c4
SLT-1103: Lock mailpit dependency to 0.23.x
k4lv15 Apr 1, 2025
789a530
SLT-1103: Add back support for mailhog, add additional check that ver…
k4lv15 Apr 1, 2025
265f89b
SLT-1103: Redirect the legacy mailhog service path to /mailpit
k4lv15 Apr 1, 2025
dc0f496
SLT-1103: Remove mailhog from silta.yml
k4lv15 Apr 1, 2025
ec35b36
SLT-1103: Update mailpit dependency to 0.24.x, disable service links.
k4lv15 Apr 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ workflows:
name: Add helm repositories and build local chart
command: |
helm repo add elastic https://helm.elastic.co
helm repo add jouve https://jouve.github.io/charts/
helm repo add codecentric https://codecentric.github.io/helm-charts
helm repo add percona https://percona.github.io/percona-helm-charts/
helm dependency build ./charts/drupal
Expand Down
7 changes: 5 additions & 2 deletions charts/drupal/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ dependencies:
- name: mailhog
repository: https://storage.googleapis.com/charts.wdr.io
version: 5.1.0
- name: mailpit
repository: https://jouve.github.io/charts/
version: 0.24.0
- name: elasticsearch
repository: file://../elasticsearch
version: 8.5.1
- name: silta-release
repository: file://../silta-release
version: 1.0.1
digest: sha256:9941fba8da73d8d7c9024c8c53dda085f0fba6ae50ef63d884dfe994d08a7641
generated: "2025-03-18T10:31:05.247476421+02:00"
digest: sha256:e3ea21b74deadb01861e37b2296391e1f0a25f62dc6b3da226d28cb95245342d
generated: "2025-04-08T22:42:49.491746+03:00"
4 changes: 4 additions & 0 deletions charts/drupal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ dependencies:
version: 5.1.x
repository: https://storage.googleapis.com/charts.wdr.io
condition: mailhog.enabled
- name: mailpit
version: 0.24.x
repository: https://jouve.github.io/charts/
condition: mailpit.enabled
- name: elasticsearch
version: 8.5.x
# repository: https://helm.elastic.co
Expand Down
10 changes: 10 additions & 0 deletions charts/drupal/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Mailhog available at:
{{- end }}
{{- end }}

{{- if .Values.mailpit.enabled }}

Mailpit available at:

http://{{- template "drupal.domain" . }}/mailpit
{{- range $index, $domain := .Values.exposeDomains }}
http://{{ $domain.hostname }}/mailpit
{{- end }}
{{- end }}

{{- if .Values.nginx.basicauth.enabled }}

Basic access authentication credentials:
Expand Down
17 changes: 13 additions & 4 deletions charts/drupal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ imagePullSecrets:

{{- define "smtp.env" }}
- name: SMTP_ADDRESS
{{- if .Values.mailhog.enabled }}
{{- if .Values.mailpit.enabled }}
value: "{{ .Release.Name }}-mailpit-smtp:25"
{{ else if .Values.mailhog.enabled }}
value: "{{ .Release.Name }}-mailhog:1025"
{{ else }}
value: {{ .Values.smtp.address | quote }}
Expand All @@ -114,7 +116,9 @@ imagePullSecrets:
key: password
# Duplicate SMTP env variables for ssmtp bundled with amazee php image
- name: SSMTP_MAILHUB
{{- if .Values.mailhog.enabled }}
{{- if .Values.mailpit.enabled }}
value: "{{ .Release.Name }}-mailpit-smtp:25"
{{ else if .Values.mailhog.enabled }}
value: "{{ .Release.Name }}-mailhog:1025"
{{ else }}
value: {{ .Values.smtp.address | quote }}
Expand Down Expand Up @@ -233,12 +237,17 @@ imagePullSecrets:
- name: ELASTICSEARCH_HOST
value: {{ .Release.Name }}-es
{{- end }}
{{- if or .Values.mailhog.enabled .Values.smtp.enabled }}
{{- if or .Values.mailhog.enabled .Values.mailpit.enabled .Values.smtp.enabled }}
{{- if .Values.mailhog.enabled }}
{{- if contains "mailhog" .Release.Name -}}
{{- fail "Do not use 'mailhog' in release name or deployment will fail" -}}
{{- end }}
{{- end }}
{{- if .Values.mailpit.enabled }}
{{- if contains "mailpit" .Release.Name -}}
{{- fail "Do not use 'mailpit' in release name or deployment will fail" -}}
{{- end }}
{{- end }}
{{ include "smtp.env" . }}
{{- end}}
{{- if .Values.varnish.enabled }}
Expand Down Expand Up @@ -743,4 +752,4 @@ autoscaling/v2beta1
{{- else }}
{{- .Release.Name }}-sa
{{- end }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/drupal/templates/checks.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{{- if and .Values.mailhog.enabled .Values.mailpit.enabled }}
{{- fail "Mailhog and mailpit can't be enabled at the same time as those are overlapping services. Use mailpit only as mailhog is deprecated." -}}
{{- end }}
{{- if index (index .Values "silta-release") "branchName" }}
{{- if eq (index (index .Values "silta-release") "branchName") "production" }}
{{- if .Values.mailhog.enabled }}
{{- fail "Mailhog should not be enabled in production" -}}
{{- end }}
{{- if .Values.mailpit.enabled }}
{{- fail "Mailpit should not be enabled in production" -}}
{{- end }}
{{- if eq .Values.nginx.resources.requests.cpu "1m" }}
{{- fail "Raise nginx.resources.requests.cpu for production environment" -}}
{{- end }}
Expand Down
39 changes: 39 additions & 0 deletions charts/drupal/templates/drupal-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,45 @@ data:
}
{{- end}}

{{- if .Values.mailpit.enabled }}
# Redirect the legacy mailhog service to mailpit.
location /mailhog {
return 301 /mailpit/;
}

location /mailpit/ {

# Auth / whitelist always enabled
satisfy any;
allow 127.0.0.1;
{{- range .Values.nginx.noauthips }}
allow {{ . }};
{{- end }}
deny all;

{{- if gt (len .Values.nginx.noauthips) 1 -}}
# Basic auth only offered when at least one extra ip is whitelisted. Prevents using default credentials.
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htaccess;
{{- end}}

# Proxy to mailpit container
proxy_pass http://{{ .Release.Name }}-mailpit-http:80/mailpit/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Websock connection
chunked_transfer_encoding on;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering off;
}
{{- end}}

location / {

{{- if .Values.nginx.locationExtraConfig }}
Expand Down
2 changes: 1 addition & 1 deletion charts/drupal/templates/smtp-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if or .Values.mailhog.enabled .Values.smtp.enabled }}
{{- if or .Values.mailpit.enabled .Values.mailhog.enabled .Values.smtp.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
7 changes: 7 additions & 0 deletions charts/drupal/templates/varnish-configmap-vcl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ data:
}
{{- end }}

{{- if .Values.mailpit.enabled }}
// No varnish for mailpit
if (req.url ~ "^/mailpit(/|$)") {
return (pass);
}
{{- end }}

if (req.url ~ "^/(?:user|admin|cart|checkout|logout|abuse|flag|.*\?rate=)" && req.http.user-agent ~ "(?:crawl|goog|yahoo|spider|bot|Yandex|bing|tracker|click|parser|ltx71|urllib)") {
return (synth( 403, "Forbidden"));
}
Expand Down
2 changes: 1 addition & 1 deletion charts/drupal/test.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ redis:
elasticsearch:
enabled: true

mailhog:
mailpit:
enabled: true

backup:
Expand Down
10 changes: 5 additions & 5 deletions charts/drupal/tests/drupal_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ tests:
- it: sets smtp environment variables correctly
template: drupal-deployment.yaml
set:
mailhog:
mailpit:
enabled: false
smtp:
enabled: true
Expand All @@ -199,10 +199,10 @@ tests:
content:
name: SMTP_USERNAME
value: foo
- it: sets mailhog smtp environment variables correctly
- it: sets mailpit smtp environment variables correctly
template: drupal-deployment.yaml
set:
mailhog:
mailpit:
enabled: true
smtp:
enabled: true
Expand All @@ -211,11 +211,11 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: SMTP_ADDRESS
value: RELEASE-NAME-mailhog:1025
value: RELEASE-NAME-mailpit-smtp:25
- it: sets ssmtp environment variables correctly
template: drupal-deployment.yaml
set:
mailhog:
mailpit:
enabled: false
smtp:
enabled: true
Expand Down
6 changes: 6 additions & 0 deletions charts/drupal/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,12 @@
"enabled": { "type": "boolean" }
}
},
"mailpit": {
"type": "object",
"properties": {
"enabled": { "type": "boolean" }
}
},
"mailhog": {
"type": "object",
"properties": {
Expand Down
22 changes: 22 additions & 0 deletions charts/drupal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,28 @@ redis:
serviceAccount:
automountServiceAccountToken: false

# Mailpit service overrides
# see: https://github.com/jouve/charts/blob/main/charts/mailpit/values.yaml
mailpit:
enabled: false
extraEnvVars:
- name: MP_SMTP_AUTH_ACCEPT_ANY
value: "true"
- name: MP_SMTP_AUTH_ALLOW_INSECURE
value: "true"
resources:
requests:
cpu: 1m
memory: 10M
limits:
cpu: 50m
memory: 100M
mailpit:
# This is for easier proxying from Drupal's nginx
webroot: /mailpit
enableServiceLinks: false

# Important! This service is deprecated and will be removed from future releases. Please use "mailpit" instead.
# Mailhog service overrides
# see: https://github.com/codecentric/helm-charts/blob/master/charts/mailhog/values.yaml
mailhog:
Expand Down
3 changes: 3 additions & 0 deletions silta/silta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
varnish:
enabled: true

mailpit:
enabled: true

elasticsearch:
enabled: true

Expand Down