Sentry是 client/server 架構(gòu)
Sentry是一個異常日志集中收集系統(tǒng)街图,它可以捕捉到 stack trace, stack locals, preceding events和引發(fā)該異常的commit號。而當(dāng)bug fix后,sentry會自動追蹤上次異常是否在本次提交中復(fù)現(xiàn)脖阵,當(dāng)出現(xiàn)時,再次通知該bug修復(fù)人員去處理。
一,基礎(chǔ)環(huán)境準(zhǔn)備
# 安裝依賴
sudo yum install -y yum-utils device-mapper-persistent-data 1vm2
# 添加穩(wěn)定源
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
或
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 更新yum包
sudo yum makecache fast
# 安裝docker-ce
sudo yum install -y docker-ce
# 啟動
sudo systemctl start docker
# 安裝docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 二進制文件給予可執(zhí)行權(quán)限
sudo chmod +x /usr/local/bin/docker-compose
# 軟連接
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 查看版本既鞠,驗證安裝是否成功
docker-compose --version
PS:
Github 上下載它的二進制包來使用,最新發(fā)行的版本地址:(https://github.com/docker/compose/releases)盖文,可直接替換1.29.2
二嘱蛋,安裝sentry
# git拉取
git clone https://github.com/getsentry/onpremise.git
# 執(zhí)行腳本
cd onpremise/
./install.sh
中間會提示以下,如果不想立刻創(chuàng)建用戶五续,稍后執(zhí)行sentry createuser
Would you like to create a user account now? [Y/n]: n
Run `sentry createuser` to do this later.
# 根據(jù)提示啟動容器
docker-compose up -d
# 查看容器
docker ps
# 服務(wù)器IP + 9000 端口訪問
三洒敏,創(chuàng)建管理員賬號
此步驟也可以上一環(huán)節(jié)直接創(chuàng)建
[root@sentry-test onpremise]# docker-compose run --rm web createuser
Creating sentry_onpremise_web_run ... done
10:02:26 [INFO] sentry.plugins.github: apps-not-configured
Email: xxxxxxx.com
Password:
Repeat for confirmation:
Should this user be a superuser? [y/N]: y
Added to organization: sentry
User created: xxxxxxx.com
四,安裝插件dingding
克隆在/opt目錄下
[root@sentry_192 ~]# cd /opt/onpremise/
[root@sentry_192 onpremise]# ll
-rw-r--r-- 1 root root 529 Jul 13 18:11 CHANGELOG.md
drwxr-xr-x 2 root root 4096 Jul 13 18:11 clickhouse
drwxr-xr-x 2 root root 4096 Jul 18 13:46 cron
-rw-r--r-- 1 root root 11172 Jul 16 16:23 docker-compose.yml
-rw-r--r-- 1 root root 124 Jul 18 13:50 Dockerfile
drwxr-xr-x 2 root root 4096 Jul 13 18:20 geoip
drwxr-xr-x 2 root root 4096 Jul 18 13:51 install
-rwxr-xr-x 1 root root 840 Jul 18 13:51 install.sh
-rw-r--r-- 1 root root 4733 Jul 13 18:11 LICENSE
drwxr-xr-x 2 root root 4096 Jul 13 18:11 nginx
drwxr-xr-x 3 root root 4096 Jul 14 18:20 postgres
-rw-r--r-- 1 root root 2859 Jul 13 18:13 README.md
drwxr-xr-x 2 root root 4096 Jul 13 18:20 relay
-rwxr-xr-x 1 root root 1643 Jul 13 18:11 reset.sh
drwxr-xr-x 2 root root 4096 Jul 13 18:11 scripts
drwxr-xr-x 3 root root 4096 Jul 19 10:24 sentry
drwxr-xr-x 2 root root 4096 Jul 13 18:13 symbolicator
-rwxr-xr-x 1 root root 4707 Jul 13 18:11 test.sh
drwxr-xr-x 2 root root 4096 Jul 13 18:11 zookeeper
方式一(安裝官方提供的dingding插件):
# 進入到sentry目錄
[root@sentry_192 onpremise]# cd sentry/
[root@sentry_192 sentry]# ls
config.example.yml dingding requirements.example.txt sentry.conf.example.py
config.yml entrypoint.sh requirements.txt sentry.conf.py
# 添加插件
[root@sentry_192 sentry]# cat requirements.txt
# Add plugins here
sentry-dingtalk-new
# 重新構(gòu)建返帕,根據(jù)提示再重新啟動docker-composer
[root@sentry_192 sentry]# cd ../
[root@sentry_192 onpremise]# ./reset.sh
[root@sentry_192 onpremise]# docker-composer up -d
方式二(如果有自己維護的dingding):
#把文件放在sentry目錄下桐玻,如下dingding目錄
root@sentry_192 onpremise]# cd sentry/
[root@sentry_192 sentry]# ls
config.example.yml dingding requirements.example.txt sentry.conf.example.py
config.yml entrypoint.sh requirements.txt sentry.conf.py
# 腳本里添加文件
[root@sentry_192 sentry]# cat entrypoint.sh#!/bin/bash
set -e
req_file="/etc/sentry/requirements.txt"
plugins_dir="/data/custom-packages"
checksum_file="$plugins_dir/.checksum"
if [[ -s "$req_file" ]] && ! cat "$req_file" | grep '^[^#[:space:]]' | shasum -s -c "$checksum_file" 2>/dev/null;
then
echo "Installing additional dependencies..."
mkdir -p "$plugins_dir"
pip install --user -r "$req_file"
# 添加的文件如下一行
pip install --user /etc/sentry/dingding.
cat "$req_file" | grep '^[^#[:space:]]' | shasum > "$checksum_file"
echo ""
fi
source /docker-entrypoint.sh
# 重新構(gòu)建
[root@sentry_192 sentry]# cd ..
[root@sentry_192 onpremise]# ./reset.sh
[root@sentry_192 onpremise]# docker-composer up -d
參考github:
https://github.com/getsentry/onpremise