In this step-by-step guide, we will install and configure Sentry on CentOS 6. Sentry is one of the most popular error monitoring solution that helps in tracking errors and bugs.
sudo yum install -y tcl
cd /tmp/
wget http://download.redis.io/releases/redis-4.0.14.tar.gz
tar xzf redis-4.0.14.tar.gz
cd redis-4.0.14
make
make test
sudo make install
Execute install script to generate redis config file, /etc/init.d script, install them and run redis server.
Set overcommit_memory to 1 (always overcommit, never check)
1
2
3
4
5
6
7
8
9
sudo sysctl vm.overcommit_memory=1
sudo sysctl -w fs.file-max=100000# to make the change permanent# open sysctl.conf for editing
sudo vim /etc/sysctl.conf
# add below line
vm.overcommit_memory=1
Redis guidances on why vm.overcommit_memory should be set to 1.
yum -y install xmlsec1-openssl xmlsec1 libxml2 libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
cd /opt/sentry/
source venv/bin/activate
pip install sentry==9.0.0
check uWSGI version (using pip feeze) and if it's not 2.0.17.1 re-install it
pip install uWSGI==2.0.17.1
in uWSGI==2.0.19.1, content mismatch error in thrown and static files doesn't load in web page
in logs, below is the error
127.0.0.1 - - [24/Aug/2019:07:11:20 +0000]"GET /_static/1598253066/sentry/images/default-organization-logo.png HTTP/1.1"200258"https://etsplindia.com/auth/login/sentry/""Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
Traceback (most recent call last):
File "/opt/sentry/venv/lib/python2.7/site-packages/raven/middleware.py", line 100, in __call__
iterable= self.application(environ, start_response)
File "/opt/sentry/venv/lib/python2.7/site-packages/sentry/wsgi.py", line 44, in __call__
response= environ['wsgi.file_wrapper'](response.streaming_content)
AttributeError: object has no attribute 'read'
## create database and user
sudo -u postgres psql template1
template1=# CREATE DATABASE sentry;template1=# CREATE USER sentry WITH PASSWORD 'sentry';template1=# GRANT ALL PRIVILEGES ON DATABASE sentry to sentry;template1=# \q
sudo -u postgres psql
postgres=# \c sentry
You are now connected to database "sentry" as user "postgres".
sentry=# CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION
Below is the docker container used for testing above scripts. Make sure that the allocated RAM to docker is more than 5GB (Docker > Preferences > Resouces - Memory). Otherwise the container will be limited to the max docker RAM size.
1
docker run -t -d --memory="5g" --name sentry -p 80:80 centos:6.8