aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/rabbitmq-server/APKBUILD89
-rw-r--r--testing/rabbitmq-server/rabbitmq-server.initd42
-rw-r--r--testing/rabbitmq-server/rabbitmq-server.logrotate12
-rw-r--r--testing/rabbitmq-server/rabbitmq-server.post-deinstall5
-rw-r--r--testing/rabbitmq-server/rabbitmq-server.pre-install6
5 files changed, 154 insertions, 0 deletions
diff --git a/testing/rabbitmq-server/APKBUILD b/testing/rabbitmq-server/APKBUILD
new file mode 100644
index 0000000000..4c57267aba
--- /dev/null
+++ b/testing/rabbitmq-server/APKBUILD
@@ -0,0 +1,89 @@
+# Contributor: Nathan Johnson <nathan@nathanjohnson.info>
+# Maintainer: Nathan Johnson <nathan@nathanjohnson.info>
+pkgname=rabbitmq-server
+pkgver=3.6.2
+_realver=${pkgver//\./_}
+pkgrel=0
+pkgdesc="RabbitMQ is an open source multi-protocol messaging broker."
+url="http://www.rabbitmq.com/"
+arch="noarch"
+license="MPL 1.1"
+depends="erlang erlang-tools erlang-runtime-tools erlang-stdlib
+ logrotate erlang-ssl erlang-crypto erlang-parsetools
+ erlang-mnesia erlang-sasl erlang-inets erlang-syntax-tools
+ erlang-eldap erlang-xmerl erlang-os-mon"
+depends_dev=""
+makedepends="$depends_dev erlang-dev py-simplejson xmlto libxslt
+ rsync zip gawk grep erlang-compiler erlang-erl-docgen
+ erlang-edoc socat"
+install="$pkgname.pre-install $pkgname.post-deinstall"
+pkgusers="rabbitmq"
+pkggroups="rabbitmq"
+subpackages="$pkgname-doc"
+source="
+ rabbitmq-server.initd
+ rabbitmq-server.logrotate
+ https://github.com/rabbitmq/${pkgname}/releases/download/rabbitmq_v${_realver}/${pkgname}-${pkgver}.tar.xz
+"
+
+builddir="$srcdir/${pkgname}-${pkgver}"
+build() {
+ cd "$builddir"
+ make dist manpages
+}
+
+package() {
+ cd "$builddir"
+
+ make install install-bin install-man DESTDIR="$pkgdir" PREFIX=/usr \
+ RMQ_ROOTDIR="/usr/lib/rabbitmq" MANDIR=/usr/share/man
+
+ mkdir -p "$pkgdir"/var/lib/rabbitmq/mnesia
+ mkdir -p "$pkgdir"/var/log/rabbitmq
+
+ #Copy all necessary lib files etc.
+ install -p -m755 -D "$builddir"/scripts/rabbitmq-server.ocf \
+ "$pkgdir"/usr/lib/ocf/resource.d/rabbitmq/rabbitmq-server || return 1
+ install -p -m755 -D "$builddir"/scripts/rabbitmq-server-ha.ocf \
+ "$pkgdir"/usr/lib/ocf/resource.d/rabbitmq/rabbitmq-server-ha \
+ || return 1
+ install -p -m644 -D "$srcdir/"$pkgname.logrotate \
+ "$pkgdir"/etc/logrotate.d/rabbitmq-server || return 1
+ install -m755 -D "$srcdir"/$pkgname.initd \
+ "$pkgdir"/etc/init.d/$pkgname || return 1
+ mkdir -p "$pkgdir"/usr/sbin
+
+ # This is lifted / adapted from the official upstream spec file.
+ # I'd prefer a patch file, but this is probably a little easier
+ # to manage since this is how they do it upstream. inb4eww
+ sed -e 's|@SU_RABBITMQ_SH_C@|su rabbitmq -s /bin/sh -c|' \
+ -e 's|@STDOUT_STDERR_REDIRECTION@||' \
+ < "$builddir"/scripts/rabbitmq-script-wrapper \
+ > "$pkgdir"/usr/sbin/rabbitmqctl
+
+ chmod 0755 "$pkgdir"/usr/sbin/rabbitmqctl
+ for script in rabbitmq-server rabbitmq-plugins; do
+ cp -a "$pkgdir"/usr/sbin/rabbitmqctl \
+ "$pkgdir"/usr/sbin/$script;
+ done
+
+ mkdir -p "$pkgdir"/usr/share/doc/"$pkgname"
+ cp -a "$builddir"/LICENSE* "$pkgdir"/usr/share/doc/"$pkgname"/
+ cp -a "$builddir"/docs/* "$pkgdir"/usr/share/doc/"$pkgname"/
+
+ chmod 755 "$pkgdir"/var/lib/rabbitmq
+ chmod 750 "$pkgdir"/var/lib/rabbitmq/mnesia
+ chmod 755 "$pkgdir"/var/log/rabbitmq
+ chown -R $pkgusers:$pkggroups "$pkgdir"/var/lib/rabbitmq
+ chown -R $pkgusers:$pkggroups "$pkgdir"/var/log/rabbitmq
+}
+
+md5sums="453534a8a51f5622b030effa53ff917a rabbitmq-server.initd
+f24af11867cddc5a17fefa8bf4276d52 rabbitmq-server.logrotate
+999d209301d1b5b5e1b279ab13a040da rabbitmq-server-3.6.2.tar.xz"
+sha256sums="f8abb68f9bd3c7fb1f5c3dfb1c29dc17991151f4034ed3aacc00b1b55d7b2ee2 rabbitmq-server.initd
+9cce79e90835317b9704ecdf44e7dbc71803a17c85c1402f2bb4b2edb0232ab2 rabbitmq-server.logrotate
+b09eadd91244115e50856d1423e4659e46313f1545c69b434021e1afa1b60216 rabbitmq-server-3.6.2.tar.xz"
+sha512sums="a794d614bb74dbea4b3de4563241fee815b652cb1e6a91144e86cd017b3d7bb6e728e67aa335370347d6993f9c6884414f6b9bd5ef027d89b7f95c7abd4d8413 rabbitmq-server.initd
+b8655cb048ab3b32001d4e6920bb5366696f3a5da75c053605e9b270e771c548e36858dca8338813d34376534515bba00af5e6dd7b4b1754a0e64a8fb756e3f3 rabbitmq-server.logrotate
+9ada10f6dff84161dae13e593211a271b7c414252a3da276f593c57fe8a513cd6a718ec592e2853630f703bb6c7f0dee3bed8c0ddeaefbb36c04613b5466f3e8 rabbitmq-server-3.6.2.tar.xz"
diff --git a/testing/rabbitmq-server/rabbitmq-server.initd b/testing/rabbitmq-server/rabbitmq-server.initd
new file mode 100644
index 0000000000..5845635e74
--- /dev/null
+++ b/testing/rabbitmq-server/rabbitmq-server.initd
@@ -0,0 +1,42 @@
+#!/sbin/openrc-run
+
+pidfile=/run/rabbitmq/rabbitmq.pid
+name=rabbitmq
+daemon=/usr/sbin/rabbitmq-server
+
+startup_log=/var/log/rabbitmq/startup_log
+startup_err=/var/log/rabbitmq/startup_err
+shutdown_log=/var/log/rabbitmq/shutdown_log
+shutdown_err=/var/log/rabbitmq/shutdown_err
+
+depend() {
+ need net localmount
+ after firewall
+}
+
+start() {
+ ebegin "Starting ${name}"
+ # We need to test if /var/run/rabbitmq exists, since scirpt will fail if it does not
+ checkpath -m 700 -o rabbitmq:rabbitmq -d "$(dirname "$pidfile")"
+ checkpath -m 644 -o rabbitmq:rabbitmq --file-truncate -f $startup_log
+ checkpath -m 644 -o rabbitmq:rabbitmq --file-truncate -f $startup_err
+ start-stop-daemon --start \
+ --env RABBITMQ_PID_FILE=$pidfile \
+ --pidfile $pidfile \
+ --stdout $startup_log \
+ --stderr $startup_err \
+ --background $daemon
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${name}"
+ checkpath -m 644 -o rabbitmq:rabbitmq --file-truncate -f $shutdown_log
+ checkpath -m 644 -o rabbitmq:rabbitmq --file-truncate -f $shutdown_err
+ start-stop-daemon --stop --quiet --pidfile $pidfile \
+ --exec /bin/sh -- -c "/usr/sbin/rabbitmqctl \
+ --stop $pidfile > $shutdown_log \
+ 2> $shutdown_err"
+ eend $?
+}
+
diff --git a/testing/rabbitmq-server/rabbitmq-server.logrotate b/testing/rabbitmq-server/rabbitmq-server.logrotate
new file mode 100644
index 0000000000..f902ed185f
--- /dev/null
+++ b/testing/rabbitmq-server/rabbitmq-server.logrotate
@@ -0,0 +1,12 @@
+/var/log/rabbitmq/*.log {
+ weekly
+ missingok
+ rotate 20
+ compress
+ delaycompress
+ notifempty
+ sharedscripts
+ postrotate
+ /usr/sbin/rabbitmqctl rotate_logs > /dev/null
+ endscript
+}
diff --git a/testing/rabbitmq-server/rabbitmq-server.post-deinstall b/testing/rabbitmq-server/rabbitmq-server.post-deinstall
new file mode 100644
index 0000000000..9c9ef7ce7b
--- /dev/null
+++ b/testing/rabbitmq-server/rabbitmq-server.post-deinstall
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+echo "Please manually remove the 'rabbitmq' user and group if no longer needed" >&2
+
+exit 0
diff --git a/testing/rabbitmq-server/rabbitmq-server.pre-install b/testing/rabbitmq-server/rabbitmq-server.pre-install
new file mode 100644
index 0000000000..bd5bae27f8
--- /dev/null
+++ b/testing/rabbitmq-server/rabbitmq-server.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S rabbitmq 2>/dev/null
+adduser -S -D -H -s /bin/false -h /usr/lib/rabbitmq -G rabbitmq \
+ -g 'RabbitMQ Server' rabbitmq 2>/dev/null
+exit 0