Relases + Docker + Fabric + Git

Ok, the title is not explicative but match quite well with Google.
We ( switched from the old but dismissed OpBeat to . Although functionalities are similar, the setup is not so straightforward as it was in OpBeat, and the docs miss useful script such as the one of fabric.
Here I will show you how I created a Fabric script to tag version in GIT (git tag) and use it to create Releases in Sentry and also connect it to the git commit. Everything integrated with Django and Docker (if you use Docker you can’t rely on the “revision” 'release': raven.fetch_git_sha(os.path.abspath(os.pardir) since the docker will not have the folder.git.

First, in Fabric, I created a function to add a new tag for every release. The version number are of this format X.Y , every release on test increases Y, thus 0.1, 0.2, 0.3; releases in production increases X and reset Y, thus: 0.3->1.0->2.0 etc

I then modified the settings of Raven to get the version from the environment file. I also created a function for fabric to update the value in the file.env.

In this way Sentry automatically gets the version when deployed, the version is the same as the Git tag.

Last, I’ve added the call to bind to the release the git commits. This is not too clear from the documentation.

You have to change the value accordingly to your setup.

  • YOUR_ORGANIZATION is in the Organization settings, the first value
  • SENTRY_AUTH (which is load from the env) is the auth created from here
  • YOUR_REPOSITORY is under organization -> repositories<your_organization>/repos/ copy the title.
  • YOUT_PROJECT is the project name.

Now, when I release the code I do (among many other things such as committing to git and building docker):

  • tag the deployment
  • update the .env file and the release with the tag from above
  • bind the commits to the release


This took me a couple of hours to figure it out. OpBeat used to have a single fabric script that handled everything and a easier integration with Git Repo. Now I achieved pretty much the same with sentry


That’s all folks