Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 765a0a5
Showing
15 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Debian packaging for Apache Kafka | ||
|
||
This package is meant to build .deb packaging for the Apache Kafka project. | ||
This .deb package that is built will install the full Kafka source directory | ||
along with compiles classes and .jar files into '''/usr/lib/kafka'''. | ||
'''/usr/lib/kafka/config''' will be symlinked to '''/etc/kafka'''. An | ||
'''/etc/init/kafka.conf''' upstart script will allow you to start and stop | ||
Kafka brokers as a service. | ||
|
||
Note: This has only been tested on Ubuntu 12.04 LTS. | ||
|
||
## Instructions | ||
- [Download](http://incubator.apache.org/kafka/downloads.html) Apache Kafka. | ||
- Unzip the source: | ||
''' | ||
tar -xzf kafka-0.7.2-incubating-src.tgz | ||
''' | ||
- Clone this respository into a debian/ directory | ||
''' | ||
cd kafka-0.7.2-incubating-src && git clone https://github.com/wmf-analytics/kafka-debian.git ./debian | ||
- Run the buildpackage.sh script | ||
''' | ||
debian/buildpackage.sh | ||
''' | ||
|
||
If all goes well, you will have a kafka_0.7.2_all.deb package. | ||
|
||
Run this as a single command to do all of the above steps at once: | ||
''' | ||
wget http://apache.petsads.us/incubator/kafka/kafka-0.7.2-incubating/kafka-0.7.2-incubating-src.tgz && \ | ||
tar -xzf kafka-0.7.2-incubating-src.tgz && \ | ||
cd kafka-0.7.2-incubating-src && \ | ||
git clone https://github.com/wmf-analytics/kafka-debian.git ./debian && \ | ||
debian/buildpackage.sh | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# buildpackage.sh | ||
# Builds .orig.tar.gz file and runs dpkg-buildpackage -rfakeroot. | ||
# Run with 'compile' as the first argument if you want to remcompile Kafka. | ||
|
||
version=0.7.2 | ||
basedir=$(readlink -f $(dirname $0)/..) | ||
|
||
cd $basedir | ||
|
||
# remove build directory | ||
[ -d $basedir/debian/kafka ] && echo "Removing kafka build directory at $basedir/debian/kafka" && rm -r $basedir/debian/kafka | ||
|
||
compile=${1:-false} | ||
if [ ${compile} == "compile" -o ! -f $basedir/core/target/scala_2.8.0/kafka-${version}.jar ]; then | ||
echo "Compiling and packaging Kafka before building .deb package." | ||
echo "./sbt update && ./sbt package" | ||
./sbt update && ./sbt package | ||
fi | ||
|
||
|
||
# create source .orig directory | ||
# echo "Creating source kafka_${version}.orig.tar.gz" | ||
cd $basedir/.. | ||
rm -v kafka_${version}* | ||
tar -czf kafka_${version}.orig.tar.gz $(basename $basedir) | ||
|
||
# build the .deb | ||
echo "Building .deb package..." | ||
cd $basedir | ||
dpkg-buildpackage -rfakeroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kafka (0.7.2) stable; urgency=low | ||
|
||
* Initial Debian packaging. | ||
|
||
-- Andrew Otto (WMF) <otto@wikimedia.org> Wed, 24 Oct 2012 19:38:12 +0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Source: kafka | ||
Priority: extra | ||
Maintainer: Andrew Otto <otto@wikimedia.org> | ||
Build-Depends: debhelper (>= 8.0.0), javahelper (>=0.25) | ||
Build-Depends-Indep: default-jdk | sun-java6-jdk | ||
Standards-Version: 3.9.2 | ||
Section: utils | ||
Homepage: http://incubator.apache.org/kafka/ | ||
|
||
Package: kafka | ||
Architecture: all | ||
Depends: ${misc:Depends}, upstart | ||
Description: Apache Kafka is a distributed publish-subscribe messaging system. | ||
Kafka provides a publish-subscribe solution that can handle all activity | ||
stream data and processing on a consumer-scale web site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/usr/lib/kafka | ||
/etc/kafka | ||
/var/log/kafka | ||
/etc/init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kafka_0.7.2_all.deb utils extra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
basedir=$1 | ||
destdir=$2 | ||
|
||
# Install all files in $basedir | ||
# (minus the debian/ and config/ directory) | ||
# into $destdir | ||
for file in $(ls $basedir | grep -v 'debian' | grep -v 'config'); do | ||
cp -r $file $destdir/$file | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
misc:Depends= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Kafka Broker Service | ||
|
||
description "Kafka Broker" | ||
|
||
start on runlevel [2345] | ||
stop on starting rc RUNLEVEL=[016] | ||
|
||
respawn | ||
respawn limit 2 5 | ||
|
||
env HOME=/etc/kafka | ||
env KAFKA_HOME=/usr/lib/kafka | ||
umask 007 | ||
|
||
kill timeout 300 | ||
|
||
pre-start script | ||
#Sanity checks | ||
[ -r $HOME/server.properties ] | ||
end script | ||
|
||
setuid kafka | ||
setgid kafka | ||
|
||
exec $KAFKA_HOME/bin/kafka-server-start.sh $HOME/server.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
etc/kafka usr/lib/kafka/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
|
||
# preinst script for kafka | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <new-preinst> `install' | ||
# * <new-preinst> `install' <old-version> | ||
# * <new-preinst> `upgrade' <old-version> | ||
# * <old-preinst> `abort-upgrade' <new-version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
|
||
case "$1" in | ||
install|upgrade) | ||
if ! getent passwd kafka >/dev/null; then | ||
# Adding system user: yarn. | ||
adduser \ | ||
--system \ | ||
--group \ | ||
--home /var/lib/kafka \ | ||
--gecos "Apache Kafka" \ | ||
--shell /bin/bash \ | ||
kafka >/dev/null 2>/dev/null || : | ||
fi | ||
;; | ||
|
||
abort-upgrade) | ||
;; | ||
|
||
*) | ||
echo "preinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# dh_installdeb will replace this with shell code automatically | ||
# generated by other debhelper scripts. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/make -f | ||
|
||
# Get the java home directory for the version of java we are using | ||
JAVA_HOME := $(shell /usr/sbin/update-java-alternatives --list | cut -d ' ' -f 3) | ||
|
||
binary: install | ||
dh_installchangelogs | ||
dh_installdeb | ||
dh_gencontrol | ||
dh_md5sums | ||
dh_builddeb | ||
|
||
clean: | ||
dh_clean | ||
|
||
build: | ||
dh_testdir | ||
dh_testroot | ||
dh_prep | ||
|
||
# Kafka has already been updated and packaged by | ||
# the ./sbt script. Nothing to do but install. | ||
# See: http://incubator.apache.org/kafka/quickstart.html | ||
|
||
install: build | ||
dh_installdirs | ||
# install into /usr/lib/kafka | ||
$(CURDIR)/debian/install.sh $(CURDIR) $(CURDIR)/debian/kafka/usr/lib/kafka | ||
# install config files into /etc/kafka | ||
cp $(CURDIR)/config/* $(CURDIR)/debian/kafka/etc/kafka/ | ||
|
||
# create symlinks defined in debian/links | ||
dh_link | ||
|
||
# install upstart init file | ||
cp $(CURDIR)/debian/kafka.upstart.conf $(CURDIR)/debian/kafka/etc/init/kafka.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (quilt) |