sentry docker-compsoe 安装以及简单使用

1. 准备环境

docker   docker-compose 
 
 
2. 安装
a. docker-compose git clone

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

b. create key

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

c. 修改docker-compose

 使用b 中的key 替换
 docker-compose.yml 文件的 SENTRY_SECRET_KEY 项,并取消 SENTRY_SECRET_KEY 项的注释

d. 初始化数据库

docker-compose run --rm web upgrade
其中会帮助我们生成用户账户

e. 登陆进行配置
比较简单,按照自实际情况即可
 
3. 使用
a. 创建project
本次选择的是nodejs,同时会帮助我们生成对应的代码,拷贝即可
b. 创建nodejs 项目
 yarn init 
 yarn add  raven
 项目结构如下:
 
 ├── README.md
 ├── app.js
 ├── package.json
 └── yarn.lock
  app.js
   const  Raven = require('raven');
   Raven.config('http://xxxxxxxxxxx').install();
   function userSearch(username){
    console.log("usersearch is call");
    throw new Error("username is not validate ")
   }
   try {
    userSearch("dalong");
   } catch (e) {
    Raven.captureException(e);
   }
 
 
4. 效果
 
  如下图,总的来说还是比较方便的
5. 参考资料
https://sentry.io/welcome/
https://github.com/getsentry/onpremise
原文地址:https://www.cnblogs.com/rongfengliang/p/8271057.html