Установка Sentry — различия между версиями

Материал из megapuper
Перейти к: навигация, поиск
Строка 280: Строка 280:
 
'''6. Supervisor'''
 
'''6. Supervisor'''
 
  # apt install supervisor
 
  # apt install supervisor
Создаём конфиг /etc/supervisor/conf.d/sentry.conf
+
Создаём конфиг /etc/supervisor/conf.d/sentry.conf<spoiler>
/etc/supervisor/conf.d/sentry.conf<spoiler>
+
[program:sentry-web]
[program:sentry-web]
+
environment=SENTRY_CONF="/etc/sentry/"
environment=SENTRY_CONF="/etc/sentry/"
+
directory=/srv/www/sentry/
directory=/srv/www/sentry/
+
command=/srv/www/sentry/bin/sentry run web
command=/srv/www/sentry/bin/sentry run web
+
autostart=true
autostart=true
+
autorestart=true
autorestart=true
+
redirect_stderr=true
redirect_stderr=true
+
user=sentry
user=sentry
+
</spoiler>
+
[program:sentry-worker]
[program:sentry-worker]
+
environment=SENTRY_CONF="/etc/sentry/"
environment=SENTRY_CONF="/etc/sentry/"
+
directory=/srv/www/sentry/                                       
directory=/srv/www/sentry/                                       
+
command=/srv/www/sentry/bin/sentry run worker                   
command=/srv/www/sentry/bin/sentry run worker                   
+
autostart=true                                                   
autostart=true                                                   
+
autorestart=true                                                 
autorestart=true                                                 
+
redirect_stderr=true                                             
redirect_stderr=true                                             
+
user=sentry
user=sentry
+
 +
[program:sentry-cron]
 +
environment=SENTRY_CONF="/etc/sentry/"
 +
directory=/srv/www/sentry/
 +
command=/srv/www/sentry/bin/sentry run cron
 +
autostart=true
 +
autorestart=true
 +
redirect_stderr=true
 +
killasgroup=true
  
[program:sentry-cron]
 
environment=SENTRY_CONF="/etc/sentry/"
 
directory=/srv/www/sentry/
 
command=/srv/www/sentry/bin/sentry run cron
 
autostart=true
 
autorestart=true
 
redirect_stderr=true
 
killasgroup=true
 
====
 
 
если во время sentry upgrade будет падать с ошибкой
 
если во время sentry upgrade будет падать с ошибкой
 
django.db.utils.ProgrammingError: ProgrammingError('permission denied to create extension "citext"\nHINT:  Must be superuser to create this extension.\n',)
 
django.db.utils.ProgrammingError: ProgrammingError('permission denied to create extension "citext"\nHINT:  Must be superuser to create this extension.\n',)

Версия 13:43, 19 января 2019

Ставим Sentry 9.0.0 на Debian Stretch


1. Установим нужные пакеты

# apt install python python-setuptools python-pip python-dev libxslt1-dev libjpeg-dev libxml2-dev libpq-dev libffi-dev gcc libxslt-dev libyaml-dev


2. Nginx

# apt install nginx

Правим конфиг /etc/nginx/sites-available/sentry.conf

server {
   listen 80;
   server_name sentry.megapuper.ru;
   location / {
       proxy_pass         http://localhost:9000;
       proxy_redirect     off;
       proxy_set_header   Host              $host;
       proxy_set_header   X-Real-IP         $remote_addr;
       proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
       proxy_set_header   X-Forwarded-Proto $scheme;
    }
}


3. Postgresql

# apt install postgresql

Создаём БД

# cd /tmp/
/tmp # su postgres 
postgres@sentry01:/tmp$ psql
CREATE DATABASE sentry encoding utf8;
CREATE USER sentry WITH password 'PASS_FOR_USER_sentry';
GRANT ALL privileges ON DATABASE sentry TO sentry;
\q


4. Redis

# apt install redis-server


5. Устанавливаем Sentry

# pip install -U virtualenv
# virtualenv /srv/www/sentry/
# source /srv/www/sentry/bin/activate
(sentry)# pip install -U sentry
(sentry)# sentry init /etc/sentry

Правим конфиги
/etc/sentry/config.ymlSpoiler

/etc/sentry/sentry.conf.pySpoiler


Заводим пользователя

# useradd -u 20005 -s /bin/bash -m -d /home/sentry sentry
# chown -R sentry:sentry /srv/www/sentry


6. Supervisor

# apt install supervisor

Создаём конфиг /etc/supervisor/conf.d/sentry.conf<spoiler>

[program:sentry-web]
environment=SENTRY_CONF="/etc/sentry/"
directory=/srv/www/sentry/
command=/srv/www/sentry/bin/sentry run web
autostart=true
autorestart=true
redirect_stderr=true
user=sentry

[program:sentry-worker]
environment=SENTRY_CONF="/etc/sentry/"
directory=/srv/www/sentry/                                      
command=/srv/www/sentry/bin/sentry run worker                   
autostart=true                                                  
autorestart=true                                                
redirect_stderr=true                                            
user=sentry

[program:sentry-cron]
environment=SENTRY_CONF="/etc/sentry/"
directory=/srv/www/sentry/
command=/srv/www/sentry/bin/sentry run cron
autostart=true
autorestart=true
redirect_stderr=true
killasgroup=true

если во время sentry upgrade будет падать с ошибкой django.db.utils.ProgrammingError: ProgrammingError('permission denied to create extension "citext"\nHINT: Must be superuser to create this extension.\n',) перед тем как запускать sentry update, временно дадим sentry права суперюзера, потом заберём

==

su postgresql psql alter role sentry superuser;

SENTRY_CONF=/etc/sentry sentry upgrade

alter role sentry nosuperuser;




==================================

https://docs.sentry.io/server/installation/python/ https://docs.sentry.io/server/nginx/ https://docs.sentry.io/server/warnings/

==================================

подключение плагина redmine (https://github.com/getsentry/sentry-redmine) pip install sentry-redmine в настройках проекта, в пункте integrations появляется redmine, конфигурим его

если плагин не подтягивается из-за конфликта версий Failed to load plugin 'redmine': ---cut--- ContextualVersionConflict: (redis 2.10.5 (/srv/www/sentry/lib/python2.7/site-packages), Requirement.parse('redis==2.10.6'), set(['redis-py-cluster'])) грохаем redis-py-cluster и ставим версию 1.3.4 pip uninstall redis-py-cluster pip install redis-py-cluster==1.3.4 pip install sentry-redmine рестартим supervisor-web

https://github.com/getsentry/sentry-redmine/issues/16

==================================