diff options
author | Benjamin A. Shelton | 2015-06-10 14:14:05 -0600 |
---|---|---|
committer | Benjamin A. Shelton | 2015-06-10 14:14:05 -0600 |
commit | cc5c8e769a2425eeb76e6240f3139e967dc0cbe7 (patch) | |
tree | 8be5228836501810178bc1bcd4ef5554cc41e2e1 | |
download | aur-cc5c8e769a2425eeb76e6240f3139e967dc0cbe7.tar.gz |
Initial commit of Sentry sources.
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | PKGBUILD | 65 | ||||
-rw-r--r-- | sentry-celery.service | 12 | ||||
-rw-r--r-- | sentry.install | 194 | ||||
-rw-r--r-- | sentry.service | 13 |
5 files changed, 309 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..ecd482e1218a --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = sentry + pkgdesc = Python-based realtime logging and aggregation server. + pkgver = 7.5.4 + pkgrel = 1 + url = http://pypi.python.org/pypi/sentry + install = sentry.install + arch = any + license = BSD + makedepends = python2-pip + makedepends = python2-setuptools + makedepends = python2-virtualenv + depends = python2 + depends = redis + options = !strip + source = https://pypi.python.org/packages/source/s/sentry/sentry-7.5.4.tar.gz + source = sentry.install + source = sentry.service + source = sentry-celery.service + md5sums = f68f9a17ca893a9c747f96d970449080 + md5sums = 8aab776f3d428c417f51522c256b5aeb + md5sums = 8d1d8d166a88bc89ad2265fd67ab3523 + md5sums = 78dd3e18109c2bf92f7f884de0237781 + +pkgname = sentry + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..d3308af9004c --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,65 @@ +# Maintainer: Benjamin A. Shelton <zancarius@gmail.com> +# Source: https://github.com/zancarius/archlinux-pkgbuilds + +pkgname=sentry +pkgver=7.5.4 +pkgrel=1 +pkgdesc="Python-based realtime logging and aggregation server." +arch=(any) +url="http://pypi.python.org/pypi/sentry" +license=(BSD) +depends=( + python2 + redis +) +makedepends=(python2-pip python2-setuptools python2-virtualenv) +options=(!strip) +install="${pkgname}.install" +source=( + "https://pypi.python.org/packages/source/s/${pkgname}/${pkgname}-${pkgver}.tar.gz" + "${pkgname}.install" + "sentry.service" + "sentry-celery.service" +) +md5sums=( + f68f9a17ca893a9c747f96d970449080 # sentry tarball + 8aab776f3d428c417f51522c256b5aeb # sentry.install + 8d1d8d166a88bc89ad2265fd67ab3523 # sentry.service + 78dd3e18109c2bf92f7f884de0237781 # sentry-celery.service +) + +package () { + + mkdir -p "${pkgdir}/opt/sentry" + virtualenv2 --python=python2.7 "${pkgdir}/opt/sentry" + + source "${pkgdir}/opt/sentry/bin/activate" + + # Workaround for circumstances where cssutils may not be installed + # into the virtualenv at the correct version. + "${pkgdir}/opt/sentry/bin/pip" install "cssutils>=0.9.9,<0.10.0" + + # Recent versions of Sentry rely on pytest to be installed as part + # of the package dependencies. Unfortunately, it doesn't install + # correctly inside a virtualenv. Preload it here. + "${pkgdir}/opt/sentry/bin/pip" install "pytest" + + cd "${srcdir}/${pkgname}-${pkgver}" + "${pkgdir}/opt/sentry/bin/python2" setup.py install --optimize=1 + + virtualenv2 --relocatable "${pkgdir}/opt/sentry" + sed -i "s#${pkgdir}##" "${pkgdir}/opt/sentry/bin/activate" + + mkdir -p "${pkgdir}/opt/sentry/.python-eggs" + mkdir -p "${pkgdir}/etc/sentry" + + # Remove Desktop Services Store from package. At least one of these files + # still persists in the Sentry package. They're harmless, but I don't like + # them. :) More information: http://en.wikipedia.org/wiki/.DS_Store + find "${pkgdir}" -name '.DS_Store' -delete + + install -Dm0644 "${srcdir}/${pkgname}-${pkgver}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -Dm0644 "${srcdir}/sentry.service" "${pkgdir}/usr/lib/systemd/system/sentry.service" + install -Dm0644 "${srcdir}/sentry-celery.service" "${pkgdir}/usr/lib/systemd/system/sentry-celery.service" + +} diff --git a/sentry-celery.service b/sentry-celery.service new file mode 100644 index 000000000000..6723a2243be5 --- /dev/null +++ b/sentry-celery.service @@ -0,0 +1,12 @@ +[Unit] +Description=Sentry's task queue provider. +After=network.target + +[Service] +User=sentry +Restart=always +Environment=PATH=/opt/sentry/bin +ExecStart=/opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py celery worker --loglevel=ERROR -B -s /opt/sentry/celery/celerybeat-schedule + +[Install] +WantedBy=multi-user.target
\ No newline at end of file diff --git a/sentry.install b/sentry.install new file mode 100644 index 000000000000..85278f52bc6f --- /dev/null +++ b/sentry.install @@ -0,0 +1,194 @@ +post_install(){ + + /usr/sbin/useradd -s /bin/false -d /opt/sentry -r sentry + + /usr/bin/chown -R root:root /opt/sentry + /usr/bin/chown -R sentry:sentry /opt/sentry/.python-eggs + /usr/bin/chown -R sentry:sentry /etc/sentry + /usr/bin/chown root:root /etc/sentry + + # Storage location for Celery's database. + /usr/bin/mkdir -p /opt/sentry/celery + /usr/bin/chown sentry:sentry /opt/sentry/celery + + # Generate a new configuration. + if [ ! -e "/etc/sentry/sentry.conf.py" ] ; then + "/opt/sentry/bin/sentry" init "/etc/sentry/sentry.conf.py" + fi + + /usr/bin/chmod 0600 /etc/sentry/sentry.conf.py + +cat << EOF + + +INSTALLING OR UPGRADING + +IF YOU'RE INSTALLING OR UPGRADING SENTRY, you will need to issue the following +command before starting the server: + + sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\ + /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py upgrade + +Be sure to edit the configuration file "/etc/sentry/sentry.conf.py" first! + +If you're upgrading Sentry, sometimes it may be necessary to run: + + sudo systemctl --system daemon-reload + +!!! BACK-UP YOUR SENTRY DATABASE BEFORE UPGRADING !!! + +RUNNING + +If you're starting Sentry for the first time, you'll may want to create at +least one administrative account. To do so, run the createuser utility: + + sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\ + /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py createuser + +and create a "superuser" when prompted. + +To start sentry, simply run the service (sentry-celery, required by sentry, +will be started automatically): + + sudo systemctl start sentry + +To run Sentry without systemd, such as to test your configuration, use: + + sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\ + --config=/etc/sentry/sentry.conf.py start + +EXTRAS + +Neither MySQL nor PostgreSQL support is installed into the Python virtualenv +when building from the PKGBUILD. If you require either of these, you will +need to install them manually (but don't forget to change your configuration +file, /etc/sentry/sentry.conf.py to match!): + + # MySQL + sudo -u sentry -- /usr/bin/bash -c \\ + 'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install mysql-python' + + # PostgreSQL + sudo -u sentry -- /usr/bin/bash -c \\ + 'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install psycopg2' + +If you need additional Sentry plugins, you'll need to use Sentry's local copy +of pip to install them in a manner similar to the one outlined above. + +I appreciate the tips and suggestions I've received since converting this +package to a (mostly) pure virtualenv installation. Please report any issues +related to the PKGBUILD on the AUR page or open a ticket on my Github +project page: + +https://aur.archlinux.org/packages/sentry/ +https://github.com/zancarius/archlinux-pkgbuilds + +REMOVAL + +As of Sentry 7.1.4, this package will no longer remove the Sentry user by +default. You must perform this step manually. + +EOF +} + +post_upgrade(){ + + /usr/bin/chown -R root:root /opt/sentry + /usr/bin/chown -R sentry:sentry /etc/sentry + /usr/bin/chown -R sentry:sentry /opt/sentry/.python-eggs + /usr/bin/chown root:root /etc/sentry + + # Storage location for Celery's database. + /usr/bin/mkdir -p /opt/sentry/celery + /usr/bin/chown sentry:sentry /opt/sentry/celery + + /usr/bin/chmod 0600 /etc/sentry/sentry.conf.py + +cat << EOF + +UPGRADING - READ THIS FIRST + +If you're upgrading Sentry from any prior version, you will first need to +stop the Sentry service and then reload systemd (sentry-celery first appeared +in the Sentry 7.1.4 PKGBUILD; if you're upgrading from previous versions, omit +it from these steps): + + sudo systemctl stop sentry sentry-celery + sudo systemctl --system daemon-reload + +to ensure that the new systemd service file has been installed. + +You will also need to upgrade your database schema. To do so, copy and paste +the following command (WITHOUT Sentry running): + + sudo -u sentry PATH=/opt/sentry/bin:\$PATH \\ + /opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py upgrade + +You may need to run this command if you're creating a new installation or +migrating database servers. Sentry will usually check migrations prior to +starting, but ideally this step should be performed separately. + +Between major (and sometimes minor) version bumps, Sentry's configuration has +a habit of changing, often introducing new options without which Sentry will +not launch. As of the Sentry 7.1.4-2 PKGBUILD, Sentry's configuration is +generated during installation only. You will need to regenerate the +configuration and check the changes by hand (vimdiff is useful here): + + sudo -u sentry /opt/sentry/bin/sentry init /etc/sentry/sentry.conf.new.py + +!!! ALWAYS BACK-UP YOUR DATABASE PRIOR TO UPGRADING SENTRY !!! + +WARNINGS + +If you have upgraded to Pacman 4.2 or later, Sentry's installation process +will generate a large number of permissions- and ownership-related warnings. +Ignore these. Following Sentry 7.1.4, this package will now correct the +ownership so subsequent installs will no longer complain. + +If something happens and Sentry will not run, make sure that 1) you've +migrated your database schema via Sentry's upgrade process (above) and 2) +the contents of the /etc/sentry directory are owned by the sentry user. +Other directories that may need permission tweaks include +/opt/sentry/.python-eggs and /opt/sentry/celery. + +EXTRAS + +Neither MySQL nor PostgreSQL support is installed into the Python virtualenv +when building from the PKGBUILD. If you require either of these, you will +need to install them manually (but don't forget to change your configuration +file, /etc/sentry/sentry.conf.py to match!): + + # MySQL + sudo -u sentry -- /usr/bin/bash -c \\ + 'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install mysql-python' + + # PostgreSQL + sudo -u sentry -- /usr/bin/bash -c \\ + 'source /opt/sentry/bin/activate && /opt/sentry/bin/pip install psycopg2' + +If you need additional Sentry plugins, you'll need to use Sentry's local copy +of pip to install them in a manner similar to the one outlined above. + +The Celery backend and task queue is now installed as a separate service +and is no longer managed by Sentry. This is started via the sentry-celery +systemd service and requires some configuration before it will work. For a +basic setup to get started quickly, you'll need to uncomment the variables +CELERY_ALWAYS_EAGER and BROKER_URL in /etc/sentry/sentry.conf.py. This also +implies that Sentry now REQUIRES Redis as a dependency. + +I appreciate the tips and suggestions I've received since converting this +package to a (mostly) pure virtualenv installation. Please report any issues +related to the PKGBUILD on the AUR page or open a ticket on my Github +project page: + +https://aur.archlinux.org/packages/sentry/ +https://github.com/zancarius/archlinux-pkgbuilds + +REMOVAL + +As of Sentry 7.1.4, this package will no longer remove the Sentry user by +default. You must perform this step manually. + +EOF + +}
\ No newline at end of file diff --git a/sentry.service b/sentry.service new file mode 100644 index 000000000000..b54b42628ff7 --- /dev/null +++ b/sentry.service @@ -0,0 +1,13 @@ +[Unit] +Description=Sentry +After=network.target +Requires=sentry-celery.service + +[Service] +User=sentry +Restart=always +Environment=PATH=/opt/sentry/bin +ExecStart=/opt/sentry/bin/sentry --config=/etc/sentry/sentry.conf.py start + +[Install] +WantedBy=multi-user.target |