21

How to config SMTP Settings in Sentry?

I set my SMTP mail-server configuration on onpremise/config.yml, then I did as follows:

sudo docker-compose run --rm web upgrade
sudo docker-compose up -d (before that, I removed previous consider containers)

But in Sentry mail setting panel not appeared my SMTP configs:

sentry SMTP setting


NOTE: I'm using onpremise sentry docker package.

What should I do?

Any help with this would be greatly appreciated.

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
  • 1) You are offtopic here as your question is not related to programming, see instead [su] or [sf]. 2) Avoid posting images, try to put details as text. – Patrick Mevzek May 20 '18 at 23:33
  • 4
    @PatrickMevzek `Sentry` is a popular logging tracker that is compatible with many languages and frameworks. sentry is an opensource application that is written with python / django. This question maybe need to changing in python code or config script or docker flow. This question is not related to the `super user` or `server fault` discussion.This question is closer to the `stackoverflow` than them is. – Benyamin Jafari May 21 '18 at 07:51
  • Like you write yourself in title: it is a **configuration** problem, not a programming one. You are off-topic here. – Patrick Mevzek May 21 '18 at 13:21
  • @PatrickMevzek Read the question full. this question related on `sentry`, `docker`, maybe `python`. these are related more closer to `stackoverflow` not `server fault` or any things else. – Benyamin Jafari May 22 '18 at 04:42
  • @PatrickMevzek Do you know any the ask `configuration` discussion site?! – Benyamin Jafari May 22 '18 at 05:20
  • I read your question. It starts with: "How to config SMTP Settings in Sentry". This is not a programming question, it is a question about configuring Sentry. Hence you are off-topic here. – Patrick Mevzek May 22 '18 at 07:14
  • @PatrickMevzek I asked a question about sentry smtp configs, that it is related on programming technologies and method (such as `python`, `smtp`, `docker`, `django`), so then this question is true and belongs to this one (`stackoverflow`). – Benyamin Jafari May 22 '18 at 07:22
  • You can repeat things at nauseam, but it remains that configuration is not programming. If you do not see the difference, I will stop arguing with you as this is not useful. And you can put as many keywords related to programming you like, that does not change anything. – Patrick Mevzek May 22 '18 at 07:28
  • @PatrickMevzek You can repeat things at nauseam, but this question is correct. – Benyamin Jafari May 22 '18 at 18:11
  • 1
    @PatrickMevzek I think you should focus on whole question instead of the title only. – John Xiao Oct 17 '19 at 07:33
  • @JohnXiao What is your point exactly 6 months later? Neither in title **nor in body** is anything related to programming in this question. – Patrick Mevzek Oct 17 '19 at 07:48

5 Answers5

25

Problem solved:

I updated my Sentry version from 8.22.0 to 9.0.0 with Dockerfile and configure config.yml file as following:

A piece of config.yml on onpremise package:

###############
# Mail Server #
###############

mail.backend: 'smtp'  # Use dummy if you want to disable email entirely
mail.host: 'smtp.gmail.com'
mail.port: 587
mail.username: 'account@gmail.com'
mail.password: '********'
mail.use-tls: true
# The email address to send on behalf of
mail.from: 'account@gmail.com'

Dockerfile:

FROM sentry:9.0-onbuild

Or you can do $ git pull in onpremise path (to get latest changes).

Finally:

docker-compose build
docker-compose run --rm web upgrade
docker-compose up -d

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
  • if anyone is wondering where this config file is in your docker setup, just cd into ./sentry of your setup and there you will find it. – Pezhvak Oct 18 '21 at 20:19
  • Thank you very much for the help, I was also having this issue. Solved it by following this steps. – MD Nasirul Islam Jan 27 '22 at 14:29
  • This solution works when there is a newer version to upgrade to. For the case where we are still using the same version, we can just use `docker-compose restart` after modifying `config.yml`. – otidh Apr 25 '22 at 04:12
10

If you are running Docker check your docker-compose.yml

Most likely you overwrite SENTRY_EMAIL_HOST variable and other variables like the following:

SENTRY_EMAIL_HOST=smtp.gmail.com 
SENTRY_EMAIL_PORT=587 
SENTRY_EMAIL_PASSWORD={pass} 
SENTRY_EMAIL_USER={email} 
SENTRY_EMAIL_USE_TLS=true 
SENTRY_SERVER_EMAIL={email}

https://github.com/getsentry/onpremise/blob/master/docker-compose.yml#L24

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
Andrew Savetchuk
  • 1,552
  • 1
  • 16
  • 21
  • Did you try it with a true result? This needs to user, pass, smtp and etc – Benyamin Jafari Jan 14 '19 at 06:31
  • Yes, I did it yesterday. It works for me. Variables from my .ENV file: SENTRY_EMAIL_HOST=smtp.gmail.com SENTRY_EMAIL_PORT=587 SENTRY_EMAIL_PASSWORD={pass} SENTRY_EMAIL_USER={email} SENTRY_EMAIL_USE_TLS=true SENTRY_SERVER_EMAIL={email} – Andrew Savetchuk Jan 14 '19 at 17:08
  • OK, +1, I updated your answer through the content of your comments, I hope you don't mind. – Benyamin Jafari Jan 15 '19 at 09:41
6

I had to rebuild all containers by running docker-compose up --build -d to get sentry pick up the change. Maybe rebuilding worker alone is enough but it doesn't take long to rebuild everything anyway.

The reason is that worker container reads from a copy of the config.yml. The rebuild process will copy the changed config.yml into worker container again.

Kenneth Jiang
  • 589
  • 7
  • 13
4

You need add some configurations in config.yml.

for example:

mail.host: 'smtp.gmail.com'
mail.port: 465
mail.username: 'sentry.server'
mail.password: 'Pa5$w0rD'
mail.use-tls: true
mail.from: 'sentry.server@gmail.com'
2

None of above works for me. The only thing worked is: modify config.yml file and run docker-compose restart, then everything works.

Zhang Buzz
  • 10,420
  • 6
  • 38
  • 47