TNS
VOXPOP
Favorite Social Media Timesink
When you take a break from work, where are you going?
Instagram/Facebook
0%
Discord/Slack
0%
LinkedIn
0%
Video clips on TikTok/YouTube
0%
X, Bluesky, Mastodon et al...
0%
Web surfing
0%
I do not get distracted by petty amusements
0%
API Management / Operations

Install Sentry to Monitor Live Applications

This tutorial will cover how to install the Sentry real-time crash reporting application, in order to monitor your applications in real time.
May 13th, 2023 6:00am by
Featued image for: Install Sentry to Monitor Live Applications

If you’re a developer, you’re probably interested in keeping tabs on live applications. You might want to know when there are errors or exceptions to deal with. With the right tool, you can deploy those apps in a test environment and then keep track of the problems for easier debugging, before you use the app for your company or ship it to customers, clients, or consumers.

One tool that can be used internally is the Sentry real-time crash reporting application, which can be deployed with the help of Docker. Most developers won’t have any problem using Sentry. The basic steps are:

  • Create a target project and add the required dependencies.
  • Integrate Sentry into the application so it can capture errors in real time.
  • Generate API Keys so Sentry can connect with the running app.

How you integrate Sentry into the app will depend on the language used for the app. For example, if you’re deploying a Maven app, you could integrate it with code like this:

<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-servlet</artifactId>
<version>6.18.1</version>
</dependency>

However, before you get to that point, you must install Sentry and that’s exactly what we’re going to do here.

What You’ll Need

To install Sentry, you’ll need the following: A server that supports Docker and has a minimum of 4GB of RAM and two cores.

I deployed Sentry as a VM with those minimums and it ran just fine. You’ll also need a user with sudo privilege and an optional domain name pointing to the server (this is required if you’ll be monitoring apps outside your LAN. If you’ll only be monitoring apps within your LAN, this can be done via IP address.

I’ll demonstrate this on an instance of Ubuntu Server 22.04.

Install Docker and Docker Compose

The first thing you must do is install Docker and Docker Compose. If you’ve already taken care of this, you can skip these steps.

First, add the official Docker GPG key with the command:


Next, add the Docker repository:


Install the required dependencies with the command:


Update apt with:


Finally, we can install the latest version of the Docker CE runtime engine:


Install Docker Compose with the command:


Add your user to the docker group with:


Log out and log back in for the changes to take effect.

Install Sentry

With Docker and Docker Compose installed, you can now install Sentry. One thing to keep in mind is that the installation can take anywhere between 30 and 60 minutes (depending on the speed of your network and server.

The first step is to clone the on-premise version of Sentry with the command:


Change into the newly-created directory with:


Next, run the install script with:


The installation script will first require you to answer y or no to agree (or disagree) to the collection of data. The only information the company collects is:

  • OS username
  • IP address
  • Install logs
  • Runtime errors
  • Performance data

The next interactive step in the setup script is creating a user account. Type y for this and then type your email address. The install script will then ask you to create a password for the username but will seem like it’s paused (and doesn’t return a prompt for you to type). Go ahead and type your password and then verify it. Remember, the email address/password combination is what you’ll use to log into Sentry.

The install script will continue to run and (at least in my instance), doesn’t ever give you your prompt back. Once the installation indicates you can continue with the docker-compose command, type the following:


At this point, all of the required images will be pulled and deployed. Again, this will take some time, but it will finish by giving your prompt back.

Accessing Sentry

When the docker-compose command completes, open a web browser and point it to http://SERVER:9000 (where SERVER is either the IP address or domain of the hosting server). You’ll be greeted by the Sentry login window (Figure 1), where you’ll type the email address and password you used during the installation.

Figure 1: The Sentry login window.

In the next window (Figure 2), you can configure things like the base URL and outbound email. If you want to make any changes, do so on this page.

Figure 2: The Sentry web UI setup page.

Once you’ve taken care of the final setup, you’ll be presented with the Sentry main page (Figure 3), where you can create your first project for monitoring.

Figure 3: The Sentry web UI setup page.

Congratulations, you’re ready to monitor those apps so you can more easily debug and keep them running as expected.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Docker.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.