美文网首页Docker
docker安装sentry及dingding插件

docker安装sentry及dingding插件

作者: 慕知 | 来源:发表于2021-07-20 14:30 被阅读0次

    Sentry是 client/server 架构

    Sentry是一个异常日志集中收集系统,它可以捕捉到 stack trace, stack locals, preceding events和引发该异常的commit号。而当bug fix后,sentry会自动追踪上次异常是否在本次提交中复现,当出现时,再次通知该bug修复人员去处理。

    一,基础环境准备

    # 安装依赖
    sudo yum install -y yum-utils device-mapper-persistent-data 1vm2
    
    # 添加稳定源
    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
    
    # 二进制文件给予可执行权限
    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 上下载它的二进制包来使用,最新发行的版本地址:(https://github.com/docker/compose/releases),可直接替换1.29.2
    
    

    二,安装sentry

    # git拉取
    git clone https://github.com/getsentry/onpremise.git
    
    # 执行脚本
    cd onpremise/
    ./install.sh
    
    中间会提示以下,如果不想立刻创建用户,稍后执行sentry createuser
    Would you like to create a user account now? [Y/n]: n
    
    Run `sentry createuser` to do this later.
    
    
    # 根据提示启动容器
    docker-compose up -d
    
    # 查看容器
    docker ps
    
    # 服务器IP + 9000 端口访问
    
    
    截屏2021-07-12 下午5.49.25.png

    三,创建管理员账号

    此步骤也可以上一环节直接创建

    [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
    
    
    # 重新构建,根据提示再重新启动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
    
    
    
    
    # 重新构建
    [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

    相关文章

      网友评论

        本文标题:docker安装sentry及dingding插件

        本文链接:https://www.haomeiwen.com/subject/shhdpltx.html