It turns out to be pretty simple, and I've made a git repo available to make it even easier. Just follow these steps:
- Clone my GitHub repository:
git clone https://github.com/OddBloke/heroku-sentry.git
- Generate a secret key and set it as SENTRY_KEY in sentry.conf.py. See point 11 here for a good example of how to generate a good key.
- Install the Heroku Toolbelt.
- Sign up for a Heroku account.
- Log in to your Heroku account from the CLI:
heroku login
- Navigate to your clone of the git repo and create a new Heroku app:
heroku apps:create
This command creates a heroku remote in the git repo, which we will use in a minute. - Take the URL it spits out (which will be something like http://floating-earth-1234.herokuapp.com/) and set that as SENTRY_URL_PREFIX in sentry.conf.py.
- Commit your changes:
git commit --all -m "Personalise."
- Push your repository up to Heroku:
git push heroku master
If all goes according to plan, this will cause Heroku to deploy, and you will see the output as it installs Sentry and all of its requirements. Finally, it will tell you that your app is deployed to Heroku, but we're not quite done. - We need to configure a database for Sentry to use. We're going to use the new Heroku Postgres offering, which is currently in public beta:
heroku addons:add heroku-postgresql:dev
- The previous command will have given you a database name, something like HEROKU_POSTGRESQL_CHARCOAL. Tell Heroku to use this database: heroku pg:promote HEROKU_POSTGRESQL_CHARCOAL
- Finally, we need to run the Sentry setup script, create a default user and tell Sentry to use it:
heroku run sentry --config=sentry.conf.py upgrade heroku run sentry --config=sentry.conf.py createsuperuser heroku run sentry --config=sentry.conf.py repair --owner=JustCreatedSuperuser
You should use the name of the super-user you create with the second command as the --owner argument to the third command.
Voila! You should now be able to see Sentry by pointing your browser at the URL you used for SENTRY_URL_PREFIX earlier.
If you have any problems, you can check out your logs using heroku logs.
One final note: Heroku doesn't provide SMTP for you, so you'll also have to modify the SMTP settings to point at your own mail server (or play around with the Heroku add-ons that do provide it).