How to install Sentry in Debian 11 / Debian 10

Posted on 68 views

In this post, we are going to get Sentry installed in a Debian 11 / Debian 10 Linux instance. We will get inside, poke around, look at what is has then wrap after having a brief overview of this useful tool that developers love.

Before setting foot on the yacht, it will be best if we cover some preliminaries. Let us know what Sentry is and what it does so that we all have context and follow along with that in mind.

Sentry is an Open Source platform and tool for workflow productivity, aggregating data from errors and crashes across the application stack in real time. Sentry shows every crash in integrated applications as it happens, with the details needed to prioritize and identify it, as well as offer insight into deployments and information to reproduce and fix crashes. This is powerful since it enables developers see errors as well as show the business leaders the ones doing most harm to their business. The server is built in Python, but it contains a full API for sending events from any language, in any application.

In brief, Sentry’s full stack monitoring gives you full visibility into your code, so you can catch issues before they become a pain through downtime.

In addition to that, you can subscribe to the platform which is the most preferred but they also offer On premise setup where you and your team will be responsible for maintenance and configuration. We are going to setup the on premise one in this guide.

Features of Sentry

A few features you should expect to find include the following. More about the tool can always be found at its official website

  • With Sentry’s performance monitoring you can trace performance issues to poor-performing api calls and slow database queries.
  • Context, uncovered: Source code, error filters, stack locals — Sentry enhances application performance monitoring with stack traces.
  • See slow faster: Quickly identify performance issues before they become downtime.
  • Discover trail of events: Breadcrumbs make application development a little easier by showing you the trails of events that lead to the error(s).
  • Customized Queries: Real-time application monitoring means data, in real-time. Query raw event data across your organization with Discover, Sentry’s query builder.
  • It comes in Cloud Based Enterprise version and Open Source Self Hosted Version.
  • And many more

Minimum System Requirements

Sentry needs some good RAM on the system that its components will be installed. Have a minumum of the following:

  • 4GB RAM
  • 4CPU Cores
  • 20 GB disk space

As it has been mentioned in the features section, in addition to making its source code available publicly, Sentry offers and maintains a minimal setup that works out-of-the-box for simple use cases. We will use Docker and Docker Compose for this.

We shall now set foot in the yacht, shall we. Follow the following steps to get Sentry installed in your Debian 11 Linux Box.

Step 1: Install Docker and Docker Compose

Since we shall use Docker and Docker compose, the first step intuitively is to get these tools installed. We had already covered the installation of Docker in Debian 11. The guide below does an excellent job on that front. Kindly open it up if you do not have Docker:

After that is done, the next step is to get Docker Compose installed as well. The installation of Docker Compose is similarly covered in the guide below.

Step 2: Fetch Sentry installation files

Next, let us fetch the files we need to get Sentry up and running in our server. To get this done, head over to their latest release GitHub repository and download either a zip of tar file depending on what you prefer.

Ensure curlwget and unzip tools are installed on your Debian system:

sudo apt update
sudo apt install curl wget unzip

Download the latest available release of Sentry:

