{"id":15009027,"url":"https://github.com/mam-dev/debianized-sentry","last_synced_at":"2025-04-09T16:23:31.883Z","repository":{"id":62567246,"uuid":"81579802","full_name":"mam-dev/debianized-sentry","owner":"mam-dev","description":":package: Debian packaging for Sentry, a modern realtime error logging and aggregation platform.","archived":false,"fork":false,"pushed_at":"2020-03-02T15:38:55.000Z","size":244,"stargazers_count":25,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-23T18:39:18.892Z","etag":null,"topics":["debian-packages","deployment","devops","dh-virtualenv","omnibus-packages","python-2","sentry"],"latest_commit_sha":null,"homepage":"https://sentry.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mam-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-10T15:44:44.000Z","updated_at":"2024-07-02T11:02:37.000Z","dependencies_parsed_at":"2022-11-03T17:00:42.733Z","dependency_job_id":null,"html_url":"https://github.com/mam-dev/debianized-sentry","commit_stats":null,"previous_names":["1and1/debianized-sentry"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mam-dev%2Fdebianized-sentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mam-dev%2Fdebianized-sentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mam-dev%2Fdebianized-sentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mam-dev%2Fdebianized-sentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mam-dev","download_url":"https://codeload.github.com/mam-dev/debianized-sentry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065865,"owners_count":21041982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debian-packages","deployment","devops","dh-virtualenv","omnibus-packages","python-2","sentry"],"created_at":"2024-09-24T19:22:30.221Z","updated_at":"2025-04-09T16:23:31.865Z","avatar_url":"https://github.com/mam-dev.png","language":"Python","readme":"# \"sentry.io\" Debian Packaging\n\n![BSD 3-clause licensed](https://img.shields.io/badge/license-BSD_3--clause-red.svg)\n[![debianized-sentry](https://img.shields.io/pypi/v/debianized-sentry.svg)](https://pypi.python.org/pypi/debianized-sentry/)\n[![sentry](https://img.shields.io/pypi/v/sentry.svg)](https://pypi.python.org/pypi/sentry/)\n\n:mag_right: Building the package was tested on *Ubuntu Xenial* and *Debian Jessie*, runtime tests were done on *Jessie*.\n\n**Contents**\n\n * [What is this?](#what-is-this)\n * [How to build and install the package](#how-to-build-and-install-the-package)\n * [Trouble-Shooting](#trouble-shooting)\n   * ['pkg-resources not found' or similar during virtualenv creation](#pkg-resources-not-found-or-similar-during-virtualenv-creation)\n   * ['no such option: --no-binary' during package builds](#no-such-option---no-binary-during-package-builds)\n * [How to set up a simple \"sentry\" instance](#how-to-set-up-a-simple-sentry-instance)\n   * [Basic Configuration](#basic-configuration)\n   * [Database Setup](#database-setup)\n   * [Starting Services](#starting-services)\n   * [Upgrades and Auto-Migration](#upgrades-and-auto-migration)\n   * [Changing the Service Unit Configuration](#changing-the-service-unit-configuration)\n * [Configuration Files](#configuration-files)\n * [Data Directories](#data-directories)\n * [Release Notes](#release-notes)\n   * [Release 9.0.0 (rc1)](#release-900-rc1)\n * [References](#references)\n   * [Related Projects](#related-projects)\n   * [Plugin Projects](#plugin-projects)\n\n\n## What is this?\n\nWhile the [officially preferred way](https://github.com/getsentry/onpremise)\nto install *Sentry* is via the project's Docker images by now,\nthere are still enough situations where you want to use a\n[classic host-centric installation method](https://docs.sentry.io/server/installation/python/).\nThis project helps with that on Debian-like targets,\nby providing DEB packaging for the server component.\nThis makes life-cycle management on production hosts a lot easier, and\n[avoids common drawbacks](https://nylas.com/blog/packaging-deploying-python/) of ‘from source’ installs,\nlike needing build tools and direct internet access in production environments.\n\n\u003e **A typical on-premise deployment with application data pushed from the Internet**\n\u003e ![Sentry.io On-Premise Deployment Overview](https://raw.githubusercontent.com/1and1/debianized-sentry/master/docs/_static/img/sentry-deploy-800px.png)\n\nThe Debian packaging metadata in\n[debian](https://github.com/1and1/debianized-sentry/tree/master/debian)\nputs the `sentry` Python package and its dependencies as released on PyPI into a DEB package,\nusing [dh-virtualenv](https://github.com/spotify/dh-virtualenv).\nThe resulting *omnibus package* is thus easily installed to and removed from a machine,\nbut is not a ‘normal’ Debian `python-*` package. If you want that, look elsewhere.\n\nThe final package includes the official ``sentry-plugins``,\nsee ``install_requires`` in ``setup.py`` for others that are added by default.\nThis is also the place where you can put in your own\n– only use versioned dependencies so package builds are reproducible.\n\n\n## How to build and install the package\n\n### Building in a Docker container\n\nThe easiest way to build the package is using the provided ``Dockerfile.build``.\nThen you do not need to install tooling and build dependencies on your machine,\nand the package gets built in a pristine environment.\nThe only thing you need on your workstatioon is a ``docker-ce`` installation of version 17.06 or higher\n(either on [Debian](https://docs.docker.com/install/linux/docker-ce/debian/)\nor on [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/)).\n\nCall ``./build.sh debian:buster`` to build the package for *Debian Buster*\n– building for *Debian Jessie*, *Debian Stretch*, and *Ubuntu Bionic* (with ``./build.sh ubuntu:bionic``) is also supported.\nSee [Building Debian Packages in Docker](https://dockyard.readthedocs.io/en/latest/packaging-howto.html#dpkg-in-docker)\nfor more details.\n\nThe resulting package files are placed in the ``dist/`` directory.\n\nTo test the new package quickly without any permanent changes to any system, give it a spin in an ephemeral Docker container:\n\n```sh\ndocker run -it --rm  -v $PWD/dist:/root/dist debian:buster\n\n# Then, in the container…\napt update; apt install -yyq libpq5 python2.7 libpython2.7 libxml2 libyaml-0-2 zlib1g\ndpkg -i $(ls -1 ~/dist/sentry.io_9*~buster*.deb | tail -n1)\n/usr/bin/sentry --version\n```\n\nThis makes sure the package can be installed and the Python application can be at least started.\n\n\n### Building directly on your workstation\n\nOtherwise, you need a build machine with all build dependencies installed, specifically\n[dh-virtualenv](https://github.com/spotify/dh-virtualenv) in addition to the normal Debian packaging tools.\nYou can get it from [this PPA](https://launchpad.net/~spotify-jyrki/+archive/ubuntu/dh-virtualenv),\nthe [official Ubuntu repositories](http://packages.ubuntu.com/search?keywords=dh-virtualenv),\nor [Debian packages](https://packages.debian.org/source/sid/dh-virtualenv).\n\nThis code requires and is tested with ``dh-virtualenv`` v1.0\n– depending on your platform you might get an older version via the standard packages.\nOn *Jessie*, install it from ``jessie-backports``.\n*Zesty* provides a package for Ubuntu that works on older releases too,\nsee *“Extra steps on Ubuntu”* below for how to use it.\nIn all other cases build *v1.0* from source,\nsee the [dh-virtualenv documentation](https://dh-virtualenv.readthedocs.io/en/latest/tutorial.html#step-1-install-dh-virtualenv) for that.\n\nWith tooling installed,\nthe following commands will install a *release* version of `sentry` into `/opt/venvs/sentry/`,\nand place a symlink for `sentry` into the machine's PATH.\n\n```sh\ngit clone https://github.com/1and1/debianized-sentry.git\ncd debianized-sentry/\n# or \"pip download --no-deps --no-binary :all: debianized-sentry\" and unpack the archive\n\nsudo apt-get install build-essential debhelper devscripts equivs\n\n# Extra steps on Jessie\necho \"deb http://ftp.debian.org/debian jessie-backports main\" \\\n    | sudo tee /etc/apt/sources.list.d/jessie-backports.list \u003e/dev/null\nsudo apt-get update -qq\nsudo apt-get install -t jessie-backports cmake dh-virtualenv\n# END jessie\n\n# Extra steps on Ubuntu\n( cd /tmp \u0026\u0026 curl -LO \"http://mirrors.kernel.org/ubuntu/pool/universe/d/dh-virtualenv/dh-virtualenv_1.0-1_all.deb\" )\nsudo dpkg -i /tmp/dh-virtualenv_1.0-1_all.deb\n# END Ubuntu\n\nsudo mk-build-deps --install debian/control\ndpkg-buildpackage -uc -us -b\ndpkg-deb -I ../sentry.io_*.deb\n```\n\nThe resulting package, if all went well, can be found in the parent of your project directory.\nYou can upload it to a Debian package repository via e.g. `dput`, see\n[here](https://github.com/jhermann/artifactory-debian#package-uploading)\nfor a hassle-free solution that works with *Artifactory* and *Bintray*.\n\nYou can also install it directly on the build machine:\n\n```sh\nsudo dpkg -i ../sentry.io_*.deb\n/usr/bin/sentry --version  # ensure it basically works\n```\n\nTo list the installed version of `sentry` and all its dependencies, call this:\n\n```sh\n/opt/venvs/sentry/bin/pip freeze | less\n```\n\n\n## Trouble-Shooting\n\n### 'pkg-resources not found' or similar during virtualenv creation\n\nIf you get errors regarding ``pkg-resources`` during the virtualenv creation,\nupdate your build machine's ``pip`` and ``virtualenv``.\nThe versions on many distros are just too old to handle current infrastructure (especially PyPI).\n\nThis is the one exception to “never sudo pip”, so go ahead and do this:\n\n```sh\nsudo pip install -U pip virtualenv\n```\n\nThen try building the package again.\n\n\n### 'no such option: --no-binary' during package builds\n\nThis package needs a reasonably recent `pip` for building.\nOn `Debian Jessie`, for the internal `pip` upgrade to work,\nthat means you need a newer `pip` on the system,\nor else at least `dh-virtualenv 1.1` installed (as of this writing, that is *git HEAD*).\n\nTo upgrade `pip` (which makes sense anyway, version 1.5.6 is ancient), call ``sudo pip install -U pip``.\n\nAnd to get `dh-virtualenv 1.1` right now on `Jessie`, you need to apply this patch *before* building it:\n\n```diff\n--- a/debian/changelog\n+++ b/debian/changelog\n@@ -1,3 +1,9 @@\n+dh-virtualenv (1.1-1~~dev1) unstable; urgency=medium\n+\n+  * Non-maintainer upload.\n+\n+ -- Juergen Hermann \u003cjh@web.de\u003e  Wed, 20 Jun 2018 10:22:32 +0000\n+\n dh-virtualenv (1.0-1) unstable; urgency=medium\n\n   * New upstream release\n--- a/debian/rules\n+++ b/debian/rules\n@@ -1,7 +1,7 @@\n #!/usr/bin/make -f\n\n %:\n-       dh $@ --with python2 --with sphinxdoc\n+       dh $@ --with python2\n\n override_dh_auto_clean:\n        rm -rf doc/_build\n@@ -13,6 +13,3 @@ override_dh_auto_build:\n        rst2man doc/dh_virtualenv.1.rst \u003e doc/dh_virtualenv.1\n        dh_auto_build\n\n-override_dh_installdocs:\n-       python setup.py build_sphinx\n-       dh_installdocs doc/_build/html\n\n--- a/setup.py\n+++ b/setup.py\n@@ -25,7 +25,7 @@ from setuptools import setup\n\n project = dict(\n     name='dh_virtualenv',\n-    version='1.0',\n+    version='1.1.dev1',\n     author=u'Jyrki Pulliainen',\n     author_email='jyrki@spotify.com',\n     url='https://github.com/spotify/dh-virtualenv',\n```\n\nSee [this ticket](https://github.com/spotify/dh-virtualenv/issues/234) for details,\nand hopefully for a resolution at the time you read this.\n\n\n## How to set up a simple \"sentry\" instance\n\nAfter installing the package, follow the steps in\n[Installation with Python](https://docs.sentry.io/server/installation/python/#initializing-the-configuration),\ntaking into account the differences as outlined below.\n\n\n### Basic Configuration\n\nIn case you want to test the setup procedure in a Docker container,\nstart one using ``docker run --rm -it -v $PWD/..:/data debian:8 bash``\nand then execute these commands:\n\n```sh\nPKG=$(ls -rt1 /data/sentry.io_*~buster_amd64.deb | tail -n1)\napt-get update\napt-get install sudo $(dpkg -I $PKG | egrep Depends: | cut -f2- -d: | sed -re 's/\\([^)]+\\),?|,//g')\ndpkg -i $PKG\n```\n\nNote that this assumes you built the ``sentry.io`` binary package before that,\nand called ``docker`` from the workdir of this project (otherwise adapt the volume mapping).\n\nFor a simple experimental installation on a single host or in Docker,\nalso install these additional packages for related services:\n\n```sh\nsudo apt-get install redis-server postgresql postgresql-contrib\n```\n\nIn the configuration, you need to at least generate a unique secret key, like this:\n\n```sh\nnew_key=$(sentry config generate-secret-key | sed -e 's/[\\/\u0026]/\\\\\u0026/g')\nsed -i -re \"s/^system.secret-key:.+\\$/system.secret-key: '$new_key'/\" /etc/sentry/config.yml\nunset new_key\n```\n\nIf you use a fresh configuration set as produced by ``sentry init /etc/sentry``,\ne.g. in your configuration management,\nbe sure to diff against the files in ``etc`` to make sure you don't lose\nchanges like the correct filestore location.\n\n\n### Database Setup\n\nTo set up the *PostgreSQL* database, execute these commands in a ``root`` shell:\n\n```sh\n# Create DB user \u0026 schema\ncd /tmp\nsudo -u postgres -- createuser sentry --pwprompt\nsudo -u postgres -- createdb -E utf-8 sentry\necho \"GRANT ALL PRIVILEGES ON DATABASE sentry TO sentry;\" \\\n    | sudo -u postgres -- psql -d template1\necho \"ALTER ROLE sentry superuser;\" \\\n    | sudo -u postgres -- psql -d template1\n\n# Now change \"PASSWORD\" to the one you entered when creating the 'sentry' DB user!\n${EDITOR:-vi} /etc/sentry/sentry.conf.py\n\n# Create tables\nsudo -u sentry SENTRY_CONF=/etc/sentry sentry upgrade\n# After a while, you'll be prompted to create an initial Sentry user, say 'Y'es…\n#   Would you like to create a user account now? [Y/n]:\n#\n# Make this user a super user (admin), there is a prompt for that too.\n\n# Revoke temp. superuser privileges\necho \"ALTER ROLE sentry nosuperuser;\" \\\n    | sudo -u postgres -- psql -d template1\n```\nSee getsentry/sentry#6098 for details regarding the temporary superuser privileges.\n\n\n### Starting Services\n\nRegarding services, you can ignore the *“Starting …”* as well as the *“Running Sentry as a Service”* sections\nof Sentry.io's ‘on premise’ instructions.\nThe package already contains the necessary ``systemd`` units, and starting all services is done via ``systemctl``:\n\n```sh\n# sentry-web requires sentry-worker and sentry-cron,\n# so there is no need to start / enable them separately\nsudo systemctl enable sentry-web\nsudo systemctl start sentry-web\n\n# This should show 3 services in state \"active (running)\"\nsystemctl status 'sentry-*' | grep -B2 Active:\n```\n\nThe web interface should now be reachable on port 9000\n– consider putting a reverse proxy before the *uWSGI* server,\nas mentioned in the *Sentry* documentation.\n\nAll *Sentry* services run as ``sentry.daemon``.\nNote that the ``sentry`` user is not removed when purging the package,\nbut the ``/var/{log,opt}/sentry`` directories and the configuration files are.\n\n\n### Upgrades and Auto-Migration\n\nAfter an upgrade, the services do **not** restart automatically by default,\nto give you a chance to run the DB migration manually,\nand then restart them yourself.\nThat means you should pin the version of the ``sentry`` package,\nbe it on the production hosts or in your configuration management\n(i.e. do *not* use ``latest``).\n\nIf on the other hand you set ``SENTRY_AUTO_MIGRATE=true`` in ``/etc/default/sentry``,\nthen during package configuration the migration is performed.\nIf it is successful, the services are started again.\nDetails of the migration are logged to ``/var/log/sentry/upgrade-‹version›-‹timestamp›.log``.\nTo re-try a failed migration, use ``dpkg-reconfigure sentry.io``.\n\n\n### Changing the Service Unit Configuration\n\nThe best way to change or augment the configuration of a *systemd* service\nis to use a ‘Drop-In’ file.\nFor example, to increase the limit for open file handles\nabove the system defaults, use this in a **``root``** shell:\n\n```sh\nunit=sentry-web\n\n# Change max. number of open files for ‘$unit’…\nmkdir -p /etc/systemd/system/$unit.service.d\ncat \u003e/etc/systemd/system/$unit.service.d/limits.conf \u003c\u003c'EOF'\n[Service]\nLimitNOFILE=8192\nEOF\n\nsystemctl daemon-reload\nsystemctl restart $unit\n\n# Check that the changes are effective…\nsystemctl cat $unit\nlet $(systemctl show $unit -p MainPID)\ncat \"/proc/$MainPID/limits\" | egrep 'Limit|files'\n```\n\n\n## Configuration Files\n\n * ``/etc/default/sentry`` – Operational parameters like data retention and global log levels.\n * ``/etc/sentry/config.yml`` – The Sentry YAML configuration (email, Redis, storage).\n * ``/etc/sentry/sentry.conf.py`` – The Sentry dynamic configuration (database, and everything else).\n * ``/etc/cron.d/sentry`` – The house-keeping cron job that calls ``sentry cleanup`` each day.\n\n :information_source: Please note that the files in ``/etc/sentry`` are *not* world-readable, since they contain passwords.\n\n\n## Data Directories\n\n * ``/var/log/sentry`` – Extra log files (by the cron job).\n * ``/var/opt/sentry`` – Data files, the ``files`` subdirectory contains the default blob storage (e.g. images).\n\nYou should stick to these locations, because the maintainer scripts have special handling for them.\nIf you need to relocate, consider using symbolic links to point to the physical location.\n\n\n## Release Notes\n\n### Release 9.0.0 (rc1)\n\nGeneral notes:\n\n* The build was tested under *Xenial* so far (and only very cursory).\n* ``psycopg2`` is installed from source, because the ``manylinux1`` wheel causes problems during ELF dynamic loading / linking.\n\nIf you're upgrading to version 9, make sure you are using the right database engine setting\nin ``/etc/sentry.conf.py``:\n\n\n```py\n…\nDATABASES = {\n    'default': {\n        'ENGINE': 'sentry.db.postgres',\n…\n```\n\n\n## References\n\n### Related Projects\n\n * [getsentry](https://github.com/getsentry) – The Sentry GitHub organization.\n * [onjin/docker-sentry-with-plugins](https://github.com/onjin/docker-sentry-with-plugins) – A Docker image with some pre-installed plugins, and related docs.\n   * Based on [slafs/sentry-docker](https://github.com/slafs/sentry-docker)\n * [clarkdave/logstash-sentry.rb](https://gist.github.com/clarkdave/edaab9be9eaa9bf1ee5f) – A Logstash output plugin to feed Sentry.\n * [Sentry for JIRA](https://marketplace.atlassian.com/plugins/sentry.io.jira_ac/cloud/overview) (Cloud only)\n * [Springerle/debianized-pypi-mold](https://github.com/Springerle/debianized-pypi-mold) – Cookiecutter to create this type of project.\n * [c7n_sentry](https://github.com/capitalone/cloud-custodian/tree/master/tools/c7n_sentry) – Generic *Cloud Watch* log scanner /subscription that searches for tracebacks, extracts frames, and posts them to Sentry.\n\n\n### Plugin Projects\n\n| Project | Version | Description |\n|:---|:---|:---|\n| [getsentry/sentry-plugins](https://github.com/getsentry/sentry-plugins#sentry-plugins) | [![sentry-plugins](https://img.shields.io/pypi/v/sentry-plugins.svg)](https://pypi.python.org/pypi/sentry-plugins/) | Official plugins by Sentry, includes GitHub and HipChat ones. |\n| [Banno/getsentry-ldap-auth](https://github.com/Banno/getsentry-ldap-auth) | [![sentry-ldap-auth](https://img.shields.io/pypi/v/sentry-ldap-auth.svg)](https://pypi.python.org/pypi/sentry-ldap-auth/) | Use LDAP as an authentication source. |\n| [Banno/getsentry-kafka](https://github.com/Banno/getsentry-kafka) | [![sentry-kafka](https://img.shields.io/pypi/v/sentry-kafka.svg)](https://pypi.python.org/pypi/sentry-kafka/) | Push events into Kafka topics. |\n| [simonpercivall/sentry-mailagain](https://github.com/simonpercivall/sentry-mailagain/) | [![](https://img.shields.io/pypi/v/sentry-mailagain.svg)](https://pypi.python.org/pypi/sentry-mailagain/) | Resend the mail notification on receiving new events in an unresolved group. |\n| [andialbrecht/sentry-responsible](https://github.com/andialbrecht/sentry-responsible) | [![](https://img.shields.io/pypi/v/sentry-responsible.svg)](https://pypi.python.org/pypi/sentry-responsible/) | This extension adds a widget on the sidebar of a event page to mark team members as being responsible for a event. |\n| [dmclain/sentry-export](https://github.com/dmclain/sentry-export) | [![](https://img.shields.io/pypi/v/sentry-export.svg)](https://pypi.python.org/pypi/sentry-export/) | Allow developers to export event data in self-service. |\n| [yoshiori/sentry-notify-github-issues](https://github.com/yoshiori/sentry-notify-github-issues) | [![sentry-notify-github-issues](https://img.shields.io/pypi/v/sentry-notify-github-issues.svg)](https://pypi.python.org/pypi/sentry-notify-github-issues/) | A notification plugin for GitHub issues. |\n| [gisce/sentry-irc](https://github.com/gisce/sentry-irc) | [![](https://img.shields.io/pypi/v/sentry-irc.svg)](https://pypi.python.org/pypi/sentry-irc/) | Send notifications to IRC channels. |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmam-dev%2Fdebianized-sentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmam-dev%2Fdebianized-sentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmam-dev%2Fdebianized-sentry/lists"}