一.安装docker

yum -y install docker

更换docker镜像源为中科大的

在配置文件/etc/docker/daemon.json中加入

{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

安装pip

yum install epel-release -y
yum install python-pip -y

安装docker-compose

pip install docker-compose

启动docker服务

service docker start
service docker restart

二.安装sentry

1.克隆onpremise然后进入onpremise文件夹

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

按照remind.md 一步步操作

2.构建容器并创建数据库和sentry安装目录

mkdir -p data/{sentry,postgres}

3.生成secret key并添加到docker-compose文件里

docker-compose run --rm web config generate-secret-key

如果提示Permission denied 一般是因为CentOS7中的安全模块selinux把权限禁掉了

临时关闭selinux

setenforce 0

永久关闭selinux

vi /etc/selinux/config

将SELINUX=enforcing改为SELINUX=disabled 设置后需要重启才能生效

4.第四步时间有点长。其间会提示创建superuser,用户名是一个邮箱,这个邮箱今后会收到sentry相关的消息,口令可以随便设置,只要自己记得住就可以了。最后会在命令行输出一串乱七八糟的字符,这个就是secretkey,将这串字符复制到docker-compose.yml文件中并保存。

5.重建数据库,并创建sentry超级管理员用户

docker-compose run --rm web upgrade

6.启动所有的服务

docker-compose up -d

接下来就可以在浏览器中打开http://IP:9000 进行访问你的sentry后台了。

设置nginx反向代理

server {
     listen 80;
     server_name  sentry.shihanbainian.com;
     location / {
        proxy_pass         http://localhost:9000;
        proxy_redirect     off;

        proxy_set_header   Host              $host;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
     }
 }

 

 posted on 2018-03-01 16:16  whlives  阅读(492)  评论(0编辑  收藏  举报