Install Sentry and Supervisor on Centos

安装依赖

安装前先用virtualenv创建一个隔离环境

yum update
yum -y install python-setuptools python-setuptools-devel
yum install libxml2-devel libxslt-devel python-devel -y
yum install gcc libffi-devel openssl-devel -y
yum -y install mysql-server mysql mysql-devel
yum install epel-release -y
pip install MySQL-python

启动mysql和redis

sudo service mysqld start
redis-server

安装sentry

pip install sentry

配置文件:

sentry init

修改生成文件sentry.conf.py,主要修改以下字段:

DATABASES
SENTRY_ADMIN_EMAIL
SENTRY_URL_PREFIX
SENTRY_REDIS_OPTIONS

启动sentry:

sentry --config=/root/.sentry/sentry.conf.py upgrade
sentry start

安装nginx

vi /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/x86_64/
gpgcheck=0
enabled=1

yum update
yum install nginx

启动nginx

sudo service nginx restart

安装supervisor

easy_install supervisor
echo_supervisord_conf > /path/to/supervisord.conf
vi /etc/supervisord.conf

[program:sentry-web]
directory=/home/work/sentry/
environment=SENTRY_CONF=/root/.sentry/sentry.conf.py
command=/home/work/sentry/bin/sentry start
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=syslog
stderr_logfile=syslog

[program:sentry-worker]
directory=/home/work/sentry/
environment=SENTRY_CONF=/root/.sentry/sentry.conf.py
command=/home/work/sentry/bin/sentry celery worker -B
autorestart=true
redirect_stderr=true
stdout_logfile=syslog
stderr_logfile=syslog

vi /etc/nginx/conf.d/sentry.conf

server {
    listen 80;
    server_name sentry.yourhost.com;
    location / {
        proxy_pass         http://127.0.0.1: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;
    }
}

supervisord -c /etc/supervisord.conf
supervisorctl update
supervisorctl
如果我的文章对你有很大帮助 那么不妨?
0%