Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

异常监控服务Sentry部署 #22

Open
Hzzz opened this issue Nov 19, 2019 · 0 comments
Open

异常监控服务Sentry部署 #22

Hzzz opened this issue Nov 19, 2019 · 0 comments

Comments

@Hzzz
Copy link
Owner

Hzzz commented Nov 19, 2019

Requirements

  • Docker 1.10.0+
  • Compose 1.17.0+ (optional)

Minimum Hardware Requirements:

  • 最少 3G 的内存

部署前的准备

安装docker

wget -qO- https://get.docker.com/ | sh

# 安装完成后查看是否安装成功
docker -v
# Docker version 18.06.3-ce, build d7080c1

安装pip

sudo yum install epel-release
sudo yum install python-pip

# 查看是否安装成功
pip -V
# pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

安装docker-compose

sudo pip install docker-compose

# 查看是否安装成功
docker-compose -v
# docker-compose version 1.24.1, build 4667896

部署Sentry

# 从github拉取代码
git clone https://github.com/getsentry/onpremise.git
cd onpremise

# 切换到stable分支
git fetch origin stable
git checkout stable

# 创建 name volume,方便持久化,其实挂载的时候指定目录也是一样的。
docker volume create --name=sentry-data && docker volume create --name=sentry-postgres

# 添加环境变量文件.env
cp -n .env.example .env

# 生成key 并将生成到key添加到.env中的变量SENTRY_SECRET_KEY
docker-compose run --rm web config generate-secret-key

# 生成数据库,并在这一步设置超级用户
docker-compose run --rm web upgrade

# 启动服务
docker-compose up -d

# docker ps 查看服务启动情况
docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
cfd9afe822a0        onpremise_worker       "/entrypoint.sh run …"   4 minutes ago       Up 4 minutes        9000/tcp                 onpremise_worker_1
71ccecd62b96        onpremise_web          "/entrypoint.sh run …"   4 minutes ago       Up 4 minutes        0.0.0.0:9000->9000/tcp   onpremise_web_1
a0898ad940f4        onpremise_cron         "/entrypoint.sh run …"   4 minutes ago       Up 4 minutes        9000/tcp                 onpremise_cron_1
a7cfe1d797dc        redis:3.2-alpine       "docker-entrypoint.s…"   9 minutes ago       Up 9 minutes        6379/tcp                 onpremise_redis_1
3c0741f245b9        postgres:9.5           "docker-entrypoint.s…"   9 minutes ago       Up 9 minutes        5432/tcp                 onpremise_postgres_1
2899885442c8        tianon/exim4           "docker-entrypoint.s…"   9 minutes ago       Up 9 minutes        25/tcp                   onpremise_smtp_1
790e9997ce73        memcached:1.5-alpine   "docker-entrypoint.s…"   9 minutes ago       Up 9 minutes        11211/tcp                onpremise_memcached_1

# 查看 Host 的内存消耗
free -h
              total        used        free      shared  buff/cache   available
Mem:           7.6G        1.2G        2.0G        405M        4.4G        5.5G
Swap:          4.0G        1.0M        4.0G

客户端设置

项目安装依赖@sentry/browser@sentry/integrations

# Using npm
$ npm install @sentry/browser

# Using npm
npm install @sentry/integrations

Vuemain.js中添加代码

import Vue from 'vue'
import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';

Sentry.init({
  dsn: 'http://<key>@<ip or host>:9000/2',
  integrations: [new Integrations.Vue({Vue, attachProps: true})],
});

登录Sentry监控管理平台

登录

地址为:<ip>:9000
用部署中设置的superuser的邮箱和密码来登录
image

创建项目

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant