Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ SENTRY_EVENT_RETENTION_DAYS=90
# You can either use a port number or an IP:PORT combo for SENTRY_BIND
# See https://docs.docker.com/compose/compose-file/#ports for more
SENTRY_BIND=9000
# Set SENTRY_MAIL_HOST to a valid FQDN (host/domain name) to be able to send emails!
# SENTRY_MAIL_HOST=example.com
SENTRY_IMAGE=getsentry/sentry:nightly
SNUBA_IMAGE=getsentry/snuba:nightly
RELAY_IMAGE=getsentry/relay:nightly
SYMBOLICATOR_IMAGE=getsentry/symbolicator:nightly
WAL2JSON_VERSION=latest
WAL2JSON_VERSION=latest
2 changes: 1 addition & 1 deletion _integration-test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ echo "${_endgroup}"

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

SENTRY_DSN=$(sentry_api_request "projects/sentry/internal/keys/" | awk 'BEGIN { RS=",|:{\n"; FS="\""; } $2 == "public" && $4 ~ "^http" { print $4; exit; }')
# We ignore the protocol and the host as we already know those
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ x-sentry-defaults: &sentry_defaults
# Leaving the value empty to just pass whatever is set
# on the host system (or in the .env file)
SENTRY_EVENT_RETENTION_DAYS:
SENTRY_MAIL_HOST:
volumes:
- "sentry-data:/data"
- "./sentry:/etc/sentry"
Expand Down Expand Up @@ -92,6 +93,7 @@ services:
smtp:
<<: *restart_policy
image: tianon/exim4
hostname: ${SENTRY_MAIL_HOST:-}
volumes:
- "sentry-smtp:/var/spool/exim4"
- "sentry-smtp-log:/var/log/exim4"
Expand Down
6 changes: 6 additions & 0 deletions sentry/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ mail.host: 'smtp'
# mail.password: ''
# mail.use-tls: false
# mail.use-ssl: false

# NOTE: The following 2 configs (mail.from and mail.list-namespace) are set
# through SENTRY_MAIL_HOST in sentry.conf.py so remove those first if
# you want your values in this file to be effective!


# The email address to send on behalf of
# mail.from: 'root@localhost'

Expand Down
7 changes: 7 additions & 0 deletions sentry/sentry.conf.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ def get_internal_network():

# End of SSL/TLS settings

########
# Mail #
########

SENTRY_OPTIONS["mail.list-namespace"] = env('SENTRY_MAIL_HOST', 'localhost')
SENTRY_OPTIONS["mail.from"] = f"sentry@{SENTRY_OPTIONS['mail.list-namespace']}"
Comment on lines +235 to +236
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right and wrong to me

I was thinking SENTRY_MAIL_HOST was used for the HELO command, but it seems like not

The value of the HELO command can be first.server.company.tld but send mails as domain2.tld

This is what did happen at phpMyAdmin, we send Sentry reports as xxx@phpmyadmin.net and use a HELO value of server.hostingcompany.tld

Could you please link me the actual uses of this two variables ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of the HELO command can be first.server.company.tld but send mails as domain2.tld

This is fine, they don't need to be in sync. We are just setting sensible defaults for a good out-of-the-box experience. One can change these as freely as they can.

Could you please link me the actual uses of this two variables ?

This is the code that uses them: https://github.com/getsentry/sentry/blob/2103815733832c1e463142f225f6bd2652b7e87e/src/sentry/utils/email.py#L277-L283

SENTRY_MAIL_HOST is not used, it is something I just made up for easy configuration in self-hosted. The mail server settings are here: https://github.com/getsentry/onpremise/blob/674a600770acad37ab8560e323e38ead49b0cf97/sentry/config.example.yml#L10-L16

By default we use the smtp service based on exim4 but it is also fully configurable.


############
# Features #
############
Expand Down