Installing Sentry in Docker

Sentry is an open source project that lets you log errors raised by your applications into central service where they can be analyzed. Sentry supports a plethora of programming languages including C# and JavaScript. While i am not going to focus on how to implement Sentry logging in your applications, i wanted to do a quick post on how to set up the server side component. Specifically, i needed to get it hosted in a Docker container, which i could put on an Ubuntu server running on Azure

Since i had only recently provisioned the virtual machine, the first thing i
needed to do was set up Docker. Since i was already on Ubuntu 15.10 there wasn't much that needed to be done.

  • Download the keys using apt-key
  • Update the apt sources to include the Docker repository
  • Update my apt package cache
  • Install the Docker engine

The above can be achieved by opening a terminal and executing the following commands

Once Docker is up and running, we can start configuring Sentry. Sentry has a few dependencies, so the first thing we need to do is set up a Redis container.

Next up, we need to set up a database. While Sentry supports a number of databases, the documentation recommended PostgreSQL, so i just stuck with that. Since we are using Docker we need to create a container for that as well.

Once that is done, we can start up the Sentry conatiner and then use the sentry upgrade command to scaffold the database.

Finally, we can start up the celery workers required by Sentry.

You should now be able to browse to the IP of your Sentry host on port 8080, and everything should be running smoothly. However, at this point i wanted to make the website available on port 80, because i was using Azure, all i needed to do was map incoming connections on port 80 to virtual machine on port 8080.

You should now be able to navigate to your site without specifying a port.

Without Docker, setting up Sentry would have proved pretty difficult for anyone with little Linux experience. This is mostly due to the fact that both Redis and PostgreSQL require lots of configuration, and are not simple apt-get installs.

In summary, Dockerize all the things.

comments powered by Disqus