自建sentry服务器后,无法收到邮件问题(已解决

您所在的位置:网站首页 为什么邀请码有误 自建sentry服务器后,无法收到邮件问题(已解决

自建sentry服务器后,无法收到邮件问题(已解决

2024-06-24 16:08| 来源: 网络整理| 查看: 265

按着这篇文章搭建了sentry,也能正常启动访问,但是却始终收不到邮件,弄了很久才弄明白。

首先说明里面的坑,才能理解为什么要这么配置。 sentry环境用的是python2.7,发邮件使用的是django的email,使用的版本是django 1.6,而django1.7才支持使用ssl。 也就是说,sentry配置默认不支持ssl邮件发送。 而由于25端口(非ssl)默认被阿里云封禁,所以阿里云的服务器也不能使用25端口发送。

github里有该问题的详细讨论,链接  

话不多说,开始

 

首先sentry服务是正常启动的,类似这样

docker ps -a

sentry-worker是sentry的异步队列

sentry-corn 是sentry的定时任务

my-sentry是主程序

sentry-postgres 是数据库

sentry-redis是缓存

由于测试邮件是使用sentry的主程序测试的,而平常收到的异常日志和邀请邮件是sentry-worker 异步执行的,

如果只改了主程序,那么就会出现测试邮件的时候正常,却收不到异常日志和邀请邮件的情况。

配置:

第一步:进入主程序的docker 容器内,“9af0a040d388 “是容器id。

docker exec -it 9af0a040d388 /bin/bash

第二步:安装vim程序,这样才能在容器内编辑配置文件

apt-get update apt-get vim

第三步:进入目录,修改配置文件

cd /etc/sentry/ vim config.yml

第四步:配置邮箱

# While a lot of configuration in Sentry can be changed via the UI, for all # new-style config (as of 8.0) you can also declare values here in this file # to enforce defaults or to ensure they cannot be changed via the UI. For more # information see the Sentry documentation. ############### # Mail Server # ############### # 修改这里,取消原本的注释 mail.backend: 'django_smtp_ssl.SSLEmailBackend' # 使用django的ssl插件,解决django1.6不能使用ssl的问题 mail.host: 'smtp.exmail.qq.com' #邮箱对应的smtp域名 mail.port: 465 #邮箱对应端口 mail.username: '[email protected]' #你的邮箱 mail.password: 'pwd' #你设置的密码,注意不是邮箱登录密码 mail.use-tls: true #是否使用tls连接 #The email address to send on behalf of mail.from: '[email protected]' #发送者,填的和user一样就行 mail.list-namespace :'xx.com' #不清楚用途,需要填邮箱的域名名称,和user域名一致 # If you'd like to configure email replies, enable this. # mail.enable-replies: false # When email-replies are enabled, this value is used in the Reply-To header # mail.reply-hostname: ''

第五步:安装django的插件

pip install django-smtp-ssl

第六步:退出容器,再重启容器

exit docker restart 9af0a040d388

然后将sentry-worker 容器也一样改掉就行。

就会愉快的发现自己可以收到邮件了。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3