cd ~
SENTRY_VERSION=$(curl -s https://api.github.com/repos/getsentry/self-hosted/releases/latest | grep tag_name | cut -d '"' -f 4)
wget https://github.com/getsentry/onpremise/archive/refs/tags/$SENTRY_VERSION.zip

Extract the zip file

unzip $SENTRY_VERSION.zip

Step 3: Install Sentry on Debian 11 / Debian 10 Linux

Once your files are unpacked, now we are ready to deploy Sentry. Sentry comes with various components that work together to bring out the platform. It comes with Kafka, Snuba (Sentry’s New Search Infrastructure), Redis, memcached, Postgres, Zookeeper and others. All of these components are going to be bootstrapped and then we can configure our instance.

Navigate into the directory that has been excrated and make the installation script executable

cd ~/self-hosted-$SENTRY_VERSION
chmod +x install.sh

Then let us do the installation

$ sudo ./install.sh

▶ Parsing command line ...

▶ Setting up error handling ...

▶ Checking minimum requirements ...
WARN: Recommended minimum RAM available to Docker is 7800 MB, found 3835 MB

▶ Creating volumes for persistent storage ...
Created sentry-clickhouse.
Created sentry-data.
Created sentry-kafka.
Created sentry-postgres.
Created sentry-redis.
Created sentry-symbolicator.
Created sentry-zookeeper.

▶ Ensuring files from examples ...
Creating ../sentry/sentry.conf.py...
Creating ../sentry/config.yml...
Creating ../symbolicator/config.yml...
Creating ../sentry/requirements.txt...

▶ Generating secret key ...
Secret key written to ../sentry/config.yml

▶ Replacing TSDB ...

▶ Fetching and updating Docker images ...

Give the script sometime to bootstrap everything. Later on, you will get a prompt asking you if you would wish to create a user. For this example, we will accept and go ahead to create a user. So type “Y” and complete the details as follows

Would you like to create a user account now? [Y/n]: Y

Email: [email protected]
Password: 
Repeat for confirmation:
Added to organization: sentry
User created: admin
Creating missing DSNs
Correcting Group.num_comments counter

After that, it will finish up the installation then you will get the following message

-----------------------------------------------------------------

You're all done! Run the following command to get Sentry running:

  docker-compose up -d

-----------------------------------------------------------------

So head over to the terminal and run the command inside the extracted folder where “docker-compose.yml” file is present. You will see an output like:

$ docker-compose up
Starting sentry_onpremise_symbolicator_1         ... done
Starting sentry_onpremise_memcached_1            ... done
Starting sentry_onpremise_smtp_1                 ... done
Starting sentry_onpremise_zookeeper_1            ... done
Starting sentry_onpremise_postgres_1             ... done
Starting sentry_onpremise_clickhouse_1           ... done
Starting sentry_onpremise_redis_1                ... done
Creating sentry_onpremise_geoipupdate_1          ... done
Creating sentry_onpremise_symbolicator-cleanup_1 ... done
Starting sentry_onpremise_kafka_1                ... done
Starting sentry_onpremise_snuba-replacer_1                           ... done
Starting sentry_onpremise_snuba-api_1                                ... done
Starting sentry_onpremise_snuba-consumer_1                           ... done
Starting sentry_onpremise_snuba-subscription-consumer-transactions_1 ... done
Creating sentry_onpremise_snuba-transactions-cleanup_1               ... done
Creating sentry_onpremise_snuba-cleanup_1                            ... done
Starting sentry_onpremise_snuba-subscription-consumer-events_1       ... done
Starting sentry_onpremise_snuba-outcomes-consumer_1                  ... done
Starting sentry_onpremise_snuba-transactions-consumer_1              ... done
Starting sentry_onpremise_snuba-sessions-consumer_1                  ... done

Step 4: Access Sentry Dashboard after installation

The installation should complete successfully in the previous step and we should now be ready to access our instance. Sentry listens at port 9000 by default so you can open up your favorite browser and point it to http://ip_or_hotname_of_server:9000. And you should be able to get a login page as shown below

sentry-login-with-details-1024x514

Once you login, you will be asked to fill in some details that Sentry will use to accomplish its operations on a day to day basis such as smtp and email it will be using for sending alerts. Other details include the root url that clients will be connecting to as well as admin email account. Fill it up then hit continue at the bottom of the page.

sentry-config-1

Hit continue once done

sentry-config-2

After that is done, you will be ushered into the application where you can start configuring the DSNs as well as everything you need. More on this can be found in Sentry Detailed Documentation.

sentry-config-2

Concluding Remarks

Well, we managed to install Sentry and we hope the guide was as informative as possible. Sentry runs a clud version of the same service and you can subscribe to their service in case you would like to avoid the operations side of maintaining an on prem or self hosted server.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.