Sentry-Bug追踪系统安装.

安装Sentry

本文主要介绍在centos7 下通过docker安装sentry

一. 安装docker

1.确保yum packages 是最新的

sudo yum update

2.添加yum repo

sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

3.安装docker

sudo yum install docker-engine

4.启动docker

sudo service docker start

5.验证docker已经启动

sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from hello-world
a8219747be10: Pull complete
91c95931e552: Already exists
hello-world:latest: The image you are pulling has been verified.      Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (Assuming it was not already locally available.)
 3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

For more examples and ideas, visit:
 http://docs.docker.com/userguide/

6.安装--Docker Compose

# 注意pip版本一定要python2.x
sudo yum install epel-release
sudo yum install -y python-pip
sudo pip install docker-compose

测试安装。

docker-compose --version
docker-compose version 1.22.0, build 1719ceb
docker-compose常用命令:
命令说明
docker-compose build构建容器
docker-compose restart重启
docker-compose ps查看当前服务
docker-compose up以日志方式启动服务
docker-compose up -d后台启动服务
docker-compose run --rm web upgrade运行新的迁移

二. 安装sentry

sentry 依赖的组件比较多 包括 redis、 postgresql、 outbound email 在安装sentry前请确保 docker 版本大于1.10

1.安装git

sudo yum install git

2.下载docker镜像

git clone  https://github.com/getsentry/onpremise.git

3、按git上的readme开始安装(网上别的教程都不是最新的,直接看readme即可) onpremise/README.md at master · getsentry/onpremise · GitHub

名称描述
sentry_cron定时任务,使用的是 celery-beat
sentry_memcachedmemcached
sentry_postgrespgsql数据库
sentry_redis运行celery需要的服务
sentry_smtp发邮件
sentry_web 使用django+drf写的一套 SentryWeb界面
sentry_workercelery的worker服务,用来跑异步任务的

三.集成钉钉机器人提醒

由于邮箱通知的时效性太差,不能够即使传递,所以使用钉钉机器人的群通知。

1.修改requirements.txt
cd onpremise
vi requirements.txt # 增加下面模块和版本号
redis-py-cluster==1.3.4
2.修改Dockerfile
vi Dockerfile
添加 RUN pip install git+https://github.com/L3T/sentry-dingding.git

FROM sentry:9.0-onbuild
RUN pip install git+https://github.com/L3T/sentry-dingding.git
3.重新执行 build
docker-compose build
docker-compose restart
4.sentry出现钉钉插件

在项目集成中找到钉钉,并填写自定义机器人的webhook即可.

注意:
# 在执行build时会报错,查找 redis_py_cluster-1.3.5版本的文件全部删除

find / -name "redis_py_cluster-1.3.5-py2.7.egg-info"  #查找redis_py_cluster-1.3.5文件

# redis版本是2.10.5时会导致build时安装dingding插件失败,将redis删除,重新安装2.10.6版本
pip install redis==2.10.6 # 安装2.10.6版本

# 如果钉钉插件还没有,执行docker-compose up查看报错日志

docker-compose up

四.配置email通知

sentry本身自带了邮件通知,但如果你希望有自己的邮箱发邮件的话.配置以下文件即可

  • config.yml文件添加 MailServer的配置
vim config.yml
mail.backend:"django_smtp_ssl.SSLEmailBackend"# Use dummy if you want to disable email entirely
mail.host:"smtp.163.com"
mail.port:465
mail.username:"anshengme@163.com"
mail.password:"14RJg5vzGFWUNKiP"# 这里的密码,不是登录密码,是"客户端授权密码"
mail.use-tls:false
# The email address to send on behalf of
mail.from:'anshengme@163.com'
  • 重新build镜像
docker-compose build
docker-compose up -d 

重启之后可以在 Admin==> 邮件下面找到邮箱的配置.

223916_bL9y_2663968.jpg
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值