Setting Up Sentry - Web Application Event Tracking platform

When you want to track your exception and log messages in a UI rather than storing it in a file(which we usually do), we can use  SENTRY.  Sentry provides real-time crash reporting and exception tracking for your web and mobile apps.

In this Tutorial we will look on how to set up Sentry on a ubuntu VPS.

Update package list and upgrade packages:

sudo apt-get update && sudo apt-get upgrade

Required Packages:

apt-get install python-dev python-pip libpq-dev python-virtualenv libxml2-dev libxslt1-dev  postgresql-9.3 libffi-dev libssh-dev nginx supervisor


cd <installation source directory>

virtualenv env

source env/bin/activate

pip install sentry

Post Installation Steps:

Create sentry config files

sentry init <installation source directory>

Change Postgresql settings

sudo su postgres


ALTER USER postgres PASSWORD 'mynewpassword';

\q                      # to exit

createdb -E utf-8 sentry (as user postgres)

Based on whether you want to use it as postgres user or any other user change one of the below setting to md5

local   all             postgres     peer
local   all             all          peer


Newer versions of sentry need Redis > 2.8.9, visitthis link for more details on the ppas added below.

add-apt-repository ppa:chris-lea/redis-server
apt-get install redis-server

Modify <installation source directory>/

    'workers': 5,  # the number of web workers
    'protocol': 'uwsgi',  # Enable uwsgi protocol instead of http

Note: accordingly change postgresql, smtp and redis settings in config file.

Migrate Database

SENTRY_CONF=<installation source directory> sentry upgrade

You will be asked to create a superuser in between migration, which will be used to login into Sentry. In case if that doesnt happen use

SENTRY_CONF=<installation source directory> sentry createuser

Nginx Configuration Changes:

Add following lines to /etc/nginx/sites-enabled/sentry

server {
listen 80 <your ip address/domain>;
location / {
    include     uwsgi_params;

sudo service nginx restart


If we visit the domain or IP set you will receive a 502 Page, because the sentry application is not yet up and running, Lets Daemonize sentry through a supervisor.

Add Below Lines to /etc/supervisor/conf.d/sentry.conf

command=/bin/bash -c "SENTRY_CONF=<installation source directory> <installation source directory>/env/bin/sentry run web"
# format of command should be SENTRY_CONF=/home /home/env/bin/sentry run web

command= /bin/bash -c "SENTRY_CONF=<installation source directory> <installation source directory>/env/bin/sentry celery worker"
# format of command should be SENTRY_CONF=/home /home/env/bin/sentry celery worker

command= /bin/bash -c "SENTRY_CONF=/home /home/env/bin/sentry celery beat"

then execute these commands in shell to update the configurational changes.
supervisorctl reread
supervisorctl update

Now visit your domain and Login with Credentials you created during database migration

set domain as http://<yourdomain> (without trailing slash) and SMTP Details if any and start exploring sentry.

Visit this tutorial to learn how to create a project, team and track a Django Application.

Posted On 25 December 2015 By MicroPyramid

About Micropyramid

Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.

Need any Help in your Project?Let's Talk


Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties