piotrp pushed to carbon-c-relay (el6). "Initial import (#1190390)."

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Mar 31 15:42:16 UTC 2015


>From 91fb2dee34b53c7ac6e135c6f382ff5e159a2110 Mon Sep 17 00:00:00 2001
From: Piotr Popieluch <piotr1212 at gmail.com>
Date: Tue, 31 Mar 2015 17:37:44 +0200
Subject: Initial import (#1190390).


diff --git a/.gitignore b/.gitignore
index e69de29..55bd2d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/carbon-c-relay-20076363b928af35357f4a781227dfdc2751979c.tar.gz
diff --git a/carbon-c-relay.init b/carbon-c-relay.init
new file mode 100644
index 0000000..d6d2b03
--- /dev/null
+++ b/carbon-c-relay.init
@@ -0,0 +1,91 @@
+#!/bin/bash
+#
+#	/etc/rc.d/init.d/relay
+#
+#	relay    Startup script for the carbon-c-relay metrics aggregation daemon
+#	Packaged for the BBC by Matthew Hollick <matthew at mayan-it.co.uk>
+#
+# description: Carbon-like graphite line mode relay.
+#
+#This project aims to be a replacement of the original Carbon relay
+#
+#The main reason to build a replacement is performance and configurability.
+#Carbon is single threaded, and sending metrics to multiple consistent-hash
+#clusters requires chaining of relays. This project provides a multithreaded
+#relay which can address multiple targets and clusters for each and every
+#metric based on pattern matches.
+#
+# chkconfig: 2345 80 80
+#
+# config: /etc/carbon-c-relay.conf
+# pidfile: /var/run/carbon-c-relay/carbon-c-relay.pid
+
+# Source function library.
+. /etc/init.d/functions
+
+
+RETVAL=0
+PROG="carbon-c-relay"
+DAEMON_CONFIG=/etc/${PROG}.conf
+DAEMON_SYSCONFIG=/etc/sysconfig/${PROG}
+DAEMON=/usr/bin/${PROG}
+PID_FILE=/var/run/${PROG}/${PROG}.pid
+LOCK_FILE=/var/lock/subsys/${PROG}
+LOG_FILE=/var/log/${PROG}/${PROG}.log
+DAEMON_USER="${PROG}"
+
+. ${DAEMON_SYSCONFIG}
+
+start() {
+  if check_status > /dev/null; then
+    echo "Carbon C Relay is already running"
+    exit 0
+  fi
+
+  echo -n $"Starting Carbon C Relay: "
+  daemonize -u ${DAEMON_USER} -p ${PID_FILE} -l ${LOCK_FILE} -a -e ${LOG_FILE} -o ${LOG_FILE} ${DAEMON} ${ARGS} -f ${DAEMON_CONFIG}
+  RETVAL=$?
+  echo ""
+  return ${RETVAL}
+}
+
+stop() {
+    echo -n $"Stopping Carbon C Relay: "
+    killproc -p ${PID_FILE} -d 10 ${DAEMON}
+    RETVAL=$?
+    echo
+    [ $RETVAL = 0 ] && rm -f ${LOCK_FILE} ${PID_FILE}
+    return $RETVAL
+}
+
+check_status() {
+    status -p ${PID_FILE} ${DAEMON}
+    RETVAL=$?
+    return $RETVAL
+}
+
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    status)
+	check_status
+        ;;
+    reload|force-reload)
+        reload
+        ;;
+    restart)
+        stop
+        start
+        ;;
+    *)
+        N=/etc/init.d/${NAME}
+        echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
+        RETVAL=2
+        ;;
+esac
+
+exit ${RETVAL}
diff --git a/carbon-c-relay.logrotate b/carbon-c-relay.logrotate
new file mode 100644
index 0000000..43b4008
--- /dev/null
+++ b/carbon-c-relay.logrotate
@@ -0,0 +1,11 @@
+/var/log/carbon-c-relay/relay.log
+{
+  sharedscripts
+  missingok
+  notifempty
+  rotate 30
+  compress
+  postrotate
+        [ ! -f /var/run/carbon-c-relay/carbon-c-relay.pid ] || /etc/init.d/carbon-c-relay restart
+  endscript
+}
diff --git a/carbon-c-relay.service b/carbon-c-relay.service
new file mode 100644
index 0000000..10c2d86
--- /dev/null
+++ b/carbon-c-relay.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Enhanced C implementation of Carbon relay, aggregator and rewriter
+
+[Service]
+User=carbon
+Type=simple
+EnvironmentFile=-/etc/sysconfig/carbon-c-relay
+ExecStart=/usr/bin/carbon-c-relay -f /etc/carbon-c-relay.conf ${ARGS}
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/carbon-c-relay.spec b/carbon-c-relay.spec
new file mode 100644
index 0000000..c86873a
--- /dev/null
+++ b/carbon-c-relay.spec
@@ -0,0 +1,143 @@
+%global _hardened_build 1
+%global commit 20076363b928af35357f4a781227dfdc2751979c
+
+Name:               carbon-c-relay
+Version:            0.39
+Release:            1%{?dist}
+Summary:            Enhanced C implementation of Carbon relay, aggregator and rewriter
+License:            ASL 2.0
+URL:                https://github.com/grobian/carbon-c-relay
+Source0:            https://github.com/grobian/carbon-c-relay/archive/%{commit}.tar.gz#/%{name}-%{commit}.tar.gz
+Source1:            carbon-c-relay.service
+Source2:            carbon-c-relay.init
+Source3:            carbon-c-relay.logrotate
+
+BuildRequires:      openssl-devel
+
+Requires(pre):      shadow-utils
+
+%if 0%{?rhel} == 6
+Requires:           daemonize
+Requires(post):     chkconfig
+Requires(preun):    chkconfig
+Requires(postun):   initscripts
+%else
+BuildRequires:      systemd
+Requires(post):     systemd
+Requires(preun):    systemd
+Requires(postun):   systemd
+%endif
+
+
+%description
+Carbon-like Graphite line mode relay. This project aims to be a replacement of 
+the original Carbon relay. The main reason to build a replacement is 
+performance and configurability. Carbon is single threaded, and sending 
+metrics to multiple consistent-hash clusters requires chaining of relays. This 
+project provides a multithreaded relay which can address multiple targets and 
+clusters for each and every metric based on pattern matches.
+
+
+%prep
+%setup -q -n %{name}-%{commit}
+
+
+%build
+make %{?_smp_mflags} CFLAGS="%{optflags}" relay
+
+
+%install
+rm -rf %{buildroot}
+install -Dp -m0755 relay %{buildroot}%{_bindir}/carbon-c-relay
+install -Dp -m0644 contrib/relay.conf %{buildroot}%{_sysconfdir}/carbon-c-relay.conf
+install -Dp -m0644 contrib/relay.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/carbon-c-relay
+
+%if 0%{?rhel} == 6
+mkdir -p %{buildroot}%{_localstatedir}/log/carbon-c-relay
+mkdir -p %{buildroot}%{_localstatedir}/run/carbon-c-relay
+mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
+install -Dp -m0755 %{SOURCE2} %{buildroot}%{_initddir}/%{name}
+install -Dp -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+%else
+install -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
+%endif
+
+
+%pre
+getent group carbon-c-relay >/dev/null || groupadd -r carbon-c-relay
+getent passwd carbon-c-relay >/dev/null || \
+    useradd -r -g carbon-c-relay -d / -s /sbin/nologin \
+    -c "Carbon cache daemon" carbon-c-relay
+exit 0
+
+
+%post
+%if 0%{?rhel} == 6
+/sbin/chkconfig --add %{name}
+%else
+%systemd_post %{name}.service
+%endif
+
+
+%preun
+%if 0%{?rhel} == 6
+if [ $1 -eq 0 ] ; then
+    /sbin/service %{name} stop >/dev/null 2>&1
+    /sbin/chkconfig --del %{name}
+fi
+%else
+%systemd_preun %{name}.service
+%endif
+
+
+%postun
+%if 0%{?rhel} == 6
+if [ "$1" -ge "1" ] ; then
+    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
+fi
+%else
+%systemd_postun_with_restart %{name}.service
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%doc README.md
+%license LICENSE.md
+%{_bindir}/carbon-c-relay
+%config(noreplace) %{_sysconfdir}/carbon-c-relay.conf
+%config(noreplace) %{_sysconfdir}/sysconfig/carbon-c-relay
+
+%if 0%{?rhel} == 6
+%{_initddir}/%{name}
+%attr(0755,carbon-c-relay,carbon-c-relay) %dir %{_localstatedir}/log/%{name}
+%attr(0755,carbon-c-relay,carbon-c-relay) %dir %{_localstatedir}/run/%{name}
+%{_sysconfdir}/logrotate.d/%{name}
+%else
+%{_unitdir}/%{name}.service
+%endif
+
+
+%changelog
+* Sat Mar 28 2015 Piotr Popieluch <piotr1212 at gmail.com> - 0.39-1
+- update to latest upsream 0.39
+
+* Wed Feb  4 2015 Piotr Popieluch <piotr1212 at gmail.com> - 0.37-1
+- update to upstream 0.37
+- rewritten for Fedora and comply with Fedora package guidelines
+
+* Mon Sep 8 2014 Matthew Hollick <matthew at mayan-it.co.uk>
+- tidy up for github
+- reverted site specific changes
+
+* Fri Aug 8 2014 Matthew Hollick <matthew at mayan-it.co.uk>
+- packaged as part of twiki
+
+* Tue Jul 1 2014 Matthew Hollick <matthew at mayan-it.co.uk>
+- packaged as part of mdr
+- binary renamed from 'relay' to 'cc_relay'
+- pagage renamed to reflect function rather than component
+- user / group named by function
+
+* Tue May 6 2014 Matthew Hollick <matthew at mayan-it.co.uk>
+- Initial package for the BBC
diff --git a/sources b/sources
index e69de29..b71d3c1 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+1961a755c3f39d981bdfef464c35a025  carbon-c-relay-20076363b928af35357f4a781227dfdc2751979c.tar.gz
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/carbon-c-relay.git/commit/?h=el6&id=91fb2dee34b53c7ac6e135c6f382ff5e159a2110


More information about the scm-commits mailing list