Sentry is a popular error-tracking Python application that is free to install and use with the Python open-source development platform. Facing errors on the resurfacing can be alerted with the use of Sentry through SMS and email notifications. You can integrate sentry with a lot of applications such as Gitab, Bitbucket, Github,etc.
In this tutorial, we are going to explain the installation process of Sentry on Ubuntu 20.04 with docker.
Installation of Docker on Ubuntu 20.04 LTS server
Installation of sentry can be done with some of the docker commands but first, let’s run the command as shown below.
$ sudo apt update
Then also run the upgrade command as shown below.
$ sudo apt upgrade
To install sentry with docker, you must have to install docker first. Docker is easy to install with the commands as shown below.
Install the package that is required to install docker with the following command.
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Then, add the GPG key by downloading it with the following command.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Then, add the docker repository with the following command.
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" $ sudo apt-cache policy docker-ce
Now, update the repository and install Docker with the following command.
$ sudo apt update $ sudo apt install docker-ce
Start and check the status of docker with the following command.
$ sudo systemctl start docker $ sudo systemctl status docker
Confirm the installation of docker with the following command.
$ docker version
Installation of Sentry on Ubuntu 20.04 LTS server
Installation of Sentry is done with the use of sentry on-premise repo from GitHub repository. Clone the repo with the command as shown below.
$ git clone https://github.com/getsentry/onpremise.git
Go to the onpremise directory that is downloaded with the above git clone command. Navigate to onpremise directory and run command as shown below.
$ cd ~/onpremise
$ make build
Now create a bash script file for the service of the sentry. You can use the file as shown below.
$ sudo vim sentryinstall.sh
#! /bin/bash docker run --detach --name sentry-redis redis:3.2-alpine docker run --detach --name sentry-postgres --env POSTGRES_PASSWORD=secret --env POSTGRES_USER=sentry postgres:9.5 docker run --detach --name sentry-smtp tianon/exim4 docker run --rm sentry-onpremise --help docker run --rm sentry-onpremise config generate-secret-key
Save the file and give the permission for the file with the command as shown below.
$ sudo chmod +x sentryinstall.sh
Now, run the script with the command as shown below.
$ ./sentryinstall.sh
You will see a similar output with the above script.
50ckre_ba_+=qc(-sx90=2+t8#0+)y5hfl62-b4cfvzn+@hxih
Add this key in SENTRY_SECRET_KEY variable. Run the command as shown below for that purpose.
$ echo 'export SENTRY_SECRET_KEY="50ckre_ba_+=qc(-sx90=2+t8#0+)y5hfl62-b4cfvzn+@hxih"' >> ~/.bashrc $ source ~/.bashrc
Again create a script file for the migration, start of the sentry app, and so on. Create a file with the scripts as shown below.
$ sudo vim sentryconfig.sh
echo "Migration process" docker run --link sentry-redis:redis \ --link sentry-postgres:postgres \ --link sentry-smtp:smtp --env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY} \ --rm -it sentry-onpremise upgrade echo "Start the Sentry service Web" docker run \ --detach \ --name sentry-web \ --publish 9000:9000 \ --link sentry-redis:redis \ --link sentry-postgres:postgres \ --link sentry-smtp:smtp \ --env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY} sentry-onpremise run web echo "Start the Service Worker" docker run \ --detach \ --name sentry-worker\ --link sentry-redis:redis \ --link sentry-postgres:postgres \ --link sentry-smtp:smtp \ --env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY} sentry-onpremise run worker echo "Running Service CRON" docker run \ --detach \ --name sentry-cron \ --link sentry-redis:redis \ --link sentry-postgres:postgres \ --link sentry-smtp:smtp \ --env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY} sentry-onpremise run cron
Save the file and give permission for the file with the command as shown below.
$ sudo chmod +x sentryconfig.sh
Now, run the script with the command as shown below.
$ ./sentryconfig.sh
With the execution of the above script, the configuration of Sentry is quite finished and listens on port 9000. You will be asked to create a username and password while running the above script. By providing the details, you are now ready to browse the site with the url as shown below.
For further details, check the screenshot as shown below.
You can log in with the email address and password on this section. After login, you will see the dashboard as shown on the screenshot below.
Conclusion
In this article, you have learned how to install the Sentry in Ubuntu 20.04 LTS Server. We have shown the successful process of the installation of Sentry with the above steps. Thank you!