How to Install Sentry with Docker on Ubuntu 22.04

How to Install Sentry with Docker on Ubuntu 22.04

Are you looking for a tutorial on how to install Sentry with Docker on Ubuntu 22.04? Then this guide is for you.

Sentry is a free and open-source performance monitoring software that helps developers diagnose, fix, and optimize the performance of their code. With support for over 30 programming languages and integration with many useful tools, Sentry allows developers to track and solve errors quickly. You can find them on GitHub.

In this tutorial, we will install and set up Sentry using Docker. Let’s get started!

Prerequisites

Before starting the tutorial, you will need to fulfill these requirements:

  • A server with Ubuntu 22.04 installed
  • Root user or Sudo privileges
  • Valid domain name
  • Root password configured for your server

How to Install Sentry with Docker on Ubuntu 22.04

We will go through the guide step by step so that you can follow it easily. Each step deals with a different section of the installation. Let’s go one by one.

Install Required Dependencies

Before installing new apps on Linux, it’s a good practice to update your system. So we will do that first. Update and upgrade the system with the following commands:

$ sudo apt update -y
$ sudo apt upgrade -y

Output:

sudo apt update
sudo apt upgrade

After the update is completed, you must install some dependencies to install Sentry. You can install all required packages with this command:

$ sudo apt-get install curl git build-essential apt-transport-https ca-certificates software-properties-common -y 

Output:

install required packages for sentry

In our case, all the packages were previously installed, so nothing new was installed. But that may not be the case for you. So wait for the installations to finish.

Install Docker and Docker Compose

After installing the required dependencies, we will install Docker and Docker Compose. Since they are not in the default package list, you must manually add them.

So let’s add the Docker GPG key. To download and add the key, run this command:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Output:

download docker

Next, you need to add the Docker repository to APT sources. To do that, use this command:

$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Output:

download docker

To make the changes take effect, you have to update the source list again. You can do that with this command:

$ sudo apt update -y

Output:

sudo apt update

Now you are ready to install Docker and Docker Compose. Install both using this command:

$ sudo apt install docker docker-compose -y

Output:

install docker

It’s a bit large package, so it may take a while to download and install. To check if it has been installed correctly, you can check its version with this command:

$ docker --version

Output:

docker version

As you can see, it’s version 20.10.21, which means the installation was successful. We can also assure the installation of Docker Compose in the same way. Check its version with this command:

$ docker-compose --version

Output:

docker compose version

Once it gets installed, start the Docker service with this command:

$ systemctl start docker

Output:

start docker

You can also make it start at boot with this command:

$ systemctl enable docker

You can confirm whether it’s running by using this command:

$ systemctl status docker

Output:

docker status

Press ‘q’ to go out from that menu. We have two more things to do. Create a Docker group and add a user to it.

Create a Docker group using this command:

$ sudo groupadd docker

Output:

create docker group

Then add a user to the group by running this command:

$ sudo usermod -aG docker $USER

Output:

add user to docker group

Remember to replace $USER it with your appropriate user name. After that, log out of the system and then log back in again.

Now we can finally install Sentry. Go to the next step for that.

Install Sentry

We will download Sentry from its GitHub repository. And for that, we will use the Git tool. Download the repository with this command:

$ git clone https://github.com/getsentry/onpremise

Output:

download sentry

This downloaded a directory called ‘onpremise’. Go into the directory with this command:

$ cd onpremise

You can check all the files inside the directory with this command:

$ ls

Output:

cd into sentry repo

Notice the installation script named install.sh. We will use that to install Sentry. To do so, execute the following command:

$ sudo bash install.sh

Output:

How to Install Sentry with Docker on Ubuntu 22.04

They will collect data about OS username, IP address, install log, runtime errors, performance data, etc. In the process, you will be asked to create a user account. Proceed by entering ‘y’. You will need to enter your email and a password. Then confirm the password by re-entering.

How to Install Sentry with Docker on Ubuntu 22.04

After this, the installation process should finish. You will get the following message:

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

  docker-compose up -d

You can check out the downloaded images with this command:

$ sudo docker images

Output:

docker images

Launch Sentry Container

Since we’re done installing Sentry, it’s time to run it. As they mentioned above, run it using this command:

$ sudo docker-compose up -d

Output:

How to Install Sentry with Docker on Ubuntu 22.04

When that is done, you can now start using Sentry. Let’s see how in the next step.

Access Sentry Web UI

Now that Sentry is running, you can access and configure it from a web browser. Choose your preferred browser and paste this into the search bar:

http://your-server-ip:9000 

For tutorial purposes, we’re just going to run it on localhost. So we will use this URL instead:

http://localhost:9000

Since Sentry is listening to port 9000, we use that to access the web page. If all went well, you should see the above screen:

sentry web app

Login using the email and password you entered during installation. After a successful login, you are brought to the welcome page where you can start configuring Sentry. Settings include Root URL, Admin Email, SMTP Port, Username, Password, Authentication settings, and more.

sentry web app

After configuring, you will be brought to the dashboard.

sentry web app

Start using Sentry for your work.

Final Thoughts

This tutorial teaches you how to install Sentry with Docker on Ubuntu 22.04. We’ve covered everything you need to know to install and configure Sentry. If you feel stuck somewhere, let us know in the comments below.

If this guide helped you, please share it.

Related Posts