Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

d1ceward-on-dokku/sentry_on_dokku

Repository files navigation

Sentry Dokku Maintenance

Run Sentry on Dokku

Perquisites

What is Sentry?

Sentry fundamentally is a service that helps you monitor and fix crashes in realtime. The server is in Python, but it contains a full API for sending events from any language, in any application.

What is Dokku?

Dokku is the smallest PaaS implementation you've ever seen - Docker powered mini-Heroku.

Requirements

Setup

Note: We are going to use the domain sentry.example.com for demonstration purposes. Make sure to replace it to your domain name.

App and plugins

Create the app

Log onto your Dokku Host to create the Sentry app:

dokku apps:create sentry

Add plugins

Install, create and link PostgreSQL and Redis plugins:

# Install plugins on Dokku
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
dokku plugin:install https://github.com/dokku/dokku-redis.git redis
# Create running plugins
dokku postgres:create sentry
dokku redis:create sentry
# Link plugins to the main app
dokku postgres:link sentry sentry
dokku redis:link sentry sentry

Configuration

Setting secret key

dokku config:set sentry SECRET_KEY=$(echo `openssl rand -base64 45` | tr -d \=+ | cut -c 1-32)

Persistent storage

To persists user uploads (e.g. avatars) between restarts, create a folder on the host machine and tell Dokku to mount it to the app container.

sudo mkdir -p /var/lib/dokku/data/storage/sentry
sudo chown 32768:32768 /var/lib/dokku/data/storage/sentry
dokku storage:mount sentry /var/lib/dokku/data/storage/sentry:/var/lib/sentry/files

Domain setup

To get the routing working, we need to apply a few settings. First we set the domain.

dokku domains:set sentry sentry.example.com

The parent Dockerfile, provided by the sentry project, exposes port 9000 for web requests. Dokku will set up this port for outside communication, as explained in its documentation. Because we want Sentry to be available on the default port 80 (or 443 for SSL), we need to fiddle around with the proxy settings.

First add the proxy mapping that sentry uses.

dokku proxy:ports-add sentry http:80:9000

Then, remove the proxy mapping added by Dokku.

dokku proxy:ports-remove sentry http:80:5000

If dokku proxy:report sentry shows more than one port mapping, remove all port mappings except the added above.

Push Sentry to Dokku

Grabbing the repository

First clone this repository onto your machine.

Via SSH

git clone git@github.com:D1ceWard/sentry_on_dokku.git

Via HTTPS

git clone https://github.com/D1ceWard/sentry_on_dokku.git

Set up git remote

Now you need to set up your Dokku server as a remote.

git remote add dokku dokku@example.com:sentry

Push Sentry

Now we can push Sentry to Dokku (before moving on to the next part).

git push dokku master

Create first user

To create a user run:

dokku run sentry "sentry createuser"

This will prompt you to enter an email, password and whether the user should be a superuser.

SSL certificate

Last but not least, we can go an grab the SSL certificate from Let's Encrypt.

# Install letsencrypt plugin
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git

# Set certificate contact email
dokku config:set --no-restart sentry DOKKU_LETSENCRYPT_EMAIL=you@example.com

# Generate certificate
dokku letsencrypt sentry

Wrapping up

Your Sentry instance should now be available on https://sentry.example.com.

About

Repository to run Sentry (Issue tracker) on Dokku (mini-Heroku)

Topics

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors