%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 - 0.39-1 - update to latest upsream 0.39 * Wed Feb 4 2015 Piotr Popieluch - 0.37-1 - update to upstream 0.37 - rewritten for Fedora and comply with Fedora package guidelines * Mon Sep 8 2014 Matthew Hollick - tidy up for github - reverted site specific changes * Fri Aug 8 2014 Matthew Hollick - packaged as part of twiki * Tue Jul 1 2014 Matthew Hollick - 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 - Initial package for the BBC