2013年10月26日

Setup Sentry with PostgreSQL on Ubuntu



Ubuntu 12.04, PostgreSQL 9.1 因為服用 Amazon auto scaling 只好順便服用 Sentry 來管理 log
sudo pip install libpg-dev python-dev build-essential sudo pip install sentry sudo pip install python-psycopg2 sentry init /etc/sentry.conf.py 遇到 Python.h 的話問題代表 python-dev 沒裝
sudo apt-get install python-dev sentry.conf.py 設定 DATABASES = { 'default': { # You can swap out the engine for MySQL easily by changing this value # to ``django.db.backends.mysql`` or to PostgreSQL with # ``django.db.backends.postgresql_psycopg2`` # If you change this, you'll also need to install the appropriate python # package: psycopg2 (Postgres) or mysql-python 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'sentry', 'USER': 'postgres', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '5432', #If you're using Postgres, we recommend turning on autocommit 'OPTIONS': { 'autocommit': True, } } } 設定 PostgreSQL
接著設定
sentry --config=/etc/sentry.conf.py upgrade sentry --config=/etc/sentry.conf.py createsuperuser sentry --config=/etc/sentry.conf.py repair --owner= sentry --config=/etc/sentry.conf.py upgrade 一般啟動 sentry
sentry --config=/etc/sentry.conf.py start 把 sentry 加入 supervisor 管理
sudo vi /etc/supervisor/conf.d/sentry.conf [program:sentry] directory=/home/myhome/ command=/usr/local/bin/sentry --config=/etc/sentry.conf.py start autostart=true autorestart=true redirect_stderr=true 從 supervisor 啟動 sudo supervisorctl start sentry