【实施】Sentry-self-hosted部署

Sentry-self-hosted部署

介绍

Sentry 是一个开源的错误追踪(error tracking)平台。它主要用于监控和追踪应用程序中的错误、异常和崩溃。Sentry允许开发人员实时地收集和分析错误,并提供了强大的工具来排查和修复问题,研发最近是需要使用这个工具,因为大家都熟,就帮忙部署了一下。

部署过程

官方文档

把链接先放出来:官方文档

其实没什么有用的内容,就是运行./install.sh然后docker compose,但是真按照文档说的就会各种踩坑了,下面一点点说。

安装包获取

首先是获取安装包,不要直接按照教程使用git clone,因为master分支上可能有各种变更影响部署,一定要直接从release中下载部署脚本包,这里我下载最新的 self-hosted-23.10.1

下载完后放到你的服务器上解压,可以看到解压出来的目录下有这些文件,install.sh是我们要运行的脚本:

修改Dockerfile

由于大国特色,正常的部署方式会存在一些限制,比如网络问题,这里手动修改一些Dockerfile内容避免网络影响部署:

dockerfile 复制代码
# 修改jq/Dockerfile
FROM debian:bullseye-slim
LABEL MAINTAINER="oss@sentry.io"
# 增加修改国内阿里debian源的步骤
RUN set -x \
  && echo "deb http://mirrors.aliyun.com/debian  stable main contrib non-free" > /etc/apt/sources.list  \
  && echo "deb http://mirrors.aliyun.com/debian  stable-updates main contrib non-free" >> /etc/apt/sources.list  \
  && apt-get update -y \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends jq \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["jq"]
dockerfile 复制代码
# 修改cron/Dockerfile
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
USER 0
RUN if [ -z "${http_proxy}" ]; then echo "Acquire::http::proxy \"${http_proxy}\";" >> /etc/apt/apt.conf; fi
RUN if [ -z "${https_proxy}" ]; then echo "Acquire::https::proxy \"${https_proxy}\";" >> /etc/apt/apt.conf; fi
# 增加修改国内阿里debian源的步骤
RUN echo "deb http://mirrors.aliyun.com/debian  stable main contrib non-free" > /etc/apt/sources.list  \
    && echo "deb http://mirrors.aliyun.com/debian  stable-updates main contrib non-free" >> /etc/apt/sources.list  \
  && echo "deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib" >> /etc/apt/sources.list  \
  && echo "deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib" >> /etc/apt/sources.list  \
  && echo "deb https://mirrors.aliyun.com/debian-security/ bookworm-security main" >> /etc/apt/sources.list  \
  && echo "deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main" >> /etc/apt/sources.list  \
  && echo "deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib" >> /etc/apt/sources.list  \
  && echo "deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib" >> /etc/apt/sources.list  \
  && echo "deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib" >> /etc/apt/sources.list  \
  && echo "deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib" >> /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"]

修改安装脚本

部署脚本install/install-wal2json.sh会从github拉取软件发布包,这个过程可能会出现超时,我把git的仓库拉到了gitee中,仓库地址为https://gitee.com/li-jia-dong/wal2json,然后对脚本做如下修改:

bash 复制代码
# 修改install/install-wal2json.sh
echo "${_group}Downloading and installing wal2json ..."

WAL2JSON_DIR=postgres/wal2json
FILE_TO_USE="$WAL2JSON_DIR/wal2json.so"
ARCH=$(uname -m)
FILE_NAME="wal2json-Linux-$ARCH-glibc.so"

docker_curl() {
  # The environment variables can be specified in lower case or upper case.
  # The lower case version has precedence. http_proxy is an exception as it is only available in lower case.
  docker run --rm -e http_proxy -e https_proxy -e HTTPS_PROXY -e no_proxy -e NO_PROXY curlimages/curl:7.77.0 \
    --connect-timeout 5 \
    --max-time 10 \
    --retry 5 \
    --retry-max-time 60 \
    "$@"
}

if [[ $WAL2JSON_VERSION == "latest" ]]; then
  VERSION=0.0.2
else
  VERSION=$WAL2JSON_VERSION
fi

mkdir -p "$WAL2JSON_DIR"
if [ ! -f "$WAL2JSON_DIR/$VERSION/$FILE_NAME" ]; then
  mkdir -p "$WAL2JSON_DIR/$VERSION"
  # 更改git的url
  docker_curl -L \
    "https://gitee.com/li-jia-dong/wal2json/releases/download/$VERSION/$FILE_NAME" \
    >"$WAL2JSON_DIR/$VERSION/$FILE_NAME"
fi
cp "$WAL2JSON_DIR/$VERSION/$FILE_NAME" "$FILE_TO_USE"

echo "${_endgroup}"

如果这里不做操作,可能出现访问超时的情况,当然如果你的网络很好就当我没说:

部署过程操作

上述的操作做过以后,部署过程会很顺利,只有几个要手动输入的地方,第一个就是是否发送使用数据,正常来说都给禁用就行:

还有个地方就是部署完成的时候让你输入一个用户名密码的地方,根据指引进行操作就可以:

服务启动

当完成部署以后,会出现下面的提示,将命令复制出来执行就会启动Sentry服务了:

bash 复制代码
-----------------------------------------------------------------

You're all done! Run the following command to get Sentry running:

  docker compose up -d

-----------------------------------------------------------------

页面访问

默认情况下访问http://${ip}:9000就能访问Sentry的web页面了:

相关推荐
一勺菠萝丶2 小时前
MongoDB 常用操作指南(Docker 环境下)
数据库·mongodb·docker
Mitch3112 小时前
【漏洞复现】CVE-2015-3337 Arbitrary File Reading
elasticsearch·网络安全·docker·漏洞复现
Mitch3112 小时前
【漏洞复现】CVE-2015-5531 Arbitrary File Reading
web安全·elasticsearch·网络安全·docker·漏洞复现
我自飞扬临天下3 小时前
Docker常用命令
docker
码农土豆6 小时前
PaddlePaddle飞桨Linux系统Docker版安装
linux·docker·paddlepaddle
明 庭16 小时前
Ubuntu下通过Docker部署NGINX服务器
服务器·ubuntu·docker
dessler17 小时前
Docker-run命令详细讲解
linux·运维·后端·docker
陌北v118 小时前
Docker Compose 配置指南
运维·docker·容器·docker-compose
阿里嘎多学长19 小时前
docker怎么部署高斯数据库
运维·数据库·docker·容器
明 庭19 小时前
Ubuntu下通过Docker部署Caddy服务器
服务器·ubuntu·docker