]> git.pld-linux.org Git - packages/carbon.git/commitdiff
new, version 0.9.10
authorElan Ruusamäe <glen@delfi.ee>
Tue, 9 Apr 2013 19:19:35 +0000 (22:19 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 9 Apr 2013 19:19:35 +0000 (22:19 +0300)
based on fedora python-carbon package
bcabd8ffaf4a6df7107e2633508fc9bec8ff3bc0

FHS.patch [new file with mode: 0644]
carbon-aggregator.init [new file with mode: 0755]
carbon-cache.init [new file with mode: 0755]
carbon-relay.init [new file with mode: 0755]
carbon.spec [new file with mode: 0644]
carbon.sysconfig [new file with mode: 0644]

diff --git a/FHS.patch b/FHS.patch
new file mode 100644 (file)
index 0000000..c92bd1c
--- /dev/null
+++ b/FHS.patch
@@ -0,0 +1,79 @@
+diff -up ./conf/carbon.conf.example.orig ./conf/carbon.conf.example
+--- ./conf/carbon.conf.example.orig    2012-05-31 15:09:32.796575476 -0600
++++ ./conf/carbon.conf.example 2012-05-31 15:10:59.641332773 -0600
+@@ -30,10 +30,17 @@
+ #
+ #LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
++STORAGE_DIR    = /var/lib/carbon/
++LOCAL_DATA_DIR = /var/lib/carbon/whisper/
++WHITELISTS_DIR = /var/lib/carbon/lists/
++CONF_DIR       = /etc/carbon/
++LOG_DIR        = /var/log/carbon/
++PID_DIR        = /var/run/
++
+ # Specify the user to drop privileges to
+ # If this is blank carbon runs as the user that invokes it
+ # This user must have write access to the local data directory
+-USER =
++USER = carbon
+ # Limit the size of the cache to avoid swapping or becoming CPU bound.
+ # Sorts and serving cache queries gets more expensive as the cache grows.
+diff -up ./setup.cfg.orig ./setup.cfg
+--- ./setup.cfg.orig   2012-05-31 15:20:40.649786911 -0600
++++ ./setup.cfg        2012-05-31 15:21:10.019706501 -0600
+@@ -1,9 +1,9 @@
+-[install]
+-prefix = /opt/graphite
+-install-lib = %(prefix)s/lib
++#[install]
++#prefix = /opt/graphite
++#install-lib = %(prefix)s/lib
+-[bdist_rpm]
+-requires = python-twisted
+-           whisper
++#[bdist_rpm]
++#requires = python-twisted
++#           whisper
+-post-install = distro/redhat/misc/postinstall
++#post-install = distro/redhat/misc/postinstall
+diff -up ./setup.py.orig ./setup.py
+--- ./setup.py.orig    2012-05-31 15:11:28.825257256 -0600
++++ ./setup.py 2012-05-31 15:29:55.807188675 -0600
+@@ -12,14 +12,20 @@ else:
+   setup_kwargs = dict()
+-storage_dirs = [ ('storage/whisper',[]), ('storage/lists',[]),
+-                 ('storage/log',[]), ('storage/rrd',[]) ]
+-conf_files = [ ('conf', glob('conf/*.example')) ]
++#storage_dirs = [ ('storage/whisper',[]), ('storage/lists',[]),
++#                 ('storage/log',[]), ('storage/rrd',[]) ]
++#conf_files = [ ('conf', glob('conf/*.example')) ]
+ #XXX Need a way to have these work for bdist_rpm but be left alone for everything else
+ #init_scripts = [ ('/etc/init.d', ['distro/redhat/init.d/carbon-cache',
+ #                                  'distro/redhat/init.d/carbon-relay',
+ #                                  'distro/redhat/init.d/carbon-aggregator']) ]
++storage_dirs = [
++    ('/var/lib/carbon/whisper',[]),
++    ('/var/lib/carbon/lists',[]),
++    ('/var/lib/carbon/rrd',[])
++]
++
+ setup(
+   name='carbon',
+   version='0.9.10',
+@@ -32,7 +38,8 @@ setup(
+   package_dir={'' : 'lib'},
+   scripts=glob('bin/*'),
+   package_data={ 'carbon' : ['*.xml'] },
+-  data_files=storage_dirs + conf_files, # + init_scripts,
++  #data_files=storage_dirs + conf_files, # + init_scripts,
++  data_files=storage_dirs,
+   install_requires=['twisted', 'txamqp'],
+   **setup_kwargs
+ )
diff --git a/carbon-aggregator.init b/carbon-aggregator.init
new file mode 100755 (executable)
index 0000000..d9fb261
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# carbon-aggregator  init file for starting up the carbon-aggregator daemon
+#
+# chkconfig:   - 20 80
+# description: Starts and stops the carbon-aggregator daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/carbon-aggregator"
+pidfile="/var/run/carbon-aggregator.pid"
+
+CONFIG="/etc/carbon/carbon.conf"
+LOG_DIR="/var/log/carbon"
+
+[ -e /etc/sysconfig/carbon ] && . /etc/sysconfig/carbon
+
+lockfile=/var/lock/subsys/carbon-aggregator
+
+start() {
+    [ -f $CONFIG ] || exit 6
+    [ -x $exec ] || exit 5
+    echo -n $"Starting `basename $exec`: "
+    daemon "$exec --config=$CONFIG --pidfile=$pidfile --logdir=$LOG_DIR start"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping `basename $exec`: "
+    killproc -p $pidfile `basename $exec`
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    stop
+    start
+}
+
+rh_status() {
+    status -p $pidfile `basename $exec`
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        $1
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
+
diff --git a/carbon-cache.init b/carbon-cache.init
new file mode 100755 (executable)
index 0000000..8f8ae82
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# carbon-cache  init file for starting up the carbon-cache daemon
+#
+# chkconfig:   - 20 80
+# description: Starts and stops the carbon-cache daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/carbon-cache"
+pidfile="/var/run/carbon-cache.pid"
+
+CONFIG="/etc/carbon/carbon.conf"
+LOG_DIR="/var/log/carbon"
+
+[ -e /etc/sysconfig/carbon ] && . /etc/sysconfig/carbon
+
+lockfile=/var/lock/subsys/carbon-cache
+
+start() {
+    [ -f $CONFIG ] || exit 6
+    [ -x $exec ] || exit 5
+    echo -n $"Starting `basename $exec`: "
+    daemon "$exec --config=$CONFIG --pidfile=$pidfile --logdir=$LOG_DIR start"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping `basename $exec`: "
+    killproc -p $pidfile `basename $exec`
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    stop
+    start
+}
+
+rh_status() {
+    status -p $pidfile `basename $exec`
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        $1
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
+
diff --git a/carbon-relay.init b/carbon-relay.init
new file mode 100755 (executable)
index 0000000..cc70749
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# carbon-relay  init file for starting up the carbon-relay daemon
+#
+# chkconfig:   - 20 80
+# description: Starts and stops the carbon-relay daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/carbon-relay"
+pidfile="/var/run/carbon-relay.pid"
+
+CONFIG="/etc/carbon/carbon.conf"
+LOG_DIR="/var/log/carbon"
+
+[ -e /etc/sysconfig/carbon ] && . /etc/sysconfig/carbon
+
+lockfile=/var/lock/subsys/carbon-relay
+
+start() {
+    [ -f $CONFIG ] || exit 6
+    [ -x $exec ] || exit 5
+    echo -n $"Starting `basename $exec`: "
+    daemon "$exec --config=$CONFIG --pidfile=$pidfile --logdir=$LOG_DIR start"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping `basename $exec`: "
+    killproc -p $pidfile `basename $exec`
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    stop
+    start
+}
+
+rh_status() {
+    status -p $pidfile `basename $exec`
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        $1
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
+
diff --git a/carbon.spec b/carbon.spec
new file mode 100644 (file)
index 0000000..24ce949
--- /dev/null
@@ -0,0 +1,142 @@
+Summary:       Back-end data caching and persistence daemon for Graphite
+Name:          carbon
+Version:       0.9.10
+Release:       0.1
+License:       Apache v2.0
+Group:         Daemons
+Source0:       https://github.com/downloads/graphite-project/carbon/%{name}-%{version}.tar.gz
+# Source0-md5: 053b2df1c928250f59518e9bb9f35ad5
+Source1:       %{name}-cache.init
+Source2:       %{name}-relay.init
+Source3:       %{name}-aggregator.init
+Source4:       %{name}.sysconfig
+Patch0:                FHS.patch
+URL:           https://launchpad.net/graphite/
+BuildRequires: python-devel
+BuildRequires: python-setuptools
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.658
+Provides:      group(carbon)
+Provides:      user(carbon)
+Requires(postun):      /usr/sbin/groupdel
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires:      python-TwistedCore >= 8.0
+Requires:      python-whisper
+BuildArch:     noarch
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define        no_install_post_check_tmpfiles 1
+
+%description
+Twisted daemon that listens for time-series data and writes this data
+out to whisper databases, relays the data or aggregates the data.
+Carbon is a data collection and storage agent.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+%{__python} setup.py build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__python} setup.py install \
+       --skip-build \
+       --optimize=2 \
+       --root=$RPM_BUILD_ROOT
+
+%py_postclean -x amqp_publisher.py,amqp_listener.py
+
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+install -d $RPM_BUILD_ROOT%{_localstatedir}/log/carbon
+install -d $RPM_BUILD_ROOT%{_localstatedir}/run/carbon
+install -d $RPM_BUILD_ROOT%{_sharedstatedir}/carbon
+
+# Install system configuration and init scripts
+install -Dp %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-cache
+install -Dp %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-relay
+install -Dp %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-aggregator
+install -Dp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/carbon
+
+# Install default configuration files
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+install -Dp conf/carbon.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/carbon.conf
+install -Dp conf/storage-schemas.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/storage-schemas.conf
+
+# Temp mv to non .py locations
+cd $RPM_BUILD_ROOT%{_bindir}
+%{__mv} carbon-aggregator.py carbon-aggregator
+%{__mv} carbon-cache.py carbon-cache
+%{__mv} carbon-client.py carbon-client
+%{__mv} carbon-relay.py carbon-relay
+%{__mv} validate-storage-schemas.py validate-storage-schemas
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+%groupadd -g 290 -r carbon
+%useradd -u 290 -r -g carbon -d %{_sharedstatedir}/carbon -s /sbin/nologin -c "Carbon cache daemon" carbon
+
+%post
+/sbin/chkconfig --add carbon-aggregator
+/sbin/chkconfig --add carbon-cache
+/sbin/chkconfig --add carbon-relay
+%service carbon-aggregator restart
+%service carbon-cache restart
+%service carbon-relay restart
+
+%preun
+if [ $1 -eq 0 ]; then
+       /sbin/chkconfig --del carbon-aggregator
+       /sbin/chkconfig --del carbon-cache
+       /sbin/chkconfig --del carbon-relay
+       %service carbon-aggregator stop
+       %service carbon-cache stop
+       %service carbon-relay stop
+fi
+
+%postun
+if [ $1 = 0 ]; then
+       %userremove carbon
+       %groupremove carbon
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc conf/*
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/carbon.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/storage-schemas.conf
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/carbon
+%attr(754,root,root) /etc/rc.d/init.d/carbon-aggregator
+%attr(754,root,root) /etc/rc.d/init.d/carbon-cache
+%attr(754,root,root) /etc/rc.d/init.d/carbon-relay
+%attr(755,root,root) %{_bindir}/carbon-aggregator
+%attr(755,root,root) %{_bindir}/carbon-cache
+%attr(755,root,root) %{_bindir}/carbon-client
+%attr(755,root,root) %{_bindir}/carbon-relay
+%attr(755,root,root) %{_bindir}/validate-storage-schemas
+
+%dir %{py_sitescriptdir}/%{name}
+%attr(755,root,root) %{py_sitescriptdir}/%{name}/amqp_publisher.py
+%attr(755,root,root) %{py_sitescriptdir}/%{name}/amqp_listener.py
+%{py_sitescriptdir}/%{name}/*.py[co]
+%{py_sitescriptdir}/%{name}/amqp0-8.xml
+%dir %{py_sitescriptdir}/%{name}/aggregator
+%{py_sitescriptdir}/%{name}/aggregator/*.py[co]
+%{py_sitescriptdir}/%{name}-%{version}-py*.egg-info
+
+# FIXME/CHECKME: twisted itself packages /usr/lib64/python2.7/site-packages/twisted/plugins dir
+%dir %{py_sitescriptdir}/twisted
+%dir %{py_sitescriptdir}/twisted/plugins
+%{py_sitescriptdir}/twisted/plugins/carbon_*.py[co]
+
+%dir %{_localstatedir}/run/%{name}
+%dir %attr(775,root,carbon) %{_localstatedir}/log/%{name}
+%dir %attr(775,root,carbon) %{_sharedstatedir}/%{name}
diff --git a/carbon.sysconfig b/carbon.sysconfig
new file mode 100644 (file)
index 0000000..a2fabe7
--- /dev/null
@@ -0,0 +1,4 @@
+# Configuration file for carbon
+
+# CONFIG=/etc/carbon/carbon.conf
+# LOG_DIR=/var/log/carbon
This page took 0.074348 seconds and 4 git commands to generate.