Skip to content

Commit

Permalink
Restructure debian packaging.
Browse files Browse the repository at this point in the history
This commit restructures the debian packaging. First it splits off
the modules from the djabberd package which allows installing all
required libraries w/o getting another deamon (e.g. as build
dependency for building other modules or custom jabberds). Second
it adds the missing wiring to the djabberd to get an jabber
server which is easy to set up. Including propper logging and
an ssl certificate.
  • Loading branch information
dominikschulz committed Feb 19, 2012
1 parent d13d175 commit c0f64df
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 82 deletions.
4 changes: 4 additions & 0 deletions debian/.gitignore
@@ -1 +1,5 @@
tmp/
djabberd/
libdjabberd-perl/
*.debhelper
*.substvars
98 changes: 17 additions & 81 deletions debian/control
Expand Up @@ -11,10 +11,8 @@ Package: djabberd
Section: perl
Priority: optional
Architecture: all
Depends: ${perl:Depends}, liblog-log4perl-perl, libnet-dns-perl, libnet-ssleay-perl, libxml-sax-perl, libxml-libxml-perl, libdanga-socket-perl
Provides: libdjabberd-perl
Conflicts: libdjabberd-perl
Suggests: djabberd-doc, openssl
Depends: ${perl:Depends}, libdjabberd-perl
Suggests: djabberd-doc
Description: Distributed Jabber server
djabberd is a high-performance, scalable, extensible Jabber/XMPP
server framework. While it comes with an example server, it's
Expand All @@ -25,84 +23,22 @@ Description: Distributed Jabber server
.
Homepage: http://danga.com/djabberd/

Package: libdjabberd-authen-htdigest-perl
Section: perl
Priority: optional
Architecture: all
Depends: djabberd
Suggests: apache2-utils | apache-common (<< 1.3.28.0.1-1)
Description: HTDigest Authentication module for DJabberd
This module provides htdigest-based authentication for DJabberd.

Package: libdjabberd-authen-mysql-perl
Section: perl
Priority: optional
Architecture: all
Depends: djabberd, libdbi-perl, libdbd-mysql-perl
Description: MySQL Authentication module for DJabberd
This module allows DJabberd to authenticate through MySQL.

Package: libdjabberd-authen-pam-perl
Section: perl
Priority: optional
Architecture: all
Depends: djabberd, libauthen-pam-perl
Description: PAM Authentication module for DJabberd
This module allows DJabberd to authenticate through PAM.

Package: libdjabberd-bot-eliza-perl
Section: perl
Priority: optional
Architecture: all
Depends: djabberd, libchatbot-eliza-perl
Description: Eliza Chatbot module for DJabberd
This module allows DJabberd to use Chatbot::Eliza to confuse
users.

Package: djabberd-livejournal
Section: perl
Priority: optional
Architecture: all
Depends: djabberd, libgearman-client-async-perl, libgearman-client-perl, libwww-perl
Description: LiveJournal module for DJabberd
This module allows DJabberd to talk to LiveJournal.

Package: djabberd-misc
Section: perl
Priority: optional
Architecture: all
Depends: djabberd
Description: DJabberd miscellany
Provides DJabberd::RosterStorage::Dummy

Package: djabberd-muc
Section: perl
Priority: optional
Architecture: all
Depends: djabberd
Description: DJabberd MUC
Provides MUC modules for DJabberd

Package: djabberd-rosterstorage-sqlite
Package: libdjabberd-perl
Section: perl
Priority: optional
Architecture: all
Depends: djabberd, libdbi-perl, libdbd-sqlite3-perl
Description: DJabberd RosterStorage using SQLite
Provides DJabberd RosterStorage using SQLite

