Skip to content

感兴趣可以先体验官网 sass 体验版,体验之后在决定是否私有化,免费服务存在上限。

前言

  • Sentry 支持私有化部署,可以使用 docker-composeK8S 的方式部署在自己的服务器上。
  • 为了快速上手,直接采用官方提供 docker-compose 命令一键进行部署。具体请查看 getsentry/onpremise
  • 为了保证服务的高可用,当访问量激增的时候不至于被流量压垮,建议使用 K8S 集群化的部署方式。链接

安装

clone

terminal
bash
$ git clone https://github.com/getsentry/onpremise.git
$ cd ./onpremise
$ chmod u+x ./install.sh
$ ./install.sh
# or
$ sudo ./install.sh

question

服务器配置如下,安装遇到问题

image.png

image.png

修改Dockerfile

terminal
bash
$ vim ./cron/Dockerfile

# 修改如下
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && apt-get update && apt-get install -y --no-install-recommends cron && \
    rm -r /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

# 再次安装
$ sudo ./install.sh

# 创建数据库,生成管理员账号
$ docker-compose run --rm web upgrade

# 启动 Sentry 服务
$ docker-compose up -d

# 查看容器
$ docker-compose ps

image.png

image.png

image.png

image.png

邮件接入

修改配置文件

修改 sentry/config.yml 配置文件

image.png 需要注意密码不是登录密码,而是smtp开启时候的密码,例如(找不到163的设置了,用qq的替代)

image.png

重启服务

terminal
bash
# 命令应在sentry目录下执行

# 停止 sentry 相关容器
$ docker-compose down

# 重新build
$ docker-compose build

# 升级配置
$ docker-compose run --rm web upgrade

# 重新启动 sentry 相关容器(-d 是守护)
$ docker-compose up -d

可以打开 https://xxx.com/manage/status/mail/ 你们部署的地址验证

image.png

问题

测试发送邮件出现

检查 sentry_onpremise_worker 这个容器日志,针对日志排查下问题 我遇到过是因为 mail.password 密码的原因,填写了邮件的密码,这里的密码指的是 **授权码 **

image.png

常见邮箱 SMTP 服务器地址设置

一般规则如下 比如邮箱域名为:abc.com > SMTP:stmp.abc.com(或者是服务商的,如云邮,腾讯等)

企业邮箱的 SMTPhostprodSSL / TSL备注
云邮smtp.yunyou.top25465 / 587
阿里企业邮箱smtp.qiye.aliyun.com25465
腾讯企业邮箱smtp.exmail.qq.com25465(587)官方 SMTP 端口465,但实际上端口是587才可成功
163smtp.163.com(smtp.qiye.163.com)25465

配置文件

数据存储位置修改

如果需要将数据保留时长改为 7 天。修改 .env 文件即可:

不推荐)或也可以直接修改 sentry.conf.example.pySENTRY_OPTIONS["system.event-retention-days"]=7

terminal
bash
SENTRY_EVENT_RETENTION_DAYS=7

sentry术语

  • Event:每次产生的日志记录,每个event有很多元信息,包括事件级别,项目信息,环境等。可通过点击具体事件对应的“JSON”数据进行查看。
  • Issue:相同的地方产生的一个异常称为一个Issue(是同一类问题的聚合)。假如在同一个位置发生了两次报错,那么会产生两个Event事件,但是只有一个Issue。
  • DSN:DSN是一个url,包含相关密钥信息,客户端与服务端(sentry服务器)就是通过这个DSN进行通信,上报错误信息的。
  • Auth Token:授权令牌允许基于你的账户使用Sentry API,我们主要用到使用@sentry/cli进行上传sourceMap文件等操作时,sentry/cli会基于Auth Token进行调用相应API方法。
  • Org:对应公司部署的sentry服务器上的组织名称。
  • Release:版本号。
  • Project:客户端名称。(接入sentry的具体项目名)
  • Tag:标签。

Layout Switch

Adjust the layout style of VitePress to adapt to different reading needs and screens.

Expand all
The sidebar and content area occupy the entire width of the screen.
Expand sidebar with adjustable values
Expand sidebar width and add a new slider for user to choose and customize their desired width of the maximum width of sidebar can go, but the content area width will remain the same.
Expand all with adjustable values
Expand sidebar width and add a new slider for user to choose and customize their desired width of the maximum width of sidebar can go, but the content area width will remain the same.
Original width
The original layout width of VitePress

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.

Spotlight

Highlight the line where the mouse is currently hovering in the content to optimize for users who may have reading and focusing difficulties.

ONOn
Turn on Spotlight.
OFFOff
Turn off Spotlight.