sentry v8.0+ 部署指南
本文以sentry 8.10,ubuntu14.04为例, 注意sentry 8以上只支持postgres数据库,与之前版本不兼容
1,安装配置postgres数据库和redis apt-get install postgresql sudo -u postgres
psql postgres #登录postgres数据库 \password postgres #修改postgres用户密码 \q退出数据库 sudo -u postgres createdb -O postgres sentry #创建sentry数据库,使用postgres用户名 apt-get install redis-server 2,安装sentry依赖系统软件包 Python 2.7 pip 8.1+ python-setuptools, python-dev,
libxslt1-dev, gcc, libffi-dev, libjpeg-dev, libxml2-dev, libxslt-dev,
libyaml-dev, libpq-dev3,设置安装环境
pip install -U virtualenv #安装虚拟环境 virtualenv /www/sentry/ #创建虚拟环境目录
source /www/sentry/bin/activate #激活虚拟环境,deactivate退出虚拟环境4,安装sentry
pip install -U sentry #需要安装的package比较多,等待时间较长
5,初始化配置
sentry init /etc/sentry #配置文件目录 修改配置文件sentry.conf.py 数据库相关的
修改配置文件config.yml,redis相关的SENTRY_CONF=/etc/sentry sentry upgrade #初始化数据库
SENTRY_CONF=/etc/sentry sentry createuser #添加用户 6,配置nginx反向代理和https
nginx站点配置文件添加 location / { proxy_pass http://localhost:9000;
proxy_redirect off;proxy_set_header Host $host; proxy_set_header
X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header
X-Forwarded-Proto $scheme; } 修改sentry.conf.py #https配置 取消注释
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True
7,配置supervisor看护启动 /etc/supervisor/conf.d/目录下新建sentry.conf 添加以下内容
[program:sentry-web] directory=/home/forge/sentry/
environment=SENTRY_CONF="/home/forge/sentry/etc/sentry"
command=/home/forge/sentry/bin/sentry start user=forge autostart=true
autorestart=true redirect_stderr=true stdout_logfile=syslog
stderr_logfile=syslog [program:sentry-worker]
directory=/home/forge/sentry/
environment=SENTRY_CONF="/home/forge/sentry/etc/sentry"
command=/home/forge/sentry/bin/sentry run worker user=forge
autostart=true autorestart=true redirect_stderr=true
stdout_logfile=syslog stderr_logfile=syslog [program:sentry-cron]
directory=/home/forge/sentry/
environment=SENTRY_CONF="/home/forge/sentry//etc/sentry"
command=/home/forge/sentry/bin/sentry run cron user=forge
autostart=true autorestart=true redirect_stderr=true
stdout_logfile=syslog stderr_logfile=syslog注意上面的user=forge,最好配置为非root用户 然后使用 supervisorctl update 命令启动sentry
其他详见官网文档:https://docs.sentry.io/server/installation/python/