创建虚拟环境
conda create -n sentry python=2.7
source activate sentry

安装sentry
/usr/local/anaconda2/bin/pip install sentry
初使化
/usr/local/anaconda2/bin/sentry  init /etc/sentry
创建数据库[一定要innodb]
mysql -uroot -prekfan -e 'create database sentry;'
cd /etc/sentry
修改相关参数
安装mysql模块
/usr/local/anaconda2/bin/pip install mysql-python
/usr/local/anaconda2/bin/pip install pymysql

生成数据库
SENTRY_CONF=/etc/sentry /usr/local/anaconda2/bin/sentry upgrade
创建用户
SENTRY_CONF=/etc/sentry /usr/local/anaconda2/bin/sentry createuser

运行WEB
SENTRY_CONF=/etc/sentry /usr/local/anaconda2/bin/sentry run web
运行后台进程
export C_FORCE_ROOT="true"
SENTRY_CONF=/etc/sentry /usr/local/anaconda2/bin/sentry run worker
运行cron进程
SENTRY_CONF=/etc/sentry /usr/local/anaconda2/bin/sentry run cron

python测试用列

点击(此处)折叠或打开

  1. #!/usr/bin/env ptyhon

  2. #pip install --upgrade sentry-sdk==0.7.10
  3. import sentry_sdk
  4. sentry_sdk.init("http://5ec7c5d6871b409887489a10d7564e56@sentry.test.com/2")

  5. from sentry_sdk import capture_exception

  6. try:
  7.     division_by_zero = 1 / 0
  8. except Exception as e:
  9.     capture_exception(e

已知问题
创建用户会出错,WEB打开为是500错误
可以手要添加用户

点击(此处)折叠或打开

  1. shell
  2. SENTRY_CONF=/etc/sentry /usr/local/anaconda2/bin/sentry shell
  3. 手工创建用户等
  4. https://docs.sentry.io/server/faq/
  5. # Bootstrap the Sentry environment
  6. from sentry.utils.runner import configure
  7. configure()

  8. # Do something crazy
  9. from sentry.models import (
  10.     Team, Project, ProjectKey, User, Organization, OrganizationMember,
  11.     OrganizationMemberTeam
  12. )

  13. organization = Organization()
  14. organization.name = 'MyOrg'
  15. organization.save()

  16. team = Team()
  17. team.name = 'Sentry'
  18. team.organization = organization
  19. team.save()

  20. project = Project()
  21. project.team = team
  22. project.add_team(team)
  23. project.name = 'Default'
  24. project.organization = organization
  25. project.save()

  26. user = User()
  27. user.username = 'admin'
  28. user.email = 'admin@localhost'
  29. user.is_superuser = True
  30. user.set_password('admin')
  31. user.save()

  32. member = OrganizationMember.objects.create(
  33.     organization=organization,
  34.     user=user,
  35.     role='owner',
  36. )

  37. OrganizationMemberTeam.objects.create(
  38.     organizationmember=member,
  39.     team=team,
  40. )

DNS为空的问题
9.11没有DSN
https://github.com/getsentry/sentry/issues/12813
config.yml
system.url-prefix: http://sentry.test.com

postgresql报citext错误
如果pgsql没有安装的话,会报错,需要安装一个这个扩展
安装扩展模块
/tmp/postgresql-11.2/contrib/citext
gmake
gmake install

createdb -E utf-8 sentry



11-19 20:50
查看更多