This article is outdated and may not work correctly for current operating systems or software.
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.
A newly deployed Vultr instance running Ubuntu 16.04.
A sudo user.
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
.