Learn How To Setup Sentry via Docker on Ubuntu 16.04
Table of Contents
If you are using a different system, please check our other tutorials.
Introduction
Sentry is an open source solution for error tracking. Sentry tracks exceptions and other useful messages from applications that would traditionally be written to log files, and instead utilizes a user-friendly interface.
Prerequisites
- A newly deployed IT Web Services instance running Ubuntu 16.04.
https://www.itweb.services/tutorials/linux-guides/setup-a-non-root-user-with-sudo-access-on-ubuntu”>sudo user.
https://www.itweb.services/tutorials/linux-guides/installing-docker-ce-on-ubuntu-16-04″>Docker CE installed.
Installation
Update the package index list:
sudo apt-get update
Install the development tools package:
sudo apt-get install build-essential -y
Clone getsentry/onpremise from source:
git clone https://github.com/getsentry/onpremise
Enter the onpremise
folder and build a local custom image:
cd ~/onpremise
sudo make build
Create a script called sentry_services.sh
:
sudo nano sentry_services.sh
Add the following terminal commands to the sentry_services.sh
script file:
#! /bin/bash
clear
sudo docker run
--detach
--name sentry-redis
redis:3.2-alpine
sudo docker run
--detach
--name sentry-postgres
--env POSTGRES_PASSWORD=secret
--env POSTGRES_USER=sentry
postgres:9.5
sudo docker run
--detach
--name sentry-smtp
tianon/exim4
sudo docker run
--rm sentry-onpremise
--help
sudo docker run
--rm sentry-onpremise
config generate-secret-key
Save and exit, then execute the script:
. sentry_services.sh
The output of the executed script will generate a key which we will have to save in an environment variable called: SENTRY_SECRET_KEY
. We also have to store this in the ~/.bashrc
file, so that if our SSH session expires and we must login again, our SENTRY_SECRET_KEY
variable always gets the same value:
echo 'export SENTRY_SECRET_KEY="_secret_key_here_"' >> ~/.bashrc
source ~/.bashrc
echo $SENTRY_SECRET_KEY
Run migrations:
sudo 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
Once the migration is completed, start the Sentry app as a web-service:
sudo docker run
--detach
--name sentry-web-01
--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
Start the background workers:
sudo docker run
--detach
--name sentry-worker-01
--link sentry-redis:redis
--link sentry-postgres:postgres
--link sentry-smtp:smtp
--env SENTRY_SECRET_KEY=${SENTRY_SECRET_KEY}
sentry-onpremise
run worker
Start the cron process:
sudo 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
Sentry is now configured and listens on port 9000
locally. Visit http://you_server_ip:9000
.
Need help?
Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!