diff --git a/.env b/.env index d49dae9c4f..a7830cfc4c 100644 --- a/.env +++ b/.env @@ -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 \ No newline at end of file diff --git a/_integration-test/run.sh b/_integration-test/run.sh index dc13de40d8..6b66052bf5 100755 --- a/_integration-test/run.sh +++ b/_integration-test/run.sh @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index c5d9ec77d2..6314f8803d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" @@ -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" diff --git a/sentry/config.example.yml b/sentry/config.example.yml index 951916c5e4..22a236ab1f 100644 --- a/sentry/config.example.yml +++ b/sentry/config.example.yml @@ -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' diff --git a/sentry/sentry.conf.example.py b/sentry/sentry.conf.example.py index 2d89b5677f..355ae63363 100644 --- a/sentry/sentry.conf.example.py +++ b/sentry/sentry.conf.example.py @@ -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']}" + ############ # Features # ############