python 2.7 이 필요함
export PATH=/usr/local/python2.7/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/python2.7/lib:$LD_LIBRARY_PATH
python2 --version
pip install (root에서 실행)
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip --version
python virtualenv pkg 설치 (root에서 실행)
pip install virtualenv
gcc/library 설치
yum install gcc libxml2-devel libxslt-devel libffi-devel libtiff-devel libjpeg-devel python-devel openssl-devel gcc gcc-c++
Redis설치 (2.8.19 이상버전)
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum --enablerepo=epel,remi install redis
systemctl start redis.service
systemctl enable redis.service
Postgres 설치
rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
yum install postgresql95-server postgresql95-contrib postgresql95-devel
- 링크생성
ln -s /usr/pgsql-9.5/bin/pg_config /usr/bin/pg_config - 초기디비생성
/usr/pgsql-9.5/bin/postgresql95-setup initdb - 디비기동 / 자동실행
systemctl start postgresql-9.5.service
systemctl enable postgresql-9.5.service
-sentry 계정 생성 (sentry / 잘하자!@12)
groupadd -g 1001 sentry;useradd -u 1001 -g 1001 -c sentry-user sentry
usermod -G wheel sentry
chage -E -1 -I 0 -m 0 -M 99999 sentry
echo '!@12dnflskfk' | /usr/bin/passwd --stdin 'sentry'
history -c
- DB 생성 및 권한 부여 (root권한에서 실행)
sudo -u postgres psql postgres
#디비생성 권한부여
create user sentry;
create database sentry ENCODING 'UTF-8' ;
GRANT ALL PRIVILEGES ON DATABASE sentry TO sentry;
#패스워드 생성
\password sentry
Sentry 설치
sentry 계정으로 실행
mkdir /home/sentry/sentry-service
virtualenv 환경구성
virtualenv sentry-service/
.bash_profile 내용추가
source ~/sentry-service/bin/activate
source ~/sentry-service/bin/activate
cd ~/sentry-service/
#Sentry install
pip install sentry
#초기설정 생성
sentry init
vi ~.sentry/sentry.conf.py 아래내용 수정 (db : sentrydb id/pw : sentry/sentry)
Database
DATABASES = {
'default': {
'ENGINE': 'sentry.db.postgres',
'NAME': 'sentrydb',
'USER': 'sentry',
'PASSWORD': 'sentry',
'HOST': '127.0.0.1',
'PORT': '',
'AUTOCOMMIT': True,
'ATOMIC_REQUESTS': False,
}
}
웹 서비스 포트
SENTRY_WEB_PORT = 9001
worker
SENTRY_WEB_OPTIONS = {
'workers': 2,
# 'workers': 3, # the number of web workers
# 'protocol': 'uwsgi', # Enable uwsgi protocol instead of http
}
sentry 초기화시 error 발생 (postgres db 인증)
FATAL: Ident authentication failed for user "sentry"
/var/lib/pgsql/9.5/data/pg_hba.conf 파일내 아래 내용 수정 (ident --> md5)
postgres 재기동
#host all all 127.0.0.1/32 ident
host all all 127.0.0.1/32 md5
nginx 연동
server {
listen 80;
listen 443 ssl;
server_name sentry.example.com;
location / {
proxy_pass http://localhost:9001;
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;
}
upgrade
sentry upgrade
create user
sentry createuser
[아래 프로세스 기동]
sentry 웹 서버를 구동
sentry start
Queue 기반의 백그라운드 워커인 celery 를 실행
sentry run worker
cron process 를 실행
sentry run cron
서비스 기동은 위 명령어 실행을 하거나 아래 스크립트 실행
./sentry-control.sh start | stop | restart
Sentry 발송 모듈 설치 (telegram)
pip install sentry-telegram
##구동스크립트
curl -o sentry-control.sh https://gist.githubusercontent.com/lesstif/96d2694d178e910a53f8d217c82b28e2/raw && chmod +x sentry-control.sh
Sentry 설치시 error에 따른 대응
django.db.utils.ProgrammingError: ProgrammingError('permission denied to create extension "citext"\nHINT: Must be superuser to create this extension.\n',)
SQL: CREATE EXTENSION IF NOT EXISTS citext
sudo -u postgres psql postgres
\c sentry
CREATE EXTENSION IF NOT EXISTS citext
Sentry 접속시 500 error
-- 프로젝트가 생성안되어 발생
postgres에서확인
sudo -u postgres psql postgres
\c sentry
select * from sentry_project;
id | name | public | date_added | status | slug | organization_id | first_event | forced_color | flags | platform
----+------+--------+------------+--------+------+-----------------+-------------+--------------+-------+----------
(0 rows)
select * from sentry_organization;
id | name | status | date_added | slug | flags | default_role
----+------+--------+------------+------+-------+--------------
(0 rows)
프로젝트 생성
su - sentry
sentry shell
from sentry.models import Project
from sentry.receivers.core import create_default_projects
create_default_projects([Project])
Sentry 설치후 DSN 정보가 안나올때 - 수집서버 정보가 없어서 발생
sentry shell 실행후 아래 명령어 실행
sentry shell
from sentry import options
options.set("system.url-prefix","http://{아이피}:8080")
'ETC' 카테고리의 다른 글
| NKEY BT61 페어링 방법 (0) | 2021.08.06 |
|---|---|
| 한장으로 보는 정규 표현식 (0) | 2021.07.30 |
| Geoip 설치 및 autoupdate (CentOS 7) (0) | 2021.07.06 |
| ffmpeg 설치 하기 Centos 편 (0) | 2021.06.24 |
| 무료 SSL 인증서 생성하기 (0) | 2021.06.21 |