Filippo Giunchedi has submitted this change and it was merged. Change subject: carbon-c-relay: add debian packaging ......................................................................
carbon-c-relay: add debian packaging Enhanced C implementation of Carbon relay, aggregator and rewriter. Initially, the idea is to be able to mirror carbon traffic to another host for testing purposes. Going forward it can be used to provide HA, testing and so on. Change-Id: I1a48a09b485dfa6010f46bae24b24d43683172f6 --- A debian/carbon-c-relay.conf A debian/carbon-c-relay.dirs A debian/carbon-c-relay.docs A debian/carbon-c-relay.init A debian/carbon-c-relay.install A debian/carbon-c-relay.lintian-overrides A debian/carbon-c-relay.service A debian/carbon-c-relay.upstart A debian/changelog A debian/clean A debian/compat A debian/control A debian/copyright A debian/postinst A debian/rules A debian/source/format A debian/watch 17 files changed, 252 insertions(+), 0 deletions(-) Approvals: Filippo Giunchedi: Verified; Looks good to me, approved diff --git a/debian/carbon-c-relay.conf b/debian/carbon-c-relay.conf new file mode 100644 index 0000000..f470578 --- /dev/null +++ b/debian/carbon-c-relay.conf @@ -0,0 +1,16 @@ +# example configuration scenarios. +# Refer to /usr/share/doc/carbon-c-relay/README.md.gz for additional examples! + +## mirror all incoming metrics towards two destinations +#cluster send-through +# forward +# host1:2003 +# host2:2003 +# ; +# +#match * send to send-through; + +## send all incoming metrics to the first responsive host +#cluster send-to-any-one +# any_of host1:2003 host2:2003; +#match * send to send-to-any-one; diff --git a/debian/carbon-c-relay.dirs b/debian/carbon-c-relay.dirs new file mode 100644 index 0000000..6bac063 --- /dev/null +++ b/debian/carbon-c-relay.dirs @@ -0,0 +1 @@ +/var/lib/carbon-c-relay diff --git a/debian/carbon-c-relay.docs b/debian/carbon-c-relay.docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/carbon-c-relay.docs @@ -0,0 +1 @@ +README.md diff --git a/debian/carbon-c-relay.init b/debian/carbon-c-relay.init new file mode 100644 index 0000000..fd4f62c --- /dev/null +++ b/debian/carbon-c-relay.init @@ -0,0 +1,128 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: carbon-c-relay +# Required-Start: $remote_fs $syslog $network +# Required-Stop: $remote_fs $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: graphite carbon relay C implementation +### END INIT INFO + +# Author: Filippo Giunchedi <[email protected]> + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="graphite carbon relay C implementation" +NAME=carbon-c-relay +DAEMON=/usr/bin/$NAME +DAEMON_ARGS="-f /etc/carbon-c-relay.conf" +DAEMON_USER="carbon-c-relay" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \ + --chuid $DAEMON_USER --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \ + --chuid $DAEMON_USER --background --exec $DAEMON -- $DAEMON_ARGS \ + || return 2 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \ + --user $DAEMON_USER --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \ + --user $DAEMON_USER --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/carbon-c-relay.install b/debian/carbon-c-relay.install new file mode 100644 index 0000000..45bfc65 --- /dev/null +++ b/debian/carbon-c-relay.install @@ -0,0 +1,2 @@ +carbon-c-relay usr/bin +debian/carbon-c-relay.conf /etc diff --git a/debian/carbon-c-relay.lintian-overrides b/debian/carbon-c-relay.lintian-overrides new file mode 100644 index 0000000..90311ac --- /dev/null +++ b/debian/carbon-c-relay.lintian-overrides @@ -0,0 +1,4 @@ +# the package is shipping only upstart and systemd scripts, however the init +# script is mentioned in postinst +carbon-c-relay: init.d-script-not-included-in-package etc/init.d/carbon-c-relay +carbon-c-relay: init.d-script-not-marked-as-conffile etc/init.d/carbon-c-relay diff --git a/debian/carbon-c-relay.service b/debian/carbon-c-relay.service new file mode 100644 index 0000000..61cde27 --- /dev/null +++ b/debian/carbon-c-relay.service @@ -0,0 +1,9 @@ +[Unit] +Description=graphite carbon relay C implementation + +[Service] +User=carbon-c-relay +ExecStart=/usr/bin/carbon-c-relay -f /etc/carbon-c-relay.conf + +[Install] +WantedBy=multi-user.target diff --git a/debian/carbon-c-relay.upstart b/debian/carbon-c-relay.upstart new file mode 100644 index 0000000..cbe9254 --- /dev/null +++ b/debian/carbon-c-relay.upstart @@ -0,0 +1,10 @@ +description "carbon relay C implementation" + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on [!12345] + +limit nofile 32768 32768 + +setuid carbon-c-relay + +exec /usr/bin/carbon-c-relay -f /etc/carbon-c-relay.conf diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..c9a1f15 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +carbon-c-relay (0.36-1) unstable; urgency=medium + + * Initial release. (Closes: #768983) + + -- Filippo Giunchedi <[email protected]> Fri, 07 Nov 2014 15:48:03 +0000 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..c58b7be --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +carbon-c-relay diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..6b013a6 --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ +Source: carbon-c-relay +Section: net +Priority: optional +Maintainer: Filippo Giunchedi <[email protected]> +Build-Depends: debhelper (>= 9), dh-systemd, libssl-dev, pkg-config +Standards-Version: 3.9.6 +X-Python-Version: >= 2.7 + +Package: carbon-c-relay +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser +Description: Carbon-compatible graphite line mode relay + This project provides a multithreaded relay which can address multiple targets + and clusters for each and every metric based on pattern matches. + . + Consistent-hash routing compatible with the original carbon's implementation + is also provided. This relay also supports aggregation, failover of backend + servers and more. + . + Carbon is graphite's default storage backend and supports different protocols + for receiving metrics, this project aims to be a replacement of graphite's + original carbon-relay component and supports "plaintext" protocol metrics. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..920bbcc --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: carbon-c-relay +Upstream-Contact: Fabian Groffen +Source: https://github.com/grobian/carbon-c-relay + +Files: * +Copyright: 2013-2014 Fabian Groffen +License: Apache-2 + +Files: debian/* +Copyright: 2014 Filippo Giunchedi <[email protected]> + 2014 Wikimedia Foundation +License: Apache-2 + +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + . + On Debian systems, the full text of the Apache License version 2 can be found + in the file `/usr/share/common-licenses/Apache-2.0'. diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..eef74df --- /dev/null +++ b/debian/postinst @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + adduser --quiet --system --no-create-home \ + --home /var/lib/carbon-c-relay carbon-c-relay + ;; +esac + +#DEBHELPER# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..824a7af --- /dev/null +++ b/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +%: + dh $@ --with systemd + +override_dh_auto_install: + cp relay carbon-c-relay + dh_auto_install diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..d07c95d --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 + +https://github.com/grobian/carbon-c-relay/releases/ /grobian/carbon-c-relay/archive/v(\d\.\d+).tar.gz -- To view, visit https://gerrit.wikimedia.org/r/172228 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1a48a09b485dfa6010f46bae24b24d43683172f6 Gerrit-PatchSet: 4 Gerrit-Project: operations/debs/carbon-c-relay Gerrit-Branch: master Gerrit-Owner: Filippo Giunchedi <[email protected]> Gerrit-Reviewer: Alexandros Kosiaris <[email protected]> Gerrit-Reviewer: Faidon Liambotis <[email protected]> Gerrit-Reviewer: Filippo Giunchedi <[email protected]> Gerrit-Reviewer: KartikMistry <[email protected]> Gerrit-Reviewer: Ori.livneh <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
