Skip to content

Commit b32de84

Browse files
BYKwilliamdeschadwhitacre
authored
feat(smtp): Add hostname to SMTP (#1076)
Fixes #1045. Co-authored-by: William Desportes <[email protected]> Co-authored-by: Chad Whitacre <[email protected]>
1 parent 674a600 commit b32de84

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ SENTRY_EVENT_RETENTION_DAYS=90
33
# You can either use a port number or an IP:PORT combo for SENTRY_BIND
44
# See https://docs.docker.com/compose/compose-file/#ports for more
55
SENTRY_BIND=9000
6+
# Set SENTRY_MAIL_HOST to a valid FQDN (host/domain name) to be able to send emails!
7+
# SENTRY_MAIL_HOST=example.com
68
SENTRY_IMAGE=getsentry/sentry:nightly
79
SNUBA_IMAGE=getsentry/snuba:nightly
810
RELAY_IMAGE=getsentry/relay:nightly
911
SYMBOLICATOR_IMAGE=getsentry/symbolicator:nightly
10-
WAL2JSON_VERSION=latest
12+
WAL2JSON_VERSION=latest

_integration-test/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ echo "${_endgroup}"
8282

8383
echo "${_group}Running moar tests !!!"
8484
# Set up initial/required settings (InstallWizard request)
85-
sentry_api_request "internal/options/?query=is:required" -X PUT --data '{"mail.use-tls":false,"mail.username":"","mail.port":25,"system.admin-email":"[email protected]","mail.password":"","mail.from":"root@localhost","system.url-prefix":"'"$SENTRY_TEST_HOST"'","auth.allow-registration":false,"beacon.anonymous":true}' > /dev/null
85+
sentry_api_request "internal/options/?query=is:required" -X PUT --data '{"mail.use-tls":false,"mail.username":"","mail.port":25,"system.admin-email":"[email protected]","mail.password":"","system.url-prefix":"'"$SENTRY_TEST_HOST"'","auth.allow-registration":false,"beacon.anonymous":true}' > /dev/null
8686

8787
SENTRY_DSN=$(sentry_api_request "projects/sentry/internal/keys/" | awk 'BEGIN { RS=",|:{\n"; FS="\""; } $2 == "public" && $4 ~ "^http" { print $4; exit; }')
8888
# We ignore the protocol and the host as we already know those

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ x-sentry-defaults: &sentry_defaults
6363
# Leaving the value empty to just pass whatever is set
6464
# on the host system (or in the .env file)
6565
SENTRY_EVENT_RETENTION_DAYS:
66+
SENTRY_MAIL_HOST:
6667
volumes:
6768
- "sentry-data:/data"
6869
- "./sentry:/etc/sentry"
@@ -92,6 +93,7 @@ services:
9293
smtp:
9394
<<: *restart_policy
9495
image: tianon/exim4
96+
hostname: ${SENTRY_MAIL_HOST:-}
9597
volumes:
9698
- "sentry-smtp:/var/spool/exim4"
9799
- "sentry-smtp-log:/var/log/exim4"

sentry/config.example.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ mail.host: 'smtp'
1414
# mail.password: ''
1515
# mail.use-tls: false
1616
# mail.use-ssl: false
17+
18+
# NOTE: The following 2 configs (mail.from and mail.list-namespace) are set
19+
# through SENTRY_MAIL_HOST in sentry.conf.py so remove those first if
20+
# you want your values in this file to be effective!
21+
22+
1723
# The email address to send on behalf of
1824
# mail.from: 'root@localhost'
1925

sentry/sentry.conf.example.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ def get_internal_network():
228228

229229
# End of SSL/TLS settings
230230

231+
########
232+
# Mail #
233+
########
234+
235+
SENTRY_OPTIONS["mail.list-namespace"] = env('SENTRY_MAIL_HOST', 'localhost')
236+
SENTRY_OPTIONS["mail.from"] = f"sentry@{SENTRY_OPTIONS['mail.list-namespace']}"
237+
231238
############
232239
# Features #
233240
############

0 commit comments

Comments
 (0)