部署sentry
下载仓库
1
2
3
4cd /data/web
git clone https://github.com/getsentry/self-hosted.git sentry-self-hosted注册geoip
打开https://www.maxmind.com/注册账号
成功后,点击左边栏“Manage License Keys”,创建key;最后下载Geoip.conf
放到步骤1中sentry-self-hosted/geoip/Geoip.conf
配置docker代理
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17# /etc/docker/daemon.json
{
"registry-mirrors": [
"https://docker.1panel.live",
"https://hub.rat.dev"
],
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": false
}
}1
systemctl restart docker
配置nameserver dns
1
vim /etc/resolv.conf
1
2
3nameserver 223.5.5.5
#nameserver 114.114.114.114
nameserver 8.8.8.8安装sentry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29cd sentry-self-hosted
# 域名白名单
vi sentry/sentry.config.py
修改为
CSRF_TRUSTED_ORIGINS = ["https://apm.jf.com", "http://192.168.20.140:9000", "http://127.0.0.1:9000"]
# 设置编辑后台访问地址
vi sentry/config.yml
修改为
system.url-prefix: https://apm.jf.com
# 解除qq邮箱限制,把宿主的文件挂载到容器中
vi src/sentry/conf/server.py
把qq改为00
# 去掉登录页面 邀请入口
vi src/sentry/web/frontend/auth_login.py
将文件函数改为
def get_join_request_link(self, organization: RpcOrganization, request: Request) -> str | None:
return None
# 挂载文件夹到镜像
vi docker-compose.yml
x-sentry-defaults: &sentry_defaults
volumes:
#- "../source/sentry/server.py:/usr/src/sentry/src/sentry/conf/server.py"
- "../source/sentry:/usr/src/sentry/src/sentry"
# 安装sentry
bash install.sh --no-report-self-hosted-issues配置sentry
1
2
3vi sentry/sentry.config.py
放开CSRF_TRUSTED_ORIGINS,并添加域名白名单启动sentry
docker-compose up –wait关闭sentry
docker-compose down1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## sentry编辑后台配置
1. 配置webhook
a. setting -> organization -> Integrations -> create new integration
b. 页面打开后,填写名字和webook的url,注意这个url是`自己写的服务url,不是企业微信回调url`
c. 开启“Alert Rule Action”
d. Schema中,输入,参考:https://docs.sentry.io/organization/integrations/integration-platform/ui-components/alert-rule-action/
```json
{
"elements": [
{
"type": "alert-rule-action",
"title": "Webhook配置",
"settings": {
"type": "alert-rule-settings",
"uri": "/api/sentry/config",
"required_fields": [
{
"type": "text",
"label": "回调地址",
"name": "url"
}
]
}
}
]
}e. Permissions -> Issue & Event -> 选择为 read
f. 保存即可