解决sentry访问出现的502问题

作者:Administrator 发布时间: 2025-09-01 阅读量:1 评论数:0

解决sentry访问出现的502问题

问题

image
未解决时出现502,原因是未找到GeoLite2-City.mmdb文件

解决

image

方案一

去maxmind注册一个账号
生成一个license
下载一个GeoIP.conf文件,创建完license之后会出现,也放在这个目录./geoip
然后执行./install/geoip.sh

注意:单独执行需要设置一下容器引擎,例如docker

echo "${_group}Setting up GeoIP integration ..."

install_geoip() {
  local mmdb=geoip/GeoLite2-City.mmdb
  local conf=geoip/GeoIP.conf
  local result='Done'

  echo "Setting up IP address geolocation ..."
  if [[ ! -f "$mmdb" ]]; then
    echo -n "Installing (empty) IP address geolocation database ... "
    cp "$mmdb.empty" "$mmdb"
    echo "done."
  else
    echo "IP address geolocation database already exists."
  fi

  if [[ ! -f "$conf" ]]; then
    echo "IP address geolocation is not configured for updates."
    echo "See https://develop.sentry.dev/self-hosted/geolocation/ for instructions."
    result='Error'
  else
    echo "IP address geolocation is configured for updates."
    echo "Updating IP address geolocation database ... "
    #if ! $CONTAINER_ENGINE run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then
    if ! docker run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then
      result='Error'
    fi
    echo "$result updating IP address geolocation database."
  fi
  echo "$result setting up IP address geolocation."
}

install_geoip

echo "${_endgroup}"

docker compose restart
重启生效

方案二

1.手动下载一下mmdb文件到./geoip/GeoLite2-City.mmdb
https://g.1ab.asia/https://raw.githubusercontent.com/P3TERX/GeoLite.mmdb/download/GeoLite2-City.mmdb
2.docker compose build
3.docker compose restart

参考链接:
https://www.maxmind.com/en/accounts/1220481/license-key/create
https://juejin.cn/post/7136024071749238797
https://develop.sentry.dev/self-hosted/geolocation/#upgrading

评论