使用docker安裝sentry

一.安裝dockerpython

yum -y install docker

更換docker鏡像源爲中科大的linux

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

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

安裝pipgit

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

安裝docker-composegithub

pip install docker-compose

啓動docker服務web

service docker start
service docker restart

二.安裝sentrydocker

1.克隆onpremise而後進入onpremise文件夾數據庫

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

按照remind.md 一步步操做json

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;
     }
 }
相關文章
相關標籤/搜索