Package: libdjabberd-plugin-vcard-perl
Section: perl
Priority: optional
Architecture: all
Depends: djabberd
Description: DJabberd VCard plugins
Provides VCard plugins for DJabberd
Depends: ${perl:Depends}, liblog-log4perl-perl, libnet-dns-perl, libnet-ssleay-perl, libxml-sax-perl, libxml-libxml-perl, libdanga-socket-perl
Suggests: openssl
Description: Core Modules for DJabberd
djabberd is a high-performance, scalable, extensible Jabber/XMPP
server framework. While it comes with an example server, it's
really a set of classes for you to build your own Jabber server
without understanding Jabber. Instead of working with XML and
protocol-specific details, you subclass parts and work with sane
objects and data structures and let DJabberd do all the ugly work.
.
Homepage: http://danga.com/djabberd/
.
This package contains the core libraries needed to build your
own jabber server.

Package: djabberd-webadmin
Section: perl
Priority: optional
Architecture: all
Depends: djabberd, libperlbal-perl
Description: DJabberd WebAdmin
Provides DJabberd::WebAdmin
1 change: 1 addition & 0 deletions debian/djabberd.dirs
@@ -0,0 +1 @@
/etc/djabberd
85 changes: 85 additions & 0 deletions debian/djabberd.init.d
@@ -0,0 +1,85 @@
#!/bin/sh

### BEGIN INIT INFO
# Provides: djabberd
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop djabberd
# Description: Start/stop djabberd
### END INIT INFO

# Original Version from http://graveyard.martinjansen.com/2006/08/06/djabberd.html
# Modified by Dominik Schulz <dominik.schulz@gauner.org>

set -e

test $DEBIAN_SCRIPT_DEBUG && set -v -x

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="DJabberd"
NAME="djabberd"
CONFIG_DIR=/etc/djabberd
HOME_DIR=/var/lib/djabberd
DAEMON=/usr/bin/djabberd
PIDFILE=/var/run/djabberd/djabberd.pid
SCRIPTNAME=/etc/init.d/djabberd
OPTS="--conf=$CONFIG_DIR/djabberd.conf"

test -x $DAEMON || exit 0
text -d $CONFIG_DIR || exit 0

d_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE -m \
-d $HOME_DIR \
--chuid djabberd \
--background \
--exec $DAEMON -- $OPTS
}

d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
-d $HOME_DIR \
--name $NAME -- $OPTS
}

d_reload() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--name $NAME --signal 1
}

case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC: $NAME"
d_reload
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac

exit 0

# vim: set ai sts=2 sw=2 tw=0:
4 changes: 3 additions & 1 deletion debian/djabberd.install
@@ -1 +1,3 @@
debian/tmp/usr /
debian/tmp/usr/bin /
/etc/djabberd.conf /etc/djabberd/
/etc/log.conf /etc/djabberd/
8 changes: 8 additions & 0 deletions debian/djabberd.logrotate
@@ -0,0 +1,8 @@
/var/log/djabberd/djabberd.log {
daily
missingok
copytruncate
rotate 90
compress
notifempty
}
60 changes: 60 additions & 0 deletions debian/djabberd.postinst
@@ -0,0 +1,60 @@
#!/bin/sh -e

# DJabberd Common postinst
# Dominik Schulz <dominik.schulz@gauner.org>

makedir() {
if [ ! -d $1 ]; then
mkdir $1
fi
chown $2 $1 && chmod $3 $1
}

umask 022

# postinst processing

case "$1" in
configure)
OLDVERSION="$2"
# see below
;;
abort-upgrade)
exit 0
;;
abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac

# make sure that the user exists. the simplest portable way to check that
# is to chown something.
makedir /tmp/djabberd root:root 700
chgrp djabberd /tmp/djabberd 2>/dev/null ||
addgroup --system djabberd
chown djabberd /tmp/djabberd 2>/dev/null ||
adduser --system --home /var/lib/djabberd --no-create-home --ingroup djabberd --disabled-password djabberd
# create missing directories and/or make sure the permissions fit
makedir /var/lib/djabberd djabberd:djabberd 755
makedir /var/log/djabberd djabberd:djabberd 755
makedir /var/run/djabberd djabberd:djabberd 755
makedir /etc/djabberd djabberd:djabberd 750

# generate a snakeoil keypair so that SSL works OOTB
SERVERKEY="/etc/djabberd/snakeoil-server-key.pem"
SERVERCRT="/etc/djabberd/snakeoil-server-crt.pem"
if [ ! -f $SERVERKEY -a ! -f $SERVERCRT ]; then
openssl req -x509 -batch -newkey rsa:1024 -keyout $SERVERKEY -out $SERVERCRT -days 3650 -nodes
fi

# remove the temporary directory
rm -r /tmp/djabberd

# functionality generated by debhelper (e.g. invoking start/stop scripts) will be added here
#DEBHELPER#

exit 0
27 changes: 27 additions & 0 deletions debian/djabberd.postrm
@@ -0,0 +1,27 @@
#!/bin/sh -e

# DJabberd Common postrm
# Dominik Schulz <dominik.schulz@gauner.org>

case "$1" in
remove)
;;
upgrade)
;;
purge)
rm -rf /etc/djabberd
rm -rf /var/lib/djabberd
rm -rf /var/log/djabberd
rm -rf /var/run/djabberd
userdel djabberd >/dev/null 2>&1 || true
groupdel djabberd >/dev/null 2>&1 || true
;;
failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac

#DEBHELPER#
1 change: 1 addition & 0 deletions debian/libdjabberd-perl.install
@@ -0,0 +1 @@
debian/tmp/usr/share /
76 changes: 76 additions & 0 deletions etc/djabberd.conf
@@ -0,0 +1,76 @@
OldSSL enable

# health checks from this IP (directive can be repeated) won't log and
# won't allocate a connection id
DeclareMonitor 127.0.0.1
AdminPort 5200

# defaults:
ClientPort 5222
ServerPort 5269

SSLCertificateFile /etc/djabberd/snakeoil-server-crt.pem
SSLCertificateKeyFile /etc/djabberd/snakeoil-server-key.pem

PidFile /var/run/djabberd/djabberd.pid

<VHost jabber.localhost.localdomain>
S2S enable
RequireSSL yes

<Plugin DJabberd::SASL::AuthenSASL>
Optional no
Mechanisms PLAIN LOGIN
</Plugin>

<Plugin DJabberd::RosterStorage::SQLite>
Database /var/lib/djabberd/roster.sqlite
</Plugin>

<Plugin DJabberd::Authen::HTDigest>
Realm djabberd
HtDigest /var/lib/djabberd/djabberd.htdigest
</Plugin>

<Plugin DJabberd::Plugin::VCard::SQLite>
Storage /var/lib/djabberd/vcards.sqlite
</Plugin>

# This needs the package libdjabberd-authen-userlimit-perl
# <Plugin DJabberd::Authen::UserLimit>
# UserLimit 150
# </Plugin>

# This needs the package libdjabberd-entitytime-perl
# <Plugin DJabberd::Plugin::EntityTime />

# This needs the package libdjabberd-plugin-balancer-perl
# <Plugin DJabberd::Plugin::Balancer />

# This needs the package libdjabberd-plugin-jabberiqversion-perl
# <Plugin DJabberd::Plugin::JabberIqVersion>
# OS Debian GNU/Linux
# Name A poorly maintained Jabber Server
# Version Beta
# </Plugin>

# This needs the package libdjabberd-plugin-ping-perl
# <Plugin DJabberd::Plugin::Ping />

<Plugin DJabberd::PresenceChecker::Local />
<Plugin DJabberd::Delivery::Local />
<Plugin DJabberd::Delivery::S2S />

# This needs the package libdjabberd-delivery-offlinestorage-perl
# IMPORTANT: This plugin MUST be loaded last!
# <Plugin DJabberd::Delivery::OfflineStorage::SQLite>
# Database /var/lib/djabberd/offline.sqlite
# Types Message
# </Plugin>
</VHost>






9 changes: 9 additions & 0 deletions etc/log.conf
@@ -0,0 +1,9 @@
log4perl.logger.DJabberd = ERROR, LOGFILE
log4perl.logger.DJabberd.Hook = WARN

log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=/var/log/djabberd/djabberd.log
log4perl.appender.LOGFILE.mode=append

log4perl.appender.LOGFILE.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=%-5p %-40c %m %n

0 comments on commit c0f64df

Please sign in to comment.