summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorAndre Barboza <bmg.andre@gmail.com>2016-01-12 06:59:10 +0700
committerRobby Workman <rworkman@slackbuilds.org>2016-01-12 21:58:11 -0600
commit39a56c19d093caa0d33d40f25be1a0f36e6b62a9 (patch)
tree53a885c9d500280d63fc7ddd05f7c721387081e0 /system
parentaa59088973d5d87c7ed9875b91bb6a202735e1bd (diff)
downloadslackbuilds-39a56c19d093caa0d33d40f25be1a0f36e6b62a9.tar.gz
system/kafka: Added (high-throughput distributed messaging system).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/kafka/README24
-rw-r--r--system/kafka/doinst.sh29
-rw-r--r--system/kafka/kafka-env.sh21
-rw-r--r--system/kafka/kafka.SlackBuild144
-rw-r--r--system/kafka/kafka.info10
-rw-r--r--system/kafka/rc.kafka40
-rw-r--r--system/kafka/slack-desc19
7 files changed, 287 insertions, 0 deletions
diff --git a/system/kafka/README b/system/kafka/README
new file mode 100644
index 0000000000..c435258289
--- /dev/null
+++ b/system/kafka/README
@@ -0,0 +1,24 @@
+Apache Kafka is publish-subscribe messaging rethought as a
+distributed commit log.
+
+Fast
+ A single Kafka broker can handle hundreds of megabytes
+ of reads and writes per second from thousands of clients.
+
+Scalable
+ Kafka is designed to allow a single cluster to serve as
+ the central data backbone for a large organization. It
+ can be elastically and transparently expanded without
+ downtime. Data streams are partitioned and spread over a
+ cluster of machines to allow data streams larger than the
+ capability of any single machine and to allow clusters of
+ co-ordinated consumers
+
+Durable
+ Messages are persisted on disk and replicated within the
+ cluster to prevent data loss. Each broker can handle
+ terabytes of messages without performance impact.
+
+Distributed by Design
+ Kafka has a modern cluster-centric design that offers
+ strong durability and fault-tolerance guarantees.
diff --git a/system/kafka/doinst.sh b/system/kafka/doinst.sh
new file mode 100644
index 0000000000..fa286bad3a
--- /dev/null
+++ b/system/kafka/doinst.sh
@@ -0,0 +1,29 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ rm $NEW
+ fi
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.kafka.new
+preserve_perms etc/kafka/server.properties.new
+preserve_perms etc/kafka/consumer.properties.new
+preserve_perms etc/kafka/producer.properties.new
+preserve_perms etc/kafka/log4j.properties.new
+preserve_perms etc/kafka/test-log4j.properties.new
+preserve_perms etc/kafka/tools-log4j.properties.new
+preserve_perms etc/kafka/kafka-env.sh.new
diff --git a/system/kafka/kafka-env.sh b/system/kafka/kafka-env.sh
new file mode 100644
index 0000000000..8941fff773
--- /dev/null
+++ b/system/kafka/kafka-env.sh
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+export KAFKA_HOME=@KAFKA_HOME@
+# KAFKA_OPTS=
+export LOG_DIR="/var/log/kafka/"
+export SCALA_BINARY_VERSION=2.11
+
+# JVM
+# export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
+# export KAFKA_HEAP_OPTS="-Xmx256M"
+# export KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark -XX:+DisableExplicitGC -Djava.awt.headless=true"
+
+# JMX settings
+# export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false "
+
+# JMX port to use
+# export JMX_PORT=
+
+# Log4J
+export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/etc/kafka/log4j.properties"
+
diff --git a/system/kafka/kafka.SlackBuild b/system/kafka/kafka.SlackBuild
new file mode 100644
index 0000000000..aed460b4d7
--- /dev/null
+++ b/system/kafka/kafka.SlackBuild
@@ -0,0 +1,144 @@
+#!/bin/sh
+
+# Slackware build script for Apache Kafka
+
+# Copyright 2016 Andre Barboza - Belo Horizonte Brazil
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=kafka
+VERSION=${VERSION:-0.8.2.2}
+SCALA_VERSION=2.11
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+KAFKA_USER=${KAFKA_USER:-kafka}
+KAFKA_UID=${KAFKA_UID:-323}
+KAFKA_GROUP=${KAFKA_GROUP:-kafka}
+KAFKA_GID=${KAFKA_GID:-323}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+
+bailout() {
+ echo " You must have a $KAFKA_USER user and $KAFKA_GROUP group to run this script. "
+ echo " Something like this should suffice for most systems: "
+ echo " # groupadd -g $KAFKA_GID $KAFKA_GROUP "
+ echo " # useradd -u $KAFKA_UID -g $KAFKA_GID -c \"Apache Kafka user\" -d /var/lib/kafka -s /bin/sh $KAFKA_USER "
+ echo " Giving /bin/sh as $KAFKA_USER shell is important as the init script will try tu 'su -' to it."
+ exit 1
+}
+
+# Bail if user and/or group isn't valid on your system
+# uid=319 is suggested to avoid conflicts with other SBo packages,
+# but it's your call: http://slackbuilds.org/uid_gid.txt
+if ! grep -q "^$KAFKA_USER:" /etc/passwd; then
+ bailout
+elif ! grep -q "^$KAFKA_GROUP:" /etc/group; then
+ bailout
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "x86_64" ]; then
+ LIBDIRSUFFIX="64"
+else
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/${PRGNAM}_${SCALA_VERSION}-$VERSION.tgz
+cd ${PRGNAM}_${SCALA_VERSION}-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/{libs,bin}
+install -m 644 libs/*.jar $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/libs
+install -m 775 bin/*.sh $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/bin
+(
+ cd $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/bin
+ sed -i "s|^base_dir=.*|base_dir=/usr/lib$LIBDIRSUFFIX/$PRGNAM/|" kafka-run-class.sh
+ sed -i '0,/^$/{s_^$_\n. /etc/kafka/kafka-env.sh\n_}' *.sh
+)
+
+mkdir -p $PKG/usr/bin
+(
+ cd $PKG/usr/bin
+ for script in $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/bin/kafka*
+ do
+ script_name=$(basename $script)
+ ln -s ../lib${LIBDIRSUFFIX}/$PRGNAM/bin/${script_name}
+ done
+)
+
+install -dm 750 ${PKG}/var/{lib,log}/$PRGNAM
+chown -R $KAFKA_USER:$KAFKA_GROUP $PKG/var/{lib,log}/$PRGNAM
+
+install -dm 755 ${PKG}/etc/$PRGNAM
+install -m 644 config/server.properties $PKG/etc/$PRGNAM/server.properties.new
+install -m 644 config/consumer.properties $PKG/etc/$PRGNAM/consumer.properties.new
+install -m 644 config/producer.properties $PKG/etc/$PRGNAM/producer.properties.new
+install -m 644 config/log4j.properties $PKG/etc/$PRGNAM/log4j.properties.new
+install -m 644 config/test-log4j.properties $PKG/etc/$PRGNAM/test-log4j.properties.new
+install -m 644 config/tools-log4j.properties $PKG/etc/$PRGNAM/tools-log4j.properties.new
+install -m 644 $CWD/kafka-env.sh $PKG/etc/$PRGNAM/kafka-env.sh.new
+(
+ cd $PKG/etc/$PRGNAM
+ sed -i "s|^log.dirs=/tmp/kafka-logs$|log.dirs=/var/log/${PRGNAM}|" server.properties.new
+ sed -i "s|@KAFKA_HOME@|/usr/lib$LIBDIRSUFFIX/$PRGNAM|" kafka-env.sh.new
+)
+(
+ cd $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM
+ ln -s /etc/kafka config
+)
+chown -R $KAFKA_USER:$KAFKA_GROUP $PKG/etc/$PRGNAM
+
+mkdir -p ${PKG}/etc/rc.d
+install -o root -g root -m 644 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.${PRGNAM}.new
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ LICENSE NOTICE \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/kafka/kafka.info b/system/kafka/kafka.info
new file mode 100644
index 0000000000..5a4c0b403c
--- /dev/null
+++ b/system/kafka/kafka.info
@@ -0,0 +1,10 @@
+PRGNAM="kafka"
+VERSION="0.8.2.2"
+HOMEPAGE="http://kafka.apache.org/"
+DOWNLOAD="http://www.us.apache.org/dist/kafka/0.8.2.2/kafka_2.11-0.8.2.2.tgz"
+MD5SUM="90f17dd1a3f91da3a233548c1df07381"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="zookeeper"
+MAINTAINER="Andre Barboza"
+EMAIL="bmg.andre@gmail.com"
diff --git a/system/kafka/rc.kafka b/system/kafka/rc.kafka
new file mode 100644
index 0000000000..12d74bc8b7
--- /dev/null
+++ b/system/kafka/rc.kafka
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Start/stop/restart Apache Zookeeper daemon
+
+SERVER_CONFIG=(server.properties)
+
+USER=kafka
+kafka_start(){
+ for conf in ${SERVER_CONFIG[@]}; do
+ sudo -u ${USER} sh -c "/usr/bin/kafka-server-start.sh -daemon /etc/kafka/${conf}"
+ done
+}
+
+kafka_stop() {
+ sudo -u ${USER} sh -c "/usr/bin/kafka-server-stop.sh"
+}
+
+kafka_restart() {
+ kafka_start
+ sleep 1
+ kafka_stop
+}
+
+print_usage() {
+ echo "usage $0 start|stop|restart"
+}
+
+case "$1" in
+ 'start')
+ kafka_start
+ ;;
+ 'stop')
+ kafka_stop
+ ;;
+ 'restart')
+ kafka_restart
+ ;;
+ *)
+ print_usage
+ ;;
+esac
diff --git a/system/kafka/slack-desc b/system/kafka/slack-desc
new file mode 100644
index 0000000000..8964ecb7c2
--- /dev/null
+++ b/system/kafka/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+kafka: kafka (A high-throughput distributed messaging system.)
+kafka:
+kafka: Apache Kafka is publish-subscribe messaging rethought as a
+kafka: distributed commit log.
+kafka:
+kafka: Homepage: http://kafka.apache.org/
+kafka:
+kafka:
+kafka:
+kafka:
+kafka: