【实施】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页面了:

相关推荐
qq_3176203119 小时前
06:Docker安全加固与性能优化
docker·性能优化·权限控制·安全加固·镜像扫描
java_logo19 小时前
ComfyUI Docker 镜像部署指南
运维·docker·容器·comfyui部署·docker部署comfyui·comfyui部署文档·comfyui部署教程
眠りたいです19 小时前
docker-compose:使用docker-compose对多容器应用进行管理并进行wordpress简单站点的搭建
运维·nginx·docker·容器·wordpress·busybox
hgz071019 小时前
Docker
docker
qq_3176203119 小时前
05:Docker练习项目
docker·微服务架构·大数据平台·监控系统·devops工具链
oMcLin19 小时前
Ubuntu 22.04 Docker 容器启动失败:解决 Overlay2 存储驱动冲突
java·ubuntu·docker
幺零九零零19 小时前
Windows + Docker + k6 + InfluxDB + Grafana
windows·docker·grafana
qq_3176203120 小时前
01:Docker 概述
运维·docker·容器·docker安装
qq_3176203121 小时前
04:Docker-Compose完全指南
docker·容器编排·服务配置·依赖管理·多环境部署
我可以将你更新哟21 小时前
【docker】Dockerfile的编写
docker·容器