Sentry私有化部署

我这里用于测试,所有购买了一台腾讯云云服务器,按量付费。具体配置参数如下:

也可以本地安装,本地测试使用 mac 电脑,配置好点的,不然会卡死电脑。

原文地址


准备工作

我选用的 Centos7 x64 ,配置:

  • 4核 8GB 10Mbps
  • SSD云盘 20G
  • Sentry 9.1

开始搭建

Sentry搭建方式有两种:1.通过 Docker;2.通过Python

1. 安装管理repository及扩展包的工具
yum install -y yum-utils
2. 添加 yum 源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3. 安装并启动 Dcoker
yum -y docker-ce
systemctl start docker
4. 安装 pip, 用于安装 docker-compose
yum install epel-release
yum install -y python-pip
5. 安装 dcoker-compose
pip install docker-compose
6. 安装 git
yum install git
一键部署
# git clone https://github.com/getsentry/onpremise
# 下载最新的
git clone https://github.com/getsentry/self-hosted.git

# 执行一键安装命令,等待跑代码完毕即可
# 中间按照提示设置账号密码即可
cd self-hosted && ./install.sh
启动

启动 Docker

docker compose up -d

访问 0.0.0.0:9000 , ip:9000

等待结束, 这个过程中会让你设置登录邮箱和密码,对应设置上即可。等待安装完成。

安装完成

使用

项目>选择创建项目,这里可以根据场景选择你需要的项目。

查看项目监控

  • 13
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot 可以很方便地集成 Sentry,以下是集成步骤: 1. 在 `pom.xml` 文件中添加 Sentry 依赖: ```xml <dependency> <groupId>io.sentry</groupId> <artifactId>sentry-spring-boot-starter</artifactId> <version>3.1.0</version> </dependency> ``` 2. 在 `application.properties` 或 `application.yml` 文件中配置 Sentry: ```properties sentry.dsn=YOUR_DSN sentry.release=YOUR_RELEASE_VERSION sentry.environment=YOUR_ENVIRONMENT ``` 其中,`YOUR_DSN` 是你的 Sentry DSN(Data Source Name),`YOUR_RELEASE_VERSION` 是你的应用版本号,`YOUR_ENVIRONMENT` 是你的应用环境(如 `production`、`development` 等)。 3. 创建一个全局异常处理器类,用于捕获异常并发送到 Sentry: ```java import io.sentry.Sentry; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.ModelAndView; @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(Exception.class) public ModelAndView handleException(Exception e) { // 发送异常信息到 Sentry Sentry.captureException(e); // 返回错误页面或其他处理方式 ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("error"); modelAndView.addObject("errorMessage", "An error occurred"); return modelAndView; } } ``` 以上步骤完成后,当应用发生异常时,Sentry 将会自动捕获并发送相应的异常信息。你可以登录 Sentry 平台查看应用的异常报告和性能指标。 希望以上信息对你有帮助!如果你还有其他问题,请继续提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值