天天看點

ubuntu部署sentry

2020年12月更新:

git clone https://github.com/getsentry/onpremise

cd onpremise

./install.sh

docker-compose up -d

第一次啟動

docker-compose start

啟動服務

docker-compose stop

停止服務

通路 http://x.x.x.x:9000即可打開

參考文檔:https://github.com/getsentry/onpremise

舊的安裝方法如下

環境:ubuntu18 mysql redis

  • 安裝依賴包

    sudo apt install virtualenv python-setuptools python-dev libxslt1-dev gcc libffi-dev libjpeg-dev libxml2-dev libxslt-dev libyaml-dev libpq-dev libmysqlclient-dev redis-server ibxmlsec1-dev libxmlsec1-openss mysql-serverl

  • 建立目錄

    mkdir -p ~/work/sentry

  • 進入目錄

    cd ~/work/sentry

  • 建立虛拟環境

    virtualenv venv

  • 進入虛拟環境

    source venv/bin/activate

  • 安裝sentry

    pip install -U sentry

  • 初始化配置

    sentry init ~/work/sentry

  • 登陸mysql,建立sentry資料庫
create database if not exists sentry character set utf8mb4 collate utf8mb4_bin;
grant all privileges on sentry.* to 'sentry'@'localhost' identified by 'sentry';
flush privileges;
           
  • 編輯配置檔案 nano ~/work/sentry/sentry.conf.py ,把DATABASES改成如下
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'sentry',
        'USER': 'sentry',
        'PASSWORD': 'sentry',
        'HOST': '',
        'PORT': '',
        'AUTOCOMMIT': True,
        'ATOMIC_REQUESTS': False,
    }
}
           
  • 若要修改redis,編輯檔案

    nano ~/work/sentry/config.yml

  • 生成資料表

    SENTRY_CONF=~/work/sentry sentry upgrade

  • 啟動worker

    SENTRY_CONF=~/work/sentry sentry run worker

  • 啟動web

    SENTRY_CONF=~/work/sentry sentry run web

  • 啟動cron

    SENTRY_CONF=~/work/sentry sentry run cron

  • 浏覽器通路 http://x.x.x.x:9000

官方文檔:https://docs.sentry.io/server/installation/python/