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.
Dokku is the smallest PaaS implementation you've ever seen - Docker powered mini-Heroku.
- A working Dokku host
- PostgreSQL and Redis plugins for Dokku
- Letsencrypt plugin for SSL (optionnal)
Note: We are going to use the domain sentry.example.com for demonstration
purposes. Make sure to replace it to your domain name.
Log onto your Dokku Host to create the Sentry app:
dokku apps:create sentryInstall, 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 sentrydokku config:set sentry SECRET_KEY=$(echo `openssl rand -base64 45` | tr -d \=+ | cut -c 1-32)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/filesTo get the routing working, we need to apply a few settings. First we set the domain.
dokku domains:set sentry sentry.example.comThe 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:9000Then, remove the proxy mapping added by Dokku.
dokku proxy:ports-remove sentry http:80:5000If dokku proxy:report sentry shows more than one port mapping, remove all port mappings except the added above.
First clone this repository onto your machine.
git clone git@github.com:D1ceWard/sentry_on_dokku.gitgit clone https://github.com/D1ceWard/sentry_on_dokku.gitNow you need to set up your Dokku server as a remote.
git remote add dokku dokku@example.com:sentryNow we can push Sentry to Dokku (before moving on to the next part).
git push dokku masterTo 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.
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 sentryYour Sentry instance should now be available on https://sentry.example.com.
