diff options
author | Philip Kuryloski <kuryloskip@vmware.com> | 2021-02-17 09:43:10 +0100 |
---|---|---|
committer | Philip Kuryloski <kuryloskip@vmware.com> | 2021-02-23 11:26:29 +0100 |
commit | d0413153360ed8c707f08ed6a27d72680aedc594 (patch) | |
tree | 48c1180ebd8f357d8a347cc42992279ab45317f2 | |
parent | 9f089071d279087d4e1265a029f6383745a9c62e (diff) | |
download | rabbitmq-server-git-d0413153360ed8c707f08ed6a27d72680aedc594.tar.gz |
Revert "Remove the packaging directory"
This reverts commit 2067a687351e1caf5ddb8b54b8e9118c2a74d60b.
49 files changed, 4368 insertions, 0 deletions
diff --git a/packaging/Makefile b/packaging/Makefile new file mode 100644 index 0000000000..ab656cfaab --- /dev/null +++ b/packaging/Makefile @@ -0,0 +1,120 @@ +# Platform detection. + +ifeq ($(PLATFORM),) +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Linux) +PLATFORM = linux +else ifeq ($(UNAME_S),Darwin) +PLATFORM = darwin +else ifeq ($(UNAME_S),SunOS) +PLATFORM = solaris +else ifeq ($(UNAME_S),GNU) +PLATFORM = gnu +else ifeq ($(UNAME_S),FreeBSD) +PLATFORM = freebsd +else ifeq ($(UNAME_S),NetBSD) +PLATFORM = netbsd +else ifeq ($(UNAME_S),OpenBSD) +PLATFORM = openbsd +else ifeq ($(UNAME_S),DragonFly) +PLATFORM = dragonfly +else ifeq ($(shell uname -o),Msys) +PLATFORM = msys2 +else +$(error Unable to detect platform. Please open a ticket with the output of uname -a.) +endif +endif + +all: packages + @: + +# -------------------------------------------------------------------- +# Packaging. +# -------------------------------------------------------------------- + +.PHONY: packages package-deb \ + package-rpm \ + package-rpm-redhat package-rpm-fedora \ + package-rpm-rhel6 package-rpm-rhel7 package-rpm-rhel8 \ + package-rpm-suse package-rpm-opensuse package-rpm-sles11 \ + package-windows \ + package-generic-unix \ + docker-image + +PACKAGES_DIR ?= ../PACKAGES +SOURCE_DIST_FILE ?= $(wildcard $(PACKAGES_DIR)/rabbitmq-server-*.tar.xz) + +ifneq ($(filter-out clean,$(MAKECMDGOALS)),) +ifeq ($(SOURCE_DIST_FILE),) +$(error Cannot find source archive; please specify SOURCE_DIST_FILE) +endif +ifneq ($(words $(SOURCE_DIST_FILE)),1) +$(error Multiple source archives found; please specify SOURCE_DIST_FILE) +endif +ifeq ($(filter %.tar.xz %.txz,$(SOURCE_DIST_FILE)),) +$(error The source archive must a tar.xz archive) +endif +ifeq ($(wildcard $(SOURCE_DIST_FILE)),) +$(error The source archive must exist) +endif +endif + +ifndef NO_CLEAN +DO_CLEAN := clean +endif + +VARS = SOURCE_DIST_FILE="$(abspath $(SOURCE_DIST_FILE))" \ + PACKAGES_DIR="$(abspath $(PACKAGES_DIR))" \ + SIGNING_KEY="$(SIGNING_KEY)" + +packages: package-deb package-rpm package-windows package-generic-unix + @: + +package-deb: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C debs/Debian $(VARS) all $(DO_CLEAN) + +package-rpm: package-rpm-redhat package-rpm-suse + @: + +# FIXME: Why not package-rpm-fedora? +package-rpm-redhat: package-rpm-rhel6 package-rpm-rhel7 package-rpm-rhel8 + @: + +package-rpm-fedora: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C RPMS/Fedora $(VARS) all $(DO_CLEAN) + +package-rpm-rhel6: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C RPMS/Fedora $(VARS) RPM_OS=rhel6 all $(DO_CLEAN) + +package-rpm-rhel7: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C RPMS/Fedora $(VARS) RPM_OS=rhel7 all $(DO_CLEAN) + +package-rpm-rhel8: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C RPMS/Fedora $(VARS) RPM_OS=rhel8 all $(DO_CLEAN) + +package-rpm-suse: package-rpm-opensuse package-rpm-sles11 + @: + +package-rpm-opensuse: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C RPMS/Fedora $(VARS) RPM_OS=opensuse all $(DO_CLEAN) + +package-rpm-sles11: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C RPMS/Fedora $(VARS) RPM_OS=sles11 all $(DO_CLEAN) + +package-windows: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C windows $(VARS) all $(DO_CLEAN) + $(verbose) $(MAKE) -C windows-exe $(VARS) all $(DO_CLEAN) + +package-generic-unix: $(SOURCE_DIST_FILE) + $(gen_verbose) $(MAKE) -C generic-unix $(VARS) all $(DO_CLEAN) + +docker-image: package-generic-unix + $(gen_verbose) $(MAKE) -C docker-image $(VARS) all $(DO_CLEAN) + +.PHONY: clean + +clean: + for subdir in debs/Debian RPMS/Fedora windows windows-exe generic-unix docker-image; do \ + $(MAKE) -C "$$subdir" clean; \ + done diff --git a/packaging/RPMS/Fedora/Makefile b/packaging/RPMS/Fedora/Makefile new file mode 100644 index 0000000000..475ec63ad5 --- /dev/null +++ b/packaging/RPMS/Fedora/Makefile @@ -0,0 +1,171 @@ +SOURCE_DIST_FILE ?= $(wildcard ../../../rabbitmq-server-*.tar.xz) + +ifneq ($(filter-out clean,$(MAKECMDGOALS)),) +ifeq ($(SOURCE_DIST_FILE),) +$(error Cannot find source archive; please specify SOURCE_DIST_FILE) +endif +ifneq ($(words $(SOURCE_DIST_FILE)),1) +$(error Multiple source archives found; please specify SOURCE_DIST_FILE) +endif +endif + +VERSION ?= $(patsubst rabbitmq-server-%.tar.xz,%,$(notdir $(SOURCE_DIST_FILE))) +ifeq ($(VERSION),) +$(error Cannot determine version; please specify VERSION) +endif + +# $(RPM_VERSION) doesn't include the package revision: this one is only +# set in the .spec file. +RPM_VERSION = $(subst -,~,$(VERSION)) +RPM_ORIG_TARBALL = rabbitmq-server-$(VERSION).tar.xz + +TOP_DIR = $(shell pwd) +# Under debian we do not want to check build dependencies, since that +# only checks build-dependencies using rpms, not debs +DEFINES = --define 'upstream_version $(VERSION)' \ + --define '_topdir $(TOP_DIR)' --define '_tmppath $(TOP_DIR)/tmp' \ + --define '_sysconfdir /etc' --define '_localstatedir /var' + +RPM_OS ?= fedora +DO_SIGN ?= yes + +ifeq "$(RPM_OS)" "sles11" +FUNCTION_LIBRARY= +REQUIRES=/sbin/chkconfig /sbin/service +OS_DEFINES=--define '_initrddir /etc/init.d' --define 'dist .sles11' --define 'suse_version 1012' +SPEC_DEFINES=--define 'group_tag Productivity/Networking/Other' +START_PROG=startproc +DO_SIGN=no +else ifeq "$(RPM_OS)" "opensuse" +FUNCTION_LIBRARY= +REQUIRES=/sbin/chkconfig /sbin/service +OS_DEFINES=--define '_unitdir /usr/lib/systemd/system' --define 'dist .suse' --define 'suse_version 1315' +SPEC_DEFINES=--define 'group_tag Productivity/Networking/Other' +START_PROG=startproc +else +FUNCTION_LIBRARY=\# Source function library.\n. /etc/init.d/functions +REQUIRES=chkconfig initscripts +OS_DEFINES=--define '_initrddir /etc/rc.d/init.d' +ifeq "$(RPM_OS)" "rhel6" +SPEC_DEFINES=--define 'group_tag Development/Libraries' --define 'dist .el6' --define 'rhel 6' +else ifeq "$(RPM_OS)" "rhel7" +SPEC_DEFINES=--define 'group_tag Development/Libraries' --define '_unitdir /usr/lib/systemd/system' --define 'dist .el7' --define 'rhel 7' +else ifeq "$(RPM_OS)" "rhel8" +SPEC_DEFINES=--define 'group_tag Development/Libraries' --define '_unitdir /usr/lib/systemd/system' --define 'dist .el8' --define 'rhel 8' +else +SPEC_DEFINES=--define 'group_tag Development/Libraries' +endif +START_PROG=daemon +endif + +# Package signing. +# +# At least the key ID is mandatory ($(SIGNING_KEY)). If it's set, we +# call `rpm --addsign`, otherwise we do nothing. +# +# To maintain backward compatibility, the caller can also specify +# $(KEYSDIR) or $(GNUPG_PATH) and we set GNUPGHOME accordingly. + +ifneq ($(KEYSDIR),) + GNUPGHOME = $(KEYSDIR)/keyring/.gnupg + export GNUPGHOME +endif +ifneq ($(GNUPG_PATH),) + GNUPGHOME = $(GNUPG_PATH)/.gnupg + export GNUPGHOME +endif + +unexport DEPS_DIR +unexport ERL_LIBS +MAKEOVERRIDES = + +.PHONY: all package clean + +all: package + @: + +package: clean +# Log Erlang version. + @echo + @echo '--------------------------------------------------' + @echo "Erlang and Elixir versions used to compile:" + @elixir --version + @echo '--------------------------------------------------' + @echo +# If a signing key ID was specified, verify that the key is available +# before starting a possibly long build. At the same time, display some +# useful informations on the key so the caller can double-check if he +# wants. +ifneq ($(SIGNING_KEY),) +ifeq ($(DO_SIGN),yes) + @echo + @echo '--------------------------------------------------' + @echo "The package will be signed with key $(SIGNING_KEY):" + @gpg -K "$(SIGNING_KEY)" + @echo '--------------------------------------------------' + @echo +else + @echo + @echo '--------------------------------------------------' + @echo "Packages of type '$(RPM_OS)' are not signed because" + @echo "the signature can't be verified on the target OS" + @echo '--------------------------------------------------' + @echo +endif +endif +# Create the build tree and populate it. + mkdir -p BUILD SOURCES SPECS SRPMS RPMS tmp + cp $(SOURCE_DIST_FILE) SOURCES/$(RPM_ORIG_TARBALL) + cp rabbitmq-server.spec SPECS/rabbitmq-server.spec.in + cp rabbitmq-server.service SOURCES/rabbitmq-server.service + cp rabbitmq-server.tmpfiles SOURCES/rabbitmq-server.tmpfiles + sed \ + -e 's|^START_PROG=.*$$|START_PROG="$(START_PROG)"|' \ + -e 's|^@FUNCTION_LIBRARY@|$(FUNCTION_LIBRARY)|' \ + < rabbitmq-server.init \ + > SOURCES/rabbitmq-server.init + cp rabbitmq-server.logrotate SOURCES/rabbitmq-server.logrotate +# Possibly update the changelog inside the spec (in the created build +# directory): +# - if it contains an entry for the specified version, do nothing; +# - otherwise, prepend a generated entry using "1" as the package +# revision. + scripts/update-changelog.sh SPECS/rabbitmq-server.spec.in "$(RPM_VERSION)" + sed -e 's|%%VERSION%%|$(RPM_VERSION)|;s|%%REQUIRES%%|$(REQUIRES)|' \ + < SPECS/rabbitmq-server.spec.in \ + > SPECS/rabbitmq-server.spec +# Finally build the package! + rpmbuild -ba --nodeps SPECS/rabbitmq-server.spec $(DEFINES) \ + $(OS_DEFINES) $(SPEC_DEFINES) +# Before we remove the source directory, copy the possibly updated +# debian/changelog to the original debian subdirectory, if the caller +# asks for it. He is then responsible for committing it. +ifeq ($(SAVE_CHANGELOG),yes) + mv SPECS/rabbitmq-server.spec.in rabbitmq-server.spec +endif + rm -rf SOURCES SPECS BUILD tmp +# If a PGP key is specified, sign source and binary packages. We start +# rpm(1) in a new session and redirect its stdin so that it doesn't +# prompt for a passphrase. +# https://ask.fedoraproject.org/en/question/56107/can-gpg-agent-be-used-when-signing-rpm-packages/?answer=76395#post-id-76395 +ifeq ($(DO_SIGN),yes) +ifneq ($(SIGNING_KEY),) + setsid \ + rpm --addsign \ + --define '_signature gpg' \ + --define '_gpg_name $(SIGNING_KEY)' \ + SRPMS/*-$(RPM_VERSION)*.rpm \ + RPMS/noarch/*-$(RPM_VERSION)*.rpm \ + < /dev/null +endif +endif +# If $(PACKAGES_DIR) is specified, move all package files to that +# location. +ifneq ($(PACKAGES_DIR),) + mkdir -p "$(PACKAGES_DIR)" + mv SRPMS/*-$(RPM_VERSION)*.rpm RPMS/noarch/*-$(RPM_VERSION)*.rpm \ + "$(PACKAGES_DIR)" +endif + +clean: + rm -rf SOURCES SPECS RPMS SRPMS BUILD tmp diff --git a/packaging/RPMS/Fedora/rabbitmq-server.init b/packaging/RPMS/Fedora/rabbitmq-server.init new file mode 100644 index 0000000000..0b848ff6d9 --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server.init @@ -0,0 +1,192 @@ +#!/bin/sh +# +# rabbitmq-server RabbitMQ broker +# +# chkconfig: - 80 05 +# description: RabbitMQ is a multi-protocol messaging broker +# + +### BEGIN INIT INFO +# Provides: rabbitmq-server +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: RabbitMQ broker +# Short-Description: RabbitMQ is a multi-protocol messaging broker +### END INIT INFO + +@FUNCTION_LIBRARY@ + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +NAME=rabbitmq-server +DAEMON=/usr/sbin/${NAME} +CONTROL=/usr/sbin/rabbitmqctl +DESC=rabbitmq-server +USER=rabbitmq +PID_FILE=/var/run/rabbitmq/pid +RABBITMQ_STARTUP_TIMEOUT=600 + +START_PROG= # Set when building package +LOCK_FILE=/var/lock/subsys/$NAME + +test -x $DAEMON || exit 0 +test -x $CONTROL || exit 0 + +RETVAL=0 +set -e + +[ -f /etc/default/${NAME} ] && . /etc/default/${NAME} + +# $RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR is a directory where rabbitmq-server(8) +# console output (both stdout and sterr) is redirected. It defaults to +# /var/log/rabbitmq which is configured by the package already (i.e. the +# directory is created and its ownership is set). +# +# We still look at the value of $RABBITMQ_LOG_BASE, possibly set in +# /etc/default/rabbitmq-server for backward compatibility. But we use a +# specific variable name here (instead of $RABBITMQ_LOG_BASE) to avoid any +# confusion with RabbitMQ's own logging configuration. Indeed, the console +# output redirection is a responsibility of the package, not RabbitMQ itself. +: ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR:=${RABBITMQ_LOG_BASE:-/var/log/rabbitmq}} + +ensure_pid_dir () { + PID_DIR=`dirname ${PID_FILE}` + if [ ! -d ${PID_DIR} ] ; then + mkdir -p ${PID_DIR} + chown -R ${USER}:${USER} ${PID_DIR} + chmod 755 ${PID_DIR} + fi +} + +remove_pid () { + rm -f ${PID_FILE} + rmdir `dirname ${PID_FILE}` || : +} + +start_rabbitmq () { + status_rabbitmq quiet + if [ $RETVAL = 0 ] ; then + echo RabbitMQ is currently running + else + RETVAL=0 + ensure_pid_dir + set +e + RABBITMQ_PID_FILE=$PID_FILE $START_PROG $DAEMON \ + > "${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/startup_log" \ + 2> "${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/startup_err" \ + 0<&- & + $CONTROL wait --timeout $RABBITMQ_STARTUP_TIMEOUT $PID_FILE >/dev/null 2>&1 + RETVAL=$? + set -e + case "$RETVAL" in + 0) + echo SUCCESS + if [ -n "$LOCK_FILE" ] ; then + touch $LOCK_FILE + fi + ;; + *) + remove_pid + echo FAILED - check ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/startup_\{log, _err\} + RETVAL=1 + ;; + esac + fi +} + +stop_rabbitmq () { + status_rabbitmq quiet + if [ $RETVAL = 0 ] ; then + set +e + $CONTROL stop ${PID_FILE} \ + > ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/shutdown_log \ + 2> ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/shutdown_err + RETVAL=$? + set -e + if [ $RETVAL = 0 ] ; then + remove_pid + if [ -n "$LOCK_FILE" ] ; then + rm -f $LOCK_FILE + fi + else + echo FAILED - check ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/shutdown_\{log, _err\} + fi + else + echo RabbitMQ is not running + RETVAL=0 + fi +} + +status_rabbitmq() { + set +e + if [ "$1" != "quiet" ] ; then + $CONTROL status 2>&1 + else + $CONTROL status > /dev/null 2>&1 + fi + if [ $? != 0 ] ; then + RETVAL=3 + fi + set -e +} + +rotate_logs_rabbitmq() { + set +e + $CONTROL rotate_logs + if [ $? != 0 ] ; then + RETVAL=1 + fi + set -e +} + +restart_running_rabbitmq () { + status_rabbitmq quiet + if [ $RETVAL = 0 ] ; then + restart_rabbitmq + else + echo RabbitMQ is not runnning + RETVAL=0 + fi +} + +restart_rabbitmq() { + stop_rabbitmq + start_rabbitmq +} + +case "$1" in + start) + echo -n "Starting $DESC: " + start_rabbitmq + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + stop_rabbitmq + echo "$NAME." + ;; + status) + status_rabbitmq + ;; + rotate-logs) + echo -n "Rotating log files for $DESC: " + rotate_logs_rabbitmq + ;; + force-reload|reload|restart) + echo -n "Restarting $DESC: " + restart_rabbitmq + echo "$NAME." + ;; + try-restart) + echo -n "Restarting $DESC: " + restart_running_rabbitmq + echo "$NAME." + ;; + *) + echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2 + RETVAL=1 + ;; +esac + +exit $RETVAL diff --git a/packaging/RPMS/Fedora/rabbitmq-server.logrotate b/packaging/RPMS/Fedora/rabbitmq-server.logrotate new file mode 100644 index 0000000000..21a9fc0b84 --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server.logrotate @@ -0,0 +1,7 @@ +/var/log/rabbitmq/*.log { + weekly + missingok + rotate 20 + compress + notifempty +} diff --git a/packaging/RPMS/Fedora/rabbitmq-server.service b/packaging/RPMS/Fedora/rabbitmq-server.service new file mode 100644 index 0000000000..4002a6517e --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server.service @@ -0,0 +1,41 @@ +[Unit] +Description=RabbitMQ broker +After=syslog.target network.target + +[Service] +Type=notify +User=rabbitmq +Group=rabbitmq +UMask=0027 +NotifyAccess=all +TimeoutStartSec=600 + +# To override LimitNOFILE, create the following file: +# +# /etc/systemd/system/rabbitmq-server.service.d/limits.conf +# +# with the following content: +# +# [Service] +# LimitNOFILE=65536 + +LimitNOFILE=32768 + +# Note: systemd on CentOS 7 complains about in-line comments, +# so only append them here +# +# Restart: +# The following setting will automatically restart RabbitMQ +# in the event of a failure. systemd service restarts are not a +# replacement for service monitoring. Please see +# https://www.rabbitmq.com/monitoring.html +Restart=on-failure +RestartSec=10 +WorkingDirectory=/var/lib/rabbitmq +ExecStart=/usr/sbin/rabbitmq-server +ExecStop=/usr/sbin/rabbitmqctl shutdown +# See rabbitmq/rabbitmq-server-release#51 +SuccessExitStatus=69 + +[Install] +WantedBy=multi-user.target diff --git a/packaging/RPMS/Fedora/rabbitmq-server.spec b/packaging/RPMS/Fedora/rabbitmq-server.spec new file mode 100644 index 0000000000..48bf1b1f2b --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server.spec @@ -0,0 +1,520 @@ +%define debug_package %{nil} +%define erlang_minver 22.3 + +Name: rabbitmq-server +Version: %%VERSION%% +Release: 1%{?dist} +License: MPLv2.0 and MIT and ASL 2.0 and BSD +Group: %{group_tag} +Source: https://www.rabbitmq.com/releases/rabbitmq-server/v%{upstream_version}/%{name}-%{upstream_version}.tar.xz +Source1: rabbitmq-server.init +Source2: rabbitmq-server.logrotate +Source3: rabbitmq-server.service +Source4: rabbitmq-server.tmpfiles +URL: https://www.rabbitmq.com/ +BuildArch: noarch +BuildRequires: erlang >= %{erlang_minver} +BuildRequires: elixir +BuildRequires: gzip, sed, zip, rsync + +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 +BuildRequires: systemd +%endif + +Requires: erlang >= %{erlang_minver} +Requires: logrotate, socat +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{_arch}-root +Summary: The RabbitMQ server + +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 +Requires(pre): systemd +Requires(post): systemd +Requires(preun): systemd +%else +Requires(post): %%REQUIRES%% +Requires(pre): %%REQUIRES%% +%endif + +%description +RabbitMQ is an open source multi-protocol messaging broker. + +# We want to install into /usr/lib, even on 64-bit platforms +%define _rabbit_libdir %{_exec_prefix}/lib/rabbitmq +%define _rabbit_erllibdir %{_rabbit_libdir}/lib/rabbitmq_server-%{upstream_version} +%define _rabbit_server_ocf scripts/rabbitmq-server.ocf +%define _plugins_state_dir %{_localstatedir}/lib/rabbitmq/plugins +%define _rabbit_server_ha_ocf scripts/rabbitmq-server-ha.ocf +%define _rabbitmqctl_autocomplete scripts/rabbitmqctl-autocomplete.sh +%define _rabbitmq_user rabbitmq +%define _rabbitmq_group rabbitmq + + +%define _maindir %{buildroot}%{_rabbit_erllibdir} + + +%prep +%setup -q -n %{name}-%{upstream_version} + +%build +cp -a deps/rabbit/docs/README-for-packages %{_builddir}/rabbitmq-server-%{upstream_version}/README +env -u DEPS_DIR make dist manpages + +%install +rm -rf %{buildroot} + +env -u DEPS_DIR make install install-bin install-man DESTDIR=%{buildroot} PREFIX=%{_exec_prefix} RMQ_ROOTDIR=%{_rabbit_libdir} RMQ_ERLAPP_DIR=%{_rabbit_erllibdir} MANDIR=%{_mandir} + +mkdir -p %{buildroot}%{_localstatedir}/lib/rabbitmq/mnesia +mkdir -p %{buildroot}%{_localstatedir}/log/rabbitmq + +#Copy all necessary lib files etc. + +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 +install -p -D -m 0644 %{S:3} %{buildroot}%{_unitdir}/%{name}.service +%else +install -p -D -m 0755 %{S:1} %{buildroot}%{_initrddir}/rabbitmq-server +%endif + +install -p -D -m 0755 %{_rabbit_server_ocf} %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server +install -p -D -m 0755 %{_rabbit_server_ha_ocf} %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server-ha +install -p -D -m 0644 %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/rabbitmq-server + +install -p -D -m 0755 %{_rabbitmqctl_autocomplete} %{buildroot}%{_sysconfdir}/profile.d/rabbitmqctl-autocomplete.sh +install -p -D -m 0755 scripts/zsh_autocomplete.sh %{buildroot}%{_datarootdir}/zsh/vendor-functions/_enable_rabbitmqctl_completion + + +mkdir -p %{buildroot}%{_sysconfdir}/rabbitmq + +mkdir -p %{buildroot}%{_sbindir} +sed \ + -e 's|@RABBITMQ_USER@|%{_rabbitmq_user}|' -e 's|@RABBITMQ_GROUP@|%{_rabbitmq_group}|' \ + < scripts/rabbitmq-script-wrapper \ + > %{buildroot}%{_sbindir}/rabbitmqctl +chmod 0755 %{buildroot}%{_sbindir}/rabbitmqctl +for script in rabbitmq-server rabbitmq-plugins rabbitmq-diagnostics rabbitmq-queues rabbitmq-upgrade; do \ + cp -a %{buildroot}%{_sbindir}/rabbitmqctl \ + %{buildroot}%{_sbindir}/$script; \ +done + +%if 0%{?fedora} > 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 +install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf +%endif + +rm %{_maindir}/LICENSE* %{_maindir}/INSTALL + +#Build the list of files +echo '%defattr(-,root,root, -)' >%{_builddir}/%{name}.files +find %{buildroot} -path %{buildroot}%{_sysconfdir} -prune -o '!' -type d -printf "/%%P\n" >>%{_builddir}/%{name}.files +find %{buildroot} -path "*%{_initrddir}*" -type f -printf "/%%P\n" >>%{_builddir}/%{name}.files + +%pre + +# If the log directory exists, record its permissions so we can restore +# them after an upgrade. The goal is to set the permissions to 0750 on a +# fresh install but to keep permissions set by the user or a different +# default from a previous package. +if test -d /var/log/rabbitmq; then + stat --format '%a' /var/log/rabbitmq > /var/log/rabbitmq/permissions +fi + +if [ "$1" = 2 ]; then + # Upgrade: + # Stop previous instance of rabbitmq-server. But before doing this, we + # also record if the service is running: it is used again in %post to + # restart the service. + if %{_sbindir}/rabbitmqctl status >/dev/null 2>&1; then + touch %{_localstatedir}/lib/rabbitmq/rabbitmq-running-before-upgrade + else + rm -f %{_localstatedir}/lib/rabbitmq/rabbitmq-running-before-upgrade + fi + +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 + systemctl stop rabbitmq-server +%else + /sbin/service rabbitmq-server stop +%endif +fi + +# create rabbitmq group +if ! getent group rabbitmq >/dev/null; then + groupadd -r rabbitmq +fi + +# create rabbitmq user +if ! getent passwd rabbitmq >/dev/null; then + useradd -r -g rabbitmq -d %{_localstatedir}/lib/rabbitmq -s /sbin/nologin rabbitmq \ + -c "RabbitMQ messaging server" +fi + +%post + +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 +# %%systemd_post %%{name}.service +# manual expansion of systemd_post as this doesn't appear to +# expand correctly on debian machines +if [ $1 -eq 1 ] ; then + # Initial installation + systemctl preset %{name}.service >/dev/null 2>&1 || : +fi +systemctl daemon-reload +%else +/sbin/chkconfig --add %{name} +%endif + +chmod -R o-rwx,g-w %{_localstatedir}/lib/rabbitmq/mnesia +chgrp rabbitmq %{_sysconfdir}/rabbitmq + +# Restore permissions saved during %pre. See comment in %pre for the +# reason behind this. +if test -f /var/log/rabbitmq/permissions; then + chmod "$(cat /var/log/rabbitmq/permissions)" /var/log/rabbitmq + rm -f /var/log/rabbitmq/permissions +fi + +if [ "$1" = 2 ] ; then + # Upgrade: + # Restart the service if it was running before the upgrade. + if [ -f %{_localstatedir}/lib/rabbitmq/rabbitmq-running-before-upgrade ]; then +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 + # %%systemd_postun_with_restart %%{name}.service + # manual expansion of systemd_postun_with_restart as this doesn't appear to + # expand correctly on debian machines + systemctl restart %{name}.service >/dev/null 2>&1 || : +%else + /sbin/service %{name} restart +%endif + rm -f %{_localstatedir}/lib/rabbitmq/rabbitmq-running-before-upgrade + fi +fi + +if [ -n "$ZSH_VERSION" ]; then + echo "Z Shell detected. +to enable rabbitmqctl autocompletion add the following to your .zshrc file: +autoload _enable_rabbitmqctl_completion; _enable_rabbitmqctl_completion" +fi + +%preun + +if [ $1 = 0 ]; then + #Complete uninstall +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 + systemctl stop rabbitmq-server +%else + /sbin/service rabbitmq-server stop + /sbin/chkconfig --del rabbitmq-server +%endif + + # We do not remove /var/log and /var/lib directories + # Leave rabbitmq user and group +fi + +# Clean out plugin activation state, both on uninstall and upgrade +rm -rf %{_plugins_state_dir} +for ext in rel script boot ; do + rm -f %{_rabbit_erllibdir}/ebin/rabbit.$ext +done + +%postun + +%if 0%{?fedora} > 17 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1315 +# For prior versions older than this, do a conversion +# from sysv to systemd +%triggerun -- %{name} < 3.6.5 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply opensips +# to migrate them to systemd targets +systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del %{name} >/dev/null 2>&1 || : +systemctl try-restart %{name}.service >/dev/null 2>&1 || : +%endif + +%files -f ../%{name}.files +%defattr(-,root,root,-) +%attr(0755, rabbitmq, rabbitmq) %dir %{_localstatedir}/lib/rabbitmq +%attr(0750, rabbitmq, rabbitmq) %dir %{_localstatedir}/lib/rabbitmq/mnesia +%attr(0755, rabbitmq, rabbitmq) %dir %{_localstatedir}/log/rabbitmq +%attr(2755, -, rabbitmq) %dir %{_sysconfdir}/rabbitmq + +%{_sysconfdir}/profile.d/rabbitmqctl-autocomplete.sh +%{_datarootdir}/zsh/vendor-functions/_enable_rabbitmqctl_completion + +%config(noreplace) %{_sysconfdir}/logrotate.d/rabbitmq-server +%doc LICENSE* +%doc README +%doc deps/rabbit/docs/set_rabbitmq_policy.sh.example + +%clean +rm -rf %{buildroot} + +%changelog +* Sun Sep 8 2019 info@rabbitmq.com 3.8.0~rc.1-1 +- New upstream release. + +* Tue Aug 20 2019 info@rabbitmq.com 3.8.0~beta.7-1 +- New upstream release. + +* Sun Aug 4 2019 info@rabbitmq.com 3.8.0~beta.6-1 +- New upstream release. + +* Tue Jul 9 2019 info@rabbitmq.com 3.8.0~beta.5-1 +- New upstream release. + +* Fri May 10 2019 info@rabbitmq.com 3.8.0~beta.4-1 +- New upstream release. + +* Wed Mar 6 2019 info@rabbitmq.com 3.8.0~beta.3-1 +- New upstream release. + +* Thu Jan 31 2019 info@rabbitmq.com 3.8.0~beta.2-1 +- New upstream release. + +* Thu Nov 8 2018 info@rabbitmq.com 3.8.0~beta.1-1 +- New upstream release. + +* Wed Dec 13 2017 info@rabbitmq.com 3.7.1~beta.1-1 +- New upstream release. + +* Wed Nov 29 2017 info@rabbitmq.com 3.7.0-1 +- New upstream release. + +* Thu Nov 16 2017 info@rabbitmq.com 3.7.0~rc.2-1 +- New upstream release. + +* Mon Sep 18 2017 info@rabbitmq.com 3.7.0~rc.1-1 +- New upstream release. + +* Tue Sep 12 2017 info@rabbitmq.com 3.7.0~beta.20-1 +- New upstream release. + +* Mon Sep 11 2017 michael@rabbitmq.com 3.6.12-1 +- New Upstream Release + +* Wed Aug 16 2017 michael@rabbitmq.com 3.6.11-1 +- New Upstream Release + +* Thu May 25 2017 michael@rabbitmq.com 3.6.10-1 +- New Upstream Release + +* Wed Mar 29 2017 michael@rabbitmq.com 3.6.9-1 +- New Upstream Release + +* Fri Mar 17 2017 michael@rabbitmq.com 3.6.8-1 +- New Upstream Release + +* Wed Mar 15 2017 michael@rabbitmq.com 3.6.7-1 +- New Upstream Release + +* Mon Nov 21 2016 michael@rabbitmq.com 3.6.6-1 +- New Upstream Release + +* Fri Aug 5 2016 michael@rabbitmq.com 3.6.5-1 +- New Upstream Release + +* Fri Jul 29 2016 michael@rabbitmq.com 3.6.4-1 +- New Upstream Release + +* Wed Jul 6 2016 michael@rabbitmq.com 3.6.3-1 +- New Upstream Release + +* Thu May 19 2016 michael@rabbitmq.com 3.6.2-1 +- New Upstream Release + +* Tue Mar 1 2016 michael@rabbitmq.com 3.6.1-1 +- New Upstream Release + +* Tue Dec 22 2015 michael@rabbitmq.com 3.6.0-1 +- New Upstream Release + +* Tue Dec 15 2015 michael@rabbitmq.com 3.5.7-1 +- New Upstream Release + +* Wed Oct 7 2015 michael@rabbitmq.com 3.5.6-1 +- New Upstream Release + +* Thu Sep 24 2015 jean-sebastien@rabbitmq.com 3.5.5-3 +- Fix bashism in rabbitmq-script-wrapper + +* Thu Sep 24 2015 jean-sebastien@rabbitmq.com 3.5.5-1 +- New Upstream Release + +* Tue Jul 21 2015 michael@rabbitmq.com 3.5.4-1 +- New Upstream Release + +* Fri May 22 2015 jean-sebastien@rabbitmq.com 3.5.3-1 +- New Upstream Release + +* Tue May 12 2015 jean-sebastien@rabbitmq.com 3.5.2-1 +- New Upstream Release + +* Thu Apr 2 2015 michael@rabbitmq.com 3.5.1-1 +- New Upstream Release + +* Wed Mar 11 2015 jean-sebastien@rabbitmq.com 3.5.0-1 +- New Upstream Release + +* Wed Feb 11 2015 michael@rabbitmq.com 3.4.4-1 +- New Upstream Release + +* Tue Jan 6 2015 jean-sebastien@rabbitmq.com 3.4.3-1 +- New Upstream Release + +* Wed Nov 26 2014 simon@rabbitmq.com 3.4.2-1 +- New Upstream Release + +* Wed Oct 29 2014 simon@rabbitmq.com 3.4.1-1 +- New Upstream Release + +* Tue Oct 21 2014 simon@rabbitmq.com 3.4.0-1 +- New Upstream Release + +* Mon Aug 11 2014 simon@rabbitmq.com 3.3.5-1 +- New Upstream Release + +* Tue Jun 24 2014 simon@rabbitmq.com 3.3.4-1 +- New Upstream Release + +* Mon Jun 16 2014 simon@rabbitmq.com 3.3.3-1 +- New Upstream Release + +* Mon Jun 9 2014 simon@rabbitmq.com 3.3.2-1 +- New Upstream Release + +* Tue Apr 29 2014 simon@rabbitmq.com 3.3.1-1 +- New Upstream Release + +* Wed Apr 2 2014 simon@rabbitmq.com 3.3.0-1 +- New Upstream Release + +* Mon Mar 3 2014 simon@rabbitmq.com 3.2.4-1 +- New Upstream Release + +* Thu Jan 23 2014 emile@rabbitmq.com 3.2.3-1 +- New Upstream Release + +* Tue Dec 10 2013 emile@rabbitmq.com 3.2.2-1 +- New Upstream Release + +* Wed Oct 23 2013 emile@rabbitmq.com 3.2.0-1 +- New Upstream Release + +* Thu Aug 15 2013 simon@rabbitmq.com 3.1.5-1 +- New Upstream Release + +* Tue Jun 25 2013 tim@rabbitmq.com 3.1.3-1 +- New Upstream Release + +* Mon Jun 24 2013 tim@rabbitmq.com 3.1.2-1 +- New Upstream Release + +* Mon May 20 2013 tim@rabbitmq.com 3.1.1-1 +- Test release + +* Wed May 1 2013 simon@rabbitmq.com 3.1.0-1 +- New Upstream Release + +* Tue Dec 11 2012 simon@rabbitmq.com 3.0.1-1 +- New Upstream Release + +* Fri Nov 16 2012 simon@rabbitmq.com 3.0.0-1 +- New Upstream Release + +* Fri Dec 16 2011 steve@rabbitmq.com 2.7.1-1 +- New Upstream Release + +* Tue Nov 8 2011 steve@rabbitmq.com 2.7.0-1 +- New Upstream Release + +* Fri Sep 9 2011 tim@rabbitmq.com 2.6.1-1 +- New Upstream Release + +* Fri Aug 26 2011 tim@rabbitmq.com 2.6.0-1 +- New Upstream Release + +* Mon Jun 27 2011 simon@rabbitmq.com 2.5.1-1 +- New Upstream Release + +* Thu Jun 9 2011 jerryk@vmware.com 2.5.0-1 +- New Upstream Release + +* Thu Apr 7 2011 Alexandru Scvortov <alexandru@rabbitmq.com> 2.4.1-1 +- New Upstream Release + +* Tue Mar 22 2011 Alexandru Scvortov <alexandru@rabbitmq.com> 2.4.0-1 +- New Upstream Release + +* Thu Feb 3 2011 simon@rabbitmq.com 2.3.1-1 +- New Upstream Release + +* Tue Feb 1 2011 simon@rabbitmq.com 2.3.0-1 +- New Upstream Release + +* Mon Nov 29 2010 rob@rabbitmq.com 2.2.0-1 +- New Upstream Release + +* Tue Oct 19 2010 vlad@rabbitmq.com 2.1.1-1 +- New Upstream Release + +* Tue Sep 14 2010 marek@rabbitmq.com 2.1.0-1 +- New Upstream Release + +* Mon Aug 23 2010 mikeb@rabbitmq.com 2.0.0-1 +- New Upstream Release + +* Wed Jul 14 2010 Emile Joubert <emile@rabbitmq.com> 1.8.1-1 +- New Upstream Release + +* Tue Jun 15 2010 Matthew Sackman <matthew@rabbitmq.com> 1.8.0-1 +- New Upstream Release + +* Mon Feb 15 2010 Matthew Sackman <matthew@lshift.net> 1.7.2-1 +- New Upstream Release + +* Fri Jan 22 2010 Matthew Sackman <matthew@lshift.net> 1.7.1-1 +- New Upstream Release + +* Mon Oct 5 2009 David Wragg <dpw@lshift.net> 1.7.0-1 +- New upstream release + +* Wed Jun 17 2009 Matthias Radestock <matthias@lshift.net> 1.6.0-1 +- New upstream release + +* Tue May 19 2009 Matthias Radestock <matthias@lshift.net> 1.5.5-1 +- Maintenance release for the 1.5.x series + +* Mon Apr 6 2009 Matthias Radestock <matthias@lshift.net> 1.5.4-1 +- Maintenance release for the 1.5.x series + +* Tue Feb 24 2009 Tony Garnock-Jones <tonyg@lshift.net> 1.5.3-1 +- Maintenance release for the 1.5.x series + +* Mon Feb 23 2009 Tony Garnock-Jones <tonyg@lshift.net> 1.5.2-1 +- Maintenance release for the 1.5.x series + +* Mon Jan 19 2009 Ben Hood <0x6e6562@gmail.com> 1.5.1-1 +- Maintenance release for the 1.5.x series + +* Wed Dec 17 2008 Matthias Radestock <matthias@lshift.net> 1.5.0-1 +- New upstream release + +* Thu Jul 24 2008 Tony Garnock-Jones <tonyg@lshift.net> 1.4.0-1 +- New upstream release + +* Mon Mar 3 2008 Adrien Pierard <adrian@lshift.net> 1.3.0-1 +- New upstream release + +* Wed Sep 26 2007 Simon MacMullen <simon@lshift.net> 1.2.0-1 +- New upstream release + +* Wed Aug 29 2007 Simon MacMullen <simon@lshift.net> 1.1.1-1 +- New upstream release + +* Mon Jul 30 2007 Simon MacMullen <simon@lshift.net> 1.1.0-1.alpha +- New upstream release + +* Tue Jun 12 2007 Hubert Plociniczak <hubert@lshift.net> 1.0.0-1.20070607 +- Building from source tarball, added starting script, stopping + +* Mon May 21 2007 Hubert Plociniczak <hubert@lshift.net> 1.0.0-1.alpha +- Initial build of server library of RabbitMQ package diff --git a/packaging/RPMS/Fedora/rabbitmq-server.tmpfiles b/packaging/RPMS/Fedora/rabbitmq-server.tmpfiles new file mode 100644 index 0000000000..c2681827e0 --- /dev/null +++ b/packaging/RPMS/Fedora/rabbitmq-server.tmpfiles @@ -0,0 +1 @@ +D /var/run/rabbitmq 0755 rabbitmq rabbitmq - diff --git a/packaging/RPMS/Fedora/scripts/compare-rpm-versions.py b/packaging/RPMS/Fedora/scripts/compare-rpm-versions.py new file mode 100755 index 0000000000..874af0281b --- /dev/null +++ b/packaging/RPMS/Fedora/scripts/compare-rpm-versions.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python2 + +import os.path +import rpm +import sys + +if len(sys.argv) != 3: + print('Syntax: %s <version a> <version b>' % (os.path.basename(sys.argv[0]))) + sys.exit(64) + +a = sys.argv[1] +b = sys.argv[2] + +def parse_rpm_version(v): + splitted = v.split(':', 1) + try: + epoch = splitted[0] + v = splitted[1] + except IndexError: + epoch = '0' + + splitted = v.split('-', 1) + version = splitted[0] + try: + release = splitted[1] + except IndexError: + release = '' + + return (epoch, version, release) + +a_parsed = parse_rpm_version(a) +b_parsed = parse_rpm_version(b) + +vc = rpm.labelCompare(a_parsed, b_parsed) + +if vc > 0: + print('%s < %s' % (b, a)) +elif vc == 0: + print('%s = %s' % (a, b)) +elif vc < 0: + print('%s < %s' % (a, b)) diff --git a/packaging/RPMS/Fedora/scripts/format-package-version b/packaging/RPMS/Fedora/scripts/format-package-version new file mode 100755 index 0000000000..9239b53af9 --- /dev/null +++ b/packaging/RPMS/Fedora/scripts/format-package-version @@ -0,0 +1,8 @@ +#!/bin/sh +# vim:sw=2:et: + +set -e + +VERSION=$1 + +echo "$VERSION" | sed -E -e 's/-/~/g' diff --git a/packaging/RPMS/Fedora/scripts/parse-changelog.sh b/packaging/RPMS/Fedora/scripts/parse-changelog.sh new file mode 100755 index 0000000000..35eeddcee2 --- /dev/null +++ b/packaging/RPMS/Fedora/scripts/parse-changelog.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +awk ' +/^%changelog/ { + in_changelog = 1; + next; +} +{ + if (in_changelog) { + print; + } +}' "$@" diff --git a/packaging/RPMS/Fedora/scripts/update-changelog.sh b/packaging/RPMS/Fedora/scripts/update-changelog.sh new file mode 100755 index 0000000000..52043dc69a --- /dev/null +++ b/packaging/RPMS/Fedora/scripts/update-changelog.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# vim:sw=2:et: + +set -e + +case $# in + 1) + SPEC=$(dirname "$0")/../rabbitmq-server.spec + PACKAGE_VERSION=$1 + ;; + 2) + SPEC=$1 + PACKAGE_VERSION=$2 + ;; +esac + +SCRIPT=$(basename "$0") +SCRIPTS_DIR=$(dirname "$0") + +if test -z "$SPEC" -o ! -f "$SPEC" -o -z "$PACKAGE_VERSION"; then + echo "Syntax: $SCRIPT [<spec file>] <rpm version>" 1>&2 + exit 64 +fi + +if "$SCRIPTS_DIR/parse-changelog.sh" "$SPEC" | \ + grep -E -q "^\*.+ ${PACKAGE_VERSION}-[^ ]+$"; then + exit 0 +fi + +CHANGELOG_PKG_REV=1 +CHANGELOG_EMAIL='info@rabbitmq.com' +CHANGELOG_COMMENT='New upstream release.' + +awk " +/^Release:/ { + if (!release_modified) { + release = \$0; + sub(/[0-9]+/, \"${CHANGELOG_PKG_REV}\", release); + print release; + release_modified = 1; + next; + } +} +/^%changelog/ { + print; + print \"* $(date +'%a %b %-d %Y') ${CHANGELOG_EMAIL} ${PACKAGE_VERSION}-${CHANGELOG_PKG_REV}\"; + print \"- ${CHANGELOG_COMMENT}\"; + print \"\"; + next; +} +{ + print; +} +" < "$SPEC" > "$SPEC.updated" + +mv "$SPEC.updated" "$SPEC" diff --git a/packaging/debs/Debian/.gitignore b/packaging/debs/Debian/.gitignore new file mode 100644 index 0000000000..6a4aec11b5 --- /dev/null +++ b/packaging/debs/Debian/.gitignore @@ -0,0 +1,3 @@ +/debian/postrm +/debian/stamp-makefile-build +/rabbitmq-server_* diff --git a/packaging/debs/Debian/Makefile b/packaging/debs/Debian/Makefile new file mode 100644 index 0000000000..010293fc65 --- /dev/null +++ b/packaging/debs/Debian/Makefile @@ -0,0 +1,128 @@ +SOURCE_DIST_FILE ?= $(wildcard ../../../rabbitmq-server-*.tar.xz) + +ifneq ($(filter-out clean,$(MAKECMDGOALS)),) +ifeq ($(SOURCE_DIST_FILE),) +$(error Cannot find source archive; please specify SOURCE_DIST_FILE) +endif +ifneq ($(words $(SOURCE_DIST_FILE)),1) +$(error Multiple source archives found; please specify SOURCE_DIST_FILE) +endif +endif + +VERSION ?= $(patsubst rabbitmq-server-%.tar.xz,%,$(notdir $(SOURCE_DIST_FILE))) +ifeq ($(VERSION),) +$(error Cannot determine version; please specify VERSION) +endif + +# $(DEBIAN_VERSION) doesn't include the package revision: this one is +# only set in debian/changelog. +DEBIAN_VERSION = $(subst -,~,$(VERSION)) +DEBIAN_ORIG_TARBALL = rabbitmq-server_$(DEBIAN_VERSION).orig.tar.xz +UNPACKED_DIR = $(patsubst %.tar.xz,%,$(notdir $(SOURCE_DIST_FILE))) + +DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) +CHANGES_FILE = rabbitmq-server_$(DEBIAN_VERSION)-*_$(DEB_HOST_ARCH).changes + +# Package signing. +# +# At least the key ID is mandatory ($(SIGNING_KEY)). If it's set, we +# enable signing in dpkg-build-package(1), otherwise we ask for an +# unsigned package. +# +# To maintain backward compatibility, the caller can also specify +# $(KEYSDIR) or $(GNUPG_PATH) and we set GNUPGHOME accordingly. + +ifneq ($(SIGNING_KEY),) + SIGNING_FLAG = -k$(SIGNING_KEY) +ifneq ($(KEYSDIR),) + GNUPGHOME = $(KEYSDIR)/keyring/.gnupg + export GNUPGHOME +endif +ifneq ($(GNUPG_PATH),) + GNUPGHOME = $(GNUPG_PATH)/.gnupg + export GNUPGHOME +endif +else + SIGNING_FLAG = -us -uc +endif + +unexport DEPS_DIR +unexport ERL_LIBS +MAKEOVERRIDES = + +.PHONY: all package clean + +all: package + @: + +package: clean +# If a signing key ID was specified, verify that the key is available +# before starting a possibly long build. At the same time, display some +# useful informations on the key so the caller can double-check if he +# wants. +ifneq ($(SIGNING_KEY),) + @echo + @echo '--------------------------------------------------' + @echo "The package will be signed with key $(SIGNING_KEY):" + @gpg -K "$(SIGNING_KEY)" + @echo '--------------------------------------------------' + @echo +endif +# Because we are creating a source package as well, Debian expects the +# source archive to have a specially formatted name. Copy the original +# archive to a correctly named file. + cp -a "$(SOURCE_DIST_FILE)" "$(DEBIAN_ORIG_TARBALL)" +# Prepare the source directory: we extract the source archive and copy +# the debian/ subdirectory. + xzcat "$(DEBIAN_ORIG_TARBALL)" | tar -xf - + cp -a debian "$(UNPACKED_DIR)/debian" +ifeq ($(INSTALL_BUILD_DEPS),yes) +# Install build dependencies. To help us, we use mk-build-deps(1) from +# the devscripts package. +# +# We ignore errors from the first `dpkg -i` because the command will +# fail: dependencies are missing and dpkg(8) doesn't install them. +# That's why we have `apt-get install -f` following. To double-check +# everything went fine, we have the second `dpkg -i`. + apt-get install -y --no-install-recommends devscripts equivs + mk-build-deps debian/control + -dpkg -i ./rabbitmq-server-build-deps_*_all.deb + apt-get install -y -f -V --no-install-recommends + dpkg -i ./rabbitmq-server-build-deps_*_all.deb +endif +# Log Erlang version. + @echo + @echo '--------------------------------------------------' + @echo "Erlang and Elixir versions used to compile:" + @elixir --version + @echo '--------------------------------------------------' + @echo +# Possibly update debian/changelog (in the created source directory): +# - if it contains an entry for the specified version, do nothing; +# - otherwise, prepend a generated entry using "1" as the package +# revision. + cd "$(UNPACKED_DIR)"; \ + ../scripts/update-changelog.sh "$(DEBIAN_VERSION)" +# Finally build the package! We ask for both the source package and one +# or more binary packages. + cd "$(UNPACKED_DIR)"; \ + dpkg-buildpackage -sa $(SIGNING_FLAG) +# Before we remove the source directory, copy the possibly updated +# debian/changelog to the original debian subdirectory, if the caller +# asks for it. He is then responsible for committing it. +ifeq ($(SAVE_CHANGELOG),yes) + cp -a "$(UNPACKED_DIR)/debian/changelog" debian/changelog +endif + rm -rf "$(UNPACKED_DIR)" +# If $(PACKAGES_DIR) is specified, move all package files to that +# location. +ifneq ($(PACKAGES_DIR),) + mkdir -p "$(PACKAGES_DIR)" + mv $$(./scripts/get-debian-package-files-list.sh $(CHANGES_FILE)) \ + "$(PACKAGES_DIR)" +endif + +clean: + rm -rf $(UNPACKED_DIR) + rm -f $(DEBIAN_ORIG_TARBALL) + ./scripts/get-debian-package-files-list.sh $(CHANGES_FILE) | xargs rm -f diff --git a/packaging/debs/Debian/debian/changelog b/packaging/debs/Debian/debian/changelog new file mode 100644 index 0000000000..f3ba52425d --- /dev/null +++ b/packaging/debs/Debian/debian/changelog @@ -0,0 +1,547 @@ +rabbitmq-server (3.8.0~rc.1-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Sun, 08 Sep 2019 20:26:33 +0000 + +rabbitmq-server (3.8.0~beta.7-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Tue, 20 Aug 2019 19:44:41 +0000 + +rabbitmq-server (3.8.0~beta.6-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Sun, 04 Aug 2019 00:18:13 +0000 + +rabbitmq-server (3.8.0~beta.5-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Tue, 09 Jul 2019 16:11:20 +0000 + +rabbitmq-server (3.8.0~beta.4-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Fri, 10 May 2019 14:13:38 +0000 + +rabbitmq-server (3.8.0~beta.3-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Wed, 06 Mar 2019 05:08:03 +0000 + +rabbitmq-server (3.8.0~beta.2-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Thu, 31 Jan 2019 10:16:50 +0000 + +rabbitmq-server (3.8.0~beta.1-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Thu, 08 Nov 2018 14:41:04 +0000 + +rabbitmq-server (3.7.1~beta.1-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Wed, 13 Dec 2017 18:07:55 +0000 + +rabbitmq-server (3.7.0-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Wed, 29 Nov 2017 16:52:39 +0000 + +rabbitmq-server (3.7.0~rc.2-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Thu, 16 Nov 2017 17:50:24 +0000 + +rabbitmq-server (3.7.0~rc.1-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Mon, 18 Sep 2017 14:43:34 +0000 + +rabbitmq-server (3.7.0~beta.20-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> Tue, 12 Sep 2017 07:49:21 +0000 + +rabbitmq-server (3.6.12-1) unstable; urgency=medium + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Mon, 11 Sep 2017 16:19:10 +0100 + +rabbitmq-server (3.6.11-1) unstable; urgency=medium + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Wed, 16 Aug 2017 13:06:42 +0100 + +rabbitmq-server (3.6.10-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Thu, 25 May 2017 11:46:23 +0100 + +rabbitmq-server (3.6.9-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Wed, 29 Mar 2017 10:13:44 +0100 + +rabbitmq-server (3.6.8-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Fri, 17 Mar 2017 12:04:45 +0000 + +rabbitmq-server (3.6.7-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Wed, 15 Mar 2017 09:11:30 +0000 + +rabbitmq-server (3.6.6-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Mon, 21 Nov 2016 10:36:28 +0000 + +rabbitmq-server (3.6.5-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Fri, 05 Aug 2016 14:20:47 +0100 + +rabbitmq-server (3.6.4-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Fri, 29 Jul 2016 11:40:53 +0100 + +rabbitmq-server (3.6.3-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Wed, 06 Jul 2016 19:19:21 +0100 + +rabbitmq-server (3.6.2-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Thu, 19 May 2016 09:20:06 +0100 + +rabbitmq-server (3.6.1-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Tue, 01 Mar 2016 13:19:57 +0000 + +rabbitmq-server (3.6.0-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Tue, 22 Dec 2015 13:21:56 +0000 + +rabbitmq-server (3.5.7-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Tue, 15 Dec 2015 10:10:46 +0000 + +rabbitmq-server (3.5.6-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Wed, 07 Oct 2015 13:31:24 +0100 + +rabbitmq-server (3.5.5-3) unstable; urgency=low + + * Fix bashism in rabbitmq-script-wrapper + + -- Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> Thu, 24 Sep 2015 19:18:17 +0100 + +rabbitmq-server (3.5.5-1) unstable; urgency=low + + * New Upstream Release + + -- Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> Thu, 24 Sep 2015 10:57:25 +0100 + +rabbitmq-server (3.5.4-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Tue, 21 Jul 2015 20:25:48 +0100 + +rabbitmq-server (3.5.3-1) unstable; urgency=low + + * New Upstream Release + + -- Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> Fri, 22 May 2015 11:04:17 +0100 + +rabbitmq-server (3.5.2-1) unstable; urgency=low + + * New Upstream Release + + -- Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> Tue, 12 May 2015 16:21:44 +0100 + +rabbitmq-server (3.5.1-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Thu, 02 Apr 2015 10:17:30 +0100 + +rabbitmq-server (3.5.0-1) unstable; urgency=low + + * New Upstream Release + + -- Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> Wed, 11 Mar 2015 13:56:19 +0000 + +rabbitmq-server (3.4.4-1) unstable; urgency=low + + * New Upstream Release + + -- Michael Klishin <michael@rabbitmq.com> Wed, 11 Feb 2015 12:05:01 +0000 + +rabbitmq-server (3.4.3-1) unstable; urgency=low + + * New Upstream Release + + -- Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> Tue, 06 Jan 2015 15:58:45 +0000 + +rabbitmq-server (3.4.2-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Wed, 26 Nov 2014 12:11:12 +0000 + +rabbitmq-server (3.4.1-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Wed, 29 Oct 2014 13:31:10 +0000 + +rabbitmq-server (3.4.0-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Tue, 21 Oct 2014 14:21:36 +0100 + +rabbitmq-server (3.3.5-1) unstable; urgency=low + + * New Upstream Release + * Changed Uploaders from Emile Joubert to Blair Hester + + -- Simon MacMullen <simon@rabbitmq.com> Mon, 11 Aug 2014 12:23:31 +0100 + +rabbitmq-server (3.3.4-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Tue, 24 Jun 2014 12:50:29 +0100 + +rabbitmq-server (3.3.3-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Mon, 16 Jun 2014 13:00:00 +0100 + +rabbitmq-server (3.3.2-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Mon, 09 Jun 2014 10:25:22 +0100 + +rabbitmq-server (3.3.1-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Tue, 29 Apr 2014 11:49:23 +0100 + +rabbitmq-server (3.3.0-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Wed, 02 Apr 2014 14:23:14 +0100 + +rabbitmq-server (3.2.4-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Mon, 03 Mar 2014 14:50:18 +0000 + +rabbitmq-server (3.2.3-1) unstable; urgency=low + + * New Upstream Release + + -- Emile Joubert <emile@rabbitmq.com> Thu, 23 Jan 2014 14:46:37 +0000 + +rabbitmq-server (3.2.2-1) unstable; urgency=low + + * New Upstream Release + + -- Emile Joubert <emile@rabbitmq.com> Tue, 10 Dec 2013 16:08:08 +0000 + +rabbitmq-server (3.2.0-1) unstable; urgency=low + + * New Upstream Release + + -- Emile Joubert <emile@rabbitmq.com> Wed, 23 Oct 2013 12:44:10 +0100 + +rabbitmq-server (3.1.5-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Thu, 15 Aug 2013 11:03:13 +0100 + +rabbitmq-server (3.1.3-1) unstable; urgency=low + + * New Upstream Release + + -- Tim Watson <tim@rabbitmq.com> Tue, 25 Jun 2013 15:01:12 +0100 + +rabbitmq-server (3.1.2-1) unstable; urgency=low + + * New Upstream Release + + -- Tim Watson <tim@rabbitmq.com> Mon, 24 Jun 2013 11:16:41 +0100 + +rabbitmq-server (3.1.1-1) unstable; urgency=low + + * Test release + + -- Tim Watson <tim@rabbitmq.com> Mon, 20 May 2013 16:21:20 +0100 + +rabbitmq-server (3.1.0-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Wed, 01 May 2013 11:57:58 +0100 + +rabbitmq-server (3.0.1-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Tue, 11 Dec 2012 11:29:55 +0000 + +rabbitmq-server (3.0.0-1) unstable; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Fri, 16 Nov 2012 14:15:29 +0000 + +rabbitmq-server (2.7.1-1) natty; urgency=low + + * New Upstream Release + + -- Steve Powell <steve@rabbitmq.com> Fri, 16 Dec 2011 12:12:36 +0000 + +rabbitmq-server (2.7.0-1) natty; urgency=low + + * New Upstream Release + + -- Steve Powell <steve@rabbitmq.com> Tue, 08 Nov 2011 16:47:50 +0000 + +rabbitmq-server (2.6.1-1) natty; urgency=low + + * New Upstream Release + + -- Tim <tim@rabbitmq.com> Fri, 09 Sep 2011 14:38:45 +0100 + +rabbitmq-server (2.6.0-1) natty; urgency=low + + * New Upstream Release + + -- Tim <tim@rabbitmq.com> Fri, 26 Aug 2011 16:29:40 +0100 + +rabbitmq-server (2.5.1-1) lucid; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Mon, 27 Jun 2011 11:21:49 +0100 + +rabbitmq-server (2.5.0-1) lucid; urgency=low + + * New Upstream Release + + -- <jerryk@vmware.com> Thu, 09 Jun 2011 07:20:29 -0700 + +rabbitmq-server (2.4.1-1) lucid; urgency=low + + * New Upstream Release + + -- Alexandru Scvortov <alexandru@rabbitmq.com> Thu, 07 Apr 2011 16:49:22 +0100 + +rabbitmq-server (2.4.0-1) lucid; urgency=low + + * New Upstream Release + + -- Alexandru Scvortov <alexandru@rabbitmq.com> Tue, 22 Mar 2011 17:34:31 +0000 + +rabbitmq-server (2.3.1-1) lucid; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Thu, 03 Feb 2011 12:43:56 +0000 + +rabbitmq-server (2.3.0-1) lucid; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@rabbitmq.com> Tue, 01 Feb 2011 12:52:16 +0000 + +rabbitmq-server (2.2.0-1) lucid; urgency=low + + * New Upstream Release + + -- Rob Harrop <rob@rabbitmq.com> Mon, 29 Nov 2010 12:24:48 +0000 + +rabbitmq-server (2.1.1-1) lucid; urgency=low + + * New Upstream Release + + -- Vlad Alexandru Ionescu <vlad@rabbitmq.com> Tue, 19 Oct 2010 17:20:10 +0100 + +rabbitmq-server (2.1.0-1) lucid; urgency=low + + * New Upstream Release + + -- Marek Majkowski <marek@rabbitmq.com> Tue, 14 Sep 2010 14:20:17 +0100 + +rabbitmq-server (2.0.0-1) karmic; urgency=low + + * New Upstream Release + + -- Michael Bridgen <mikeb@rabbitmq.com> Mon, 23 Aug 2010 14:55:39 +0100 + +rabbitmq-server (1.8.1-1) lucid; urgency=low + + * New Upstream Release + + -- Emile Joubert <emile@rabbitmq.com> Wed, 14 Jul 2010 15:05:24 +0100 + +rabbitmq-server (1.8.0-1) intrepid; urgency=low + + * New Upstream Release + + -- Matthew Sackman <matthew@rabbitmq.com> Tue, 15 Jun 2010 12:48:48 +0100 + +rabbitmq-server (1.7.2-1) intrepid; urgency=low + + * New Upstream Release + + -- Matthew Sackman <matthew@lshift.net> Mon, 15 Feb 2010 15:54:47 +0000 + +rabbitmq-server (1.7.1-1) intrepid; urgency=low + + * New Upstream Release + + -- Matthew Sackman <matthew@lshift.net> Fri, 22 Jan 2010 14:14:29 +0000 + +rabbitmq-server (1.7.0-1) intrepid; urgency=low + + * New Upstream Release + + -- David Wragg <dpw@lshift.net> Mon, 05 Oct 2009 13:44:41 +0100 + +rabbitmq-server (1.6.0-1) hardy; urgency=low + + * New Upstream Release + + -- Matthias Radestock <matthias@lshift.net> Tue, 16 Jun 2009 15:02:58 +0100 + +rabbitmq-server (1.5.5-1) hardy; urgency=low + + * New Upstream Release + + -- Matthias Radestock <matthias@lshift.net> Tue, 19 May 2009 09:57:54 +0100 + +rabbitmq-server (1.5.4-1) hardy; urgency=low + + * New Upstream Release + + -- Matthias Radestock <matthias@lshift.net> Mon, 06 Apr 2009 09:19:32 +0100 + +rabbitmq-server (1.5.3-1) hardy; urgency=low + + * New Upstream Release + + -- Tony Garnock-Jones <tonyg@lshift.net> Tue, 24 Feb 2009 18:23:33 +0000 + +rabbitmq-server (1.5.2-1) hardy; urgency=low + + * New Upstream Release + + -- Tony Garnock-Jones <tonyg@lshift.net> Mon, 23 Feb 2009 16:03:38 +0000 + +rabbitmq-server (1.5.1-1) hardy; urgency=low + + * New Upstream Release + + -- Simon MacMullen <simon@lshift.net> Mon, 19 Jan 2009 15:46:13 +0000 + +rabbitmq-server (1.5.0-1) testing; urgency=low + + * New Upstream Release + + -- Matthias Radestock <matthias@lshift.net> Wed, 17 Dec 2008 18:23:47 +0000 + +rabbitmq-server (1.4.0-1) testing; urgency=low + + * New Upstream Release + + -- Tony Garnock-Jones <tonyg@lshift.net> Thu, 24 Jul 2008 13:21:48 +0100 + +rabbitmq-server (1.3.0-1) testing; urgency=low + + * New Upstream Release + + -- Adrien Pierard <adrien@lshift.net> Mon, 03 Mar 2008 15:34:38 +0000 + +rabbitmq-server (1.2.0-2) testing; urgency=low + + * Fixed rabbitmqctl wrapper script + + -- Simon MacMullen <simon@lshift.net> Fri, 05 Oct 2007 11:55:00 +0100 + +rabbitmq-server (1.2.0-1) testing; urgency=low + + * New upstream release + + -- Simon MacMullen <simon@lshift.net> Wed, 26 Sep 2007 11:49:26 +0100 + +rabbitmq-server (1.1.1-1) testing; urgency=low + + * New upstream release + + -- Simon MacMullen <simon@lshift.net> Wed, 29 Aug 2007 12:03:15 +0100 + +rabbitmq-server (1.1.0-alpha-2) testing; urgency=low + + * Fixed erlang-nox dependency + + -- Simon MacMullen <simon@lshift.net> Thu, 02 Aug 2007 11:27:13 +0100 + +rabbitmq-server (1.1.0-alpha-1) testing; urgency=low + + * New upstream release + + -- Simon MacMullen <simon@lshift.net> Fri, 20 Jul 2007 18:17:33 +0100 + +rabbitmq-server (1.0.0-alpha-1) unstable; urgency=low + + * Initial release + + -- Tony Garnock-Jones <tonyg@shortstop.lshift.net> Wed, 31 Jan 2007 19:06:33 +0000 + diff --git a/packaging/debs/Debian/debian/compat b/packaging/debs/Debian/debian/compat new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/packaging/debs/Debian/debian/compat @@ -0,0 +1 @@ +9 diff --git a/packaging/debs/Debian/debian/control b/packaging/debs/Debian/debian/control new file mode 100644 index 0000000000..31d1429293 --- /dev/null +++ b/packaging/debs/Debian/debian/control @@ -0,0 +1,89 @@ +Source: rabbitmq-server +Section: net +Priority: extra +Maintainer: RabbitMQ Team <info@rabbitmq.com> +Uploaders: Michael Klishin <michael@rabbitmq.com>, + Karl Nilsson <knilsson@rabbitmq.com>, + Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> +Build-Depends: debhelper (>= 9), + dh-systemd (>= 1.5), + erlang-base (>= 1:22.3) | erlang-base-hipe (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-base (<< 1:24.0) | erlang-base-hipe (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-crypto (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-crypto (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-edoc (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-edoc (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-eldap (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-eldap (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-erl-docgen (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-erl-docgen (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-eunit (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-eunit (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-inets (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-inets (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-mnesia (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-mnesia (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-os-mon (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-os-mon (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-parsetools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-parsetools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-public-key (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-public-key (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-runtime-tools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-runtime-tools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-ssl (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-ssl (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-syntax-tools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-syntax-tools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-tools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-tools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-xmerl (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-xmerl (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-dev (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-dev (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-src (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-src (<< 1:24.0) | esl-erlang (<< 1:24.0), + elixir (>= 1.10.4), + zip, + rsync +Standards-Version: 3.9.6 + +Package: rabbitmq-server +Architecture: all +# FIXME: We remove ${misc:Depends} and hard-code the dependency on +# init-system-helpers. we need this because we build the package on +# Debian, where dh-systemd/init-system-helpers is at version 1.18, but +# Ubuntu 14.04 only has init-system-helpers 1.14. +Depends: init-system-helpers (>= 1.13~), + erlang-base (>= 1:22.3) | erlang-base-hipe (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-base (<< 1:24.0) | erlang-base-hipe (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-crypto (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-crypto (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-eldap (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-eldap (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-inets (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-inets (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-mnesia (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-mnesia (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-os-mon (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-os-mon (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-parsetools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-parsetools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-public-key (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-public-key (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-runtime-tools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-runtime-tools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-ssl (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-ssl (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-syntax-tools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-syntax-tools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-tools (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-tools (<< 1:24.0) | esl-erlang (<< 1:24.0), + erlang-xmerl (>= 1:22.3) | esl-erlang (>= 1:22.3), + erlang-xmerl (<< 1:24.0) | esl-erlang (<< 1:24.0), + adduser, + logrotate, + socat +Description: Multi-protocol messaging broker + RabbitMQ is an open source multi-protocol messaging broker. +Homepage: https://www.rabbitmq.com/ diff --git a/packaging/debs/Debian/debian/copyright b/packaging/debs/Debian/debian/copyright new file mode 100644 index 0000000000..b5b083d80a --- /dev/null +++ b/packaging/debs/Debian/debian/copyright @@ -0,0 +1,405 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rabbitmq-server +Upstream-Contact: Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> +Source: https://github.com/rabbitmq/rabbitmq-server + +Files: * +Copyright: 2007-2020 VMware, Inc. or its affiliates. +License: MPL-2.0 + +Files: deps/rabbit_common/src/rabbit_numerical.erl deps/rabbit_common/src/rabbit_http_util.erl +Copyright: 2007 Mochi Media, Inc. +License: MIT + +License: MPL-2.0 +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +Copyright (c) 2007-2020 VMware, Inc. or its affiliates. + +License: MIT + This is the MIT license + . + Copyright (c) 2007 Mochi Media, Inc + . + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions + : + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packaging/debs/Debian/debian/dirs b/packaging/debs/Debian/debian/dirs new file mode 100644 index 0000000000..6df23a5f85 --- /dev/null +++ b/packaging/debs/Debian/debian/dirs @@ -0,0 +1,9 @@ +usr/lib/rabbitmq/bin +usr/lib/erlang/lib +usr/sbin +usr/share/man +var/lib/rabbitmq/mnesia +var/log/rabbitmq +etc/logrotate.d +etc/profile.d +etc/rabbitmq diff --git a/packaging/debs/Debian/debian/postinst b/packaging/debs/Debian/debian/postinst new file mode 100644 index 0000000000..379608aa8b --- /dev/null +++ b/packaging/debs/Debian/debian/postinst @@ -0,0 +1,79 @@ +#!/bin/sh +# postinst script for rabbitmq +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +# create rabbitmq group +if ! getent group rabbitmq >/dev/null; then + addgroup --system rabbitmq +fi + +# create rabbitmq user +if ! getent passwd rabbitmq >/dev/null; then + adduser --system --ingroup rabbitmq --home /var/lib/rabbitmq \ + --no-create-home --gecos "RabbitMQ messaging server" \ + --disabled-login rabbitmq +fi + +chown -R rabbitmq:rabbitmq /var/lib/rabbitmq +chown -R rabbitmq:adm /var/log/rabbitmq +chgrp rabbitmq /etc/rabbitmq +chmod g+s /etc/rabbitmq +chmod 750 /var/lib/rabbitmq/mnesia +chmod -R o-rwx,g-w /var/lib/rabbitmq/mnesia + +case "$1" in + configure) + if test -z "$2"; then + # This is a fresh install of the package. + + # On a fresh install, we want to limit permissions on the + # log directory to the owner and the group. Others won't + # have any access to log files: this is in case sensitive + # data are accidentally logged (like process crash data). + chmod 2750 /var/log/rabbitmq + else + # The package was already configured: it's an upgrade over + # a previously installed version, or it's an install over + # a non-purged version (i.e. deinstalled but configuration + # files and data are still there). + true + fi + + if [ -n "$ZSH_VERSION" ]; then + echo "Z Shell detected. +to enable rabbitmqctl autocompletion add the following to your .zshrc file: +autoload _enable_rabbitmqctl_completion; _enable_rabbitmqctl_completion" + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/packaging/debs/Debian/debian/postrm b/packaging/debs/Debian/debian/postrm new file mode 100644 index 0000000000..e5f97ba86e --- /dev/null +++ b/packaging/debs/Debian/debian/postrm @@ -0,0 +1,75 @@ +#!/bin/sh +# postrm script for rabbitmq +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <overwriter> +# <overwriter-version> +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +remove_plugin_traces() { + # Remove traces of plugins + rm -rf /var/lib/rabbitmq/plugins-scratch +} + +remove_autocomplete_script() { + if [ -f /etc/profile.d/rabbitmqctl-autocomplete.sh ]; then + rm -rf /etc/profile.d/rabbitmqctl-autocomplete.sh + rm -rf /usr/share/zsh/vendor-functions/_enable_rabbitmqctl_completion + fi +} + +case "$1" in + purge) + rm -f /etc/default/rabbitmq + if [ -d /var/lib/rabbitmq ]; then + rm -r /var/lib/rabbitmq + fi + if [ -d /var/log/rabbitmq ]; then + rm -r /var/log/rabbitmq + fi + if [ -d /etc/rabbitmq ]; then + rm -r /etc/rabbitmq + fi + remove_autocomplete_script + remove_plugin_traces + if getent passwd rabbitmq >/dev/null; then + # Stop epmd if run by the rabbitmq user + pkill -u rabbitmq epmd || : + fi + ;; + + remove) + remove_autocomplete_script + remove_plugin_traces + ;; + upgrade) + remove_plugin_traces + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/packaging/debs/Debian/debian/rabbitmq-server.default b/packaging/debs/Debian/debian/rabbitmq-server.default new file mode 100644 index 0000000000..bde5e30895 --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.default @@ -0,0 +1,9 @@ +# This file is sourced by /etc/init.d/rabbitmq-server. Its primary +# reason for existing is to allow adjustment of system limits for the +# rabbitmq-server process. +# +# Maximum number of open file handles. This will need to be increased +# to handle many simultaneous connections. Refer to the system +# documentation for ulimit (in man bash) for more information. +# +#ulimit -n 1024 diff --git a/packaging/debs/Debian/debian/rabbitmq-server.docs b/packaging/debs/Debian/debian/rabbitmq-server.docs new file mode 100644 index 0000000000..89e6828d70 --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.docs @@ -0,0 +1 @@ +deps/rabbit/docs/set_rabbitmq_policy.sh.example diff --git a/packaging/debs/Debian/debian/rabbitmq-server.init b/packaging/debs/Debian/debian/rabbitmq-server.init new file mode 100644 index 0000000000..80c792bba8 --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.init @@ -0,0 +1,200 @@ +#!/bin/sh +# +# rabbitmq-server RabbitMQ broker +# +# chkconfig: - 80 05 +# description: Manages RabbitMQ server +# + +### BEGIN INIT INFO +# Provides: rabbitmq-server +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: RabbitMQ broker +# Short-Description: Manages RabbitMQ server +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +NAME=rabbitmq-server +DAEMON=/usr/sbin/${NAME} +CONTROL=/usr/sbin/rabbitmqctl +DESC="message broker" +USER=rabbitmq +PID_FILE=/var/run/rabbitmq/pid +RABBITMQ_STARTUP_TIMEOUT=600 + +test -x $DAEMON || exit 0 +test -x $CONTROL || exit 0 + +RETVAL=0 +set -e + +[ -f /etc/default/${NAME} ] && . /etc/default/${NAME} + +# $RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR is a directory where rabbitmq-server(8) +# console output (both stdout and sterr) is redirected. It defaults to +# /var/log/rabbitmq which is configured by the package already (i.e. the +# directory is created and its ownership is set). +# +# We still look at the value of $RABBITMQ_LOG_BASE, possibly set in +# /etc/default/rabbitmq-server for backward compatibility. But we use a +# specific variable name here (instead of $RABBITMQ_LOG_BASE) to avoid any +# confusion with RabbitMQ's own logging configuration. Indeed, the console +# output redirection is a responsibility of the package, not RabbitMQ itself. +: ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR:=${RABBITMQ_LOG_BASE:-/var/log/rabbitmq}} + +. /lib/lsb/init-functions +. /lib/init/vars.sh + +ensure_pid_dir () { + PID_DIR=`dirname ${PID_FILE}` + if [ ! -d ${PID_DIR} ] ; then + mkdir -p ${PID_DIR} + chown -R ${USER}:${USER} ${PID_DIR} + chmod 755 ${PID_DIR} + fi +} + +remove_pid () { + rm -f ${PID_FILE} + rmdir `dirname ${PID_FILE}` || : +} + +start_rabbitmq () { + status_rabbitmq quiet + if [ $RETVAL != 0 ] ; then + RETVAL=0 + ensure_pid_dir + set +e + RABBITMQ_PID_FILE=$PID_FILE start-stop-daemon --quiet \ + --chuid rabbitmq --start \ + --pidfile "$PID_FILE" --background \ + --startas /bin/sh -- -c "exec $DAEMON >'${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/startup_log' 2>'${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/startup_err'" + $CONTROL wait --timeout $RABBITMQ_STARTUP_TIMEOUT $PID_FILE >/dev/null 2>&1 + RETVAL=$? + set -e + if [ $RETVAL != 0 ] ; then + remove_pid + fi + else + RETVAL=3 + fi +} + +stop_rabbitmq () { + status_rabbitmq quiet + if [ $RETVAL = 0 ] ; then + set +e + $CONTROL stop ${PID_FILE} \ + > ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/shutdown_log \ + 2> ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/shutdown_err + RETVAL=$? + set -e + if [ $RETVAL = 0 ] ; then + remove_pid + fi + else + RETVAL=3 + fi +} + +status_rabbitmq() { + set +e + if [ "$1" != "quiet" ] ; then + $CONTROL status 2>&1 + else + $CONTROL status > /dev/null 2>&1 + fi + if [ $? != 0 ] ; then + RETVAL=3 + fi + set -e +} + +rotate_logs_rabbitmq() { + set +e + $CONTROL -q rotate_logs + if [ $? != 0 ] ; then + RETVAL=1 + fi + set -e +} + +restart_running_rabbitmq () { + status_rabbitmq quiet + if [ $RETVAL = 0 ] ; then + restart_rabbitmq + else + log_warning_msg "${DESC} not running" + fi +} + +restart_rabbitmq() { + stop_rabbitmq + start_rabbitmq +} + +restart_end() { + if [ $RETVAL = 0 ] ; then + log_end_msg 0 + else + log_end_msg 1 + fi +} + +start_stop_end() { + case "$RETVAL" in + 0) + [ -x /sbin/initctl ] && /sbin/initctl emit --no-wait "${NAME}-${1}" + log_end_msg 0 + ;; + 3) + log_warning_msg "${DESC} already ${1}" + log_end_msg 0 + RETVAL=0 + ;; + *) + log_warning_msg "FAILED - check ${RABBITMQ_SERVER_CONSOLE_OUTPUT_DIR}/startup_\{log, _err\}" + log_end_msg 1 + ;; + esac +} + +case "$1" in + start) + log_daemon_msg "Starting ${DESC}" $NAME + start_rabbitmq + start_stop_end "running" + ;; + stop) + log_daemon_msg "Stopping ${DESC}" $NAME + stop_rabbitmq + start_stop_end "stopped" + ;; + status) + status_rabbitmq + ;; + rotate-logs) + log_action_begin_msg "Rotating log files for ${DESC}: ${NAME}" + rotate_logs_rabbitmq + log_action_end_msg $RETVAL + ;; + force-reload|reload|restart) + log_daemon_msg "Restarting ${DESC}" $NAME + restart_rabbitmq + restart_end + ;; + try-restart) + log_daemon_msg "Restarting ${DESC}" $NAME + restart_running_rabbitmq + restart_end + ;; + *) + echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2 + RETVAL=1 + ;; +esac + +exit $RETVAL diff --git a/packaging/debs/Debian/debian/rabbitmq-server.logrotate b/packaging/debs/Debian/debian/rabbitmq-server.logrotate new file mode 100644 index 0000000000..21a9fc0b84 --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.logrotate @@ -0,0 +1,7 @@ +/var/log/rabbitmq/*.log { + weekly + missingok + rotate 20 + compress + notifempty +} diff --git a/packaging/debs/Debian/debian/rabbitmq-server.manpages b/packaging/debs/Debian/debian/rabbitmq-server.manpages new file mode 100644 index 0000000000..2ef2376ee2 --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.manpages @@ -0,0 +1,4 @@ +deps/rabbit/docs/rabbitmq-env.conf.5 +deps/rabbit/docs/rabbitmq-plugins.8 +deps/rabbit/docs/rabbitmq-server.8 +deps/rabbit/docs/rabbitmqctl.8 diff --git a/packaging/debs/Debian/debian/rabbitmq-server.service b/packaging/debs/Debian/debian/rabbitmq-server.service new file mode 100644 index 0000000000..3339a2f5f0 --- /dev/null +++ b/packaging/debs/Debian/debian/rabbitmq-server.service @@ -0,0 +1,39 @@ +# systemd unit example +[Unit] +Description=RabbitMQ broker +After=network.target epmd@0.0.0.0.socket +Wants=network.target epmd@0.0.0.0.socket + +[Service] +Type=notify +User=rabbitmq +Group=rabbitmq +UMask=0027 +NotifyAccess=all +TimeoutStartSec=600 + +# To override LimitNOFILE, create the following file: +# +# /etc/systemd/system/rabbitmq-server.service.d/limits.conf +# +# with the following content: +# +# [Service] +# LimitNOFILE=65536 + +LimitNOFILE=32768 + +# The following setting will automatically restart RabbitMQ +# in the event of a failure. systemd service restarts are not a +# replacement for service monitoring. Please see +# https://www.rabbitmq.com/monitoring.html +Restart=on-failure +RestartSec=10 +WorkingDirectory=/var/lib/rabbitmq +ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server +ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl shutdown +# See rabbitmq/rabbitmq-server-release#51 +SuccessExitStatus=69 + +[Install] +WantedBy=multi-user.target diff --git a/packaging/debs/Debian/debian/rules b/packaging/debs/Debian/debian/rules new file mode 100755 index 0000000000..1a98c2831e --- /dev/null +++ b/packaging/debs/Debian/debian/rules @@ -0,0 +1,63 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DEB_DESTDIR = debian/rabbitmq-server +RABBITMQ_USER ?= rabbitmq +RABBITMQ_GROUP ?= rabbitmq + +unexport DEPS_DIR + +%: + dh $@ --parallel --with systemd + +override_dh_auto_clean: + $(MAKE) clean clean-unpacked-source-dist distclean-manpages + rm -rf .erlang.mk + +override_dh_auto_build: + $(MAKE) dist manpages + +override_dh_auto_test: + @: + +export PREFIX RMQ_ROOTDIR + +override_dh_auto_install: PREFIX = /usr +override_dh_auto_install: RMQ_ROOTDIR = $(PREFIX)/lib/rabbitmq +override_dh_auto_install: RMQ_ERLAPP_DIR = $(RMQ_ROOTDIR)/lib/rabbitmq_server-* +override_dh_auto_install: + dh_auto_install + + $(MAKE) install-bin DESTDIR=$(DEB_DESTDIR) + + sed \ + -e 's|@RABBITMQ_USER@|$(RABBITMQ_USER)|' -e 's|@RABBITMQ_GROUP@|$(RABBITMQ_GROUP)|' \ + < scripts/rabbitmq-script-wrapper \ + > $(DEB_DESTDIR)$(PREFIX)/sbin/rabbitmqctl + chmod 0755 $(DEB_DESTDIR)$(PREFIX)/sbin/rabbitmqctl + for script in rabbitmq-server rabbitmq-plugins rabbitmq-diagnostics rabbitmq-queues rabbitmq-upgrade; do \ + cp -a $(DEB_DESTDIR)$(PREFIX)/sbin/rabbitmqctl \ + $(DEB_DESTDIR)$(PREFIX)/sbin/$$script; \ + done + install -p -D -m 0644 debian/rabbitmq-server.default \ + $(DEB_DESTDIR)/etc/default/rabbitmq-server + + install -p -D -m 0755 scripts/rabbitmq-server.ocf \ + $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/rabbitmq/rabbitmq-server + install -p -D -m 0755 scripts/rabbitmq-server-ha.ocf \ + $(DEB_DESTDIR)$(PREFIX)/lib/ocf/resource.d/rabbitmq/rabbitmq-server-ha + + install -p -D -m 0755 scripts/rabbitmqctl-autocomplete.sh \ + $(DEB_DESTDIR)/etc/profile.d/rabbitmqctl-autocomplete.sh + + install -p -D -m 0755 scripts/zsh_autocomplete.sh \ + $(DEB_DESTDIR)/usr/share/zsh/vendor-functions/_enable_rabbitmqctl_completion + + rm $(DEB_DESTDIR)$(RMQ_ERLAPP_DIR)/LICENSE* \ + $(DEB_DESTDIR)$(RMQ_ERLAPP_DIR)/INSTALL + + rmdir $(DEB_DESTDIR)$(PREFIX)/lib/erlang/lib \ + $(DEB_DESTDIR)$(PREFIX)/lib/erlang diff --git a/packaging/debs/Debian/debian/source/format b/packaging/debs/Debian/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/packaging/debs/Debian/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/packaging/debs/Debian/debian/watch b/packaging/debs/Debian/debian/watch new file mode 100644 index 0000000000..cbf9b949db --- /dev/null +++ b/packaging/debs/Debian/debian/watch @@ -0,0 +1,4 @@ +version=4 +opts="filenamemangle=s%(?:.*?)?v?@PACKAGE@-(\d[\d.]*)\.tar\.xz%@PACKAGE@-$1.tar.xz%" \ + https://github.com/rabbitmq/@PACKAGE@/releases \ + (?:.*?/)?v?@PACKAGE@-(\d[\d.]*)\.tar\.xz debian uupdate diff --git a/packaging/debs/Debian/scripts/compare-debian-versions.py b/packaging/debs/Debian/scripts/compare-debian-versions.py new file mode 100755 index 0000000000..ec138fa623 --- /dev/null +++ b/packaging/debs/Debian/scripts/compare-debian-versions.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python2 + +import apt_pkg +import os.path +import sys + +if len(sys.argv) != 3: + print('Syntax: %s <version a> <version b>' % (os.path.basename(sys.argv[0]))) + sys.exit(64) + +a = sys.argv[1] +b = sys.argv[2] + +apt_pkg.init_system() +vc = apt_pkg.version_compare(a,b) + +if vc > 0: + print('%s < %s' % (b, a)) +elif vc == 0: + print('%s = %s' % (a, b)) +elif vc < 0: + print('%s < %s' % (a, b)) diff --git a/packaging/debs/Debian/scripts/format-package-version b/packaging/debs/Debian/scripts/format-package-version new file mode 100755 index 0000000000..9239b53af9 --- /dev/null +++ b/packaging/debs/Debian/scripts/format-package-version @@ -0,0 +1,8 @@ +#!/bin/sh +# vim:sw=2:et: + +set -e + +VERSION=$1 + +echo "$VERSION" | sed -E -e 's/-/~/g' diff --git a/packaging/debs/Debian/scripts/get-debian-package-files-list.sh b/packaging/debs/Debian/scripts/get-debian-package-files-list.sh new file mode 100755 index 0000000000..5865ede557 --- /dev/null +++ b/packaging/debs/Debian/scripts/get-debian-package-files-list.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +changes_file=$1 +if [ -z "$changes_file" ]; then + echo "Syntax: $(basename $0) <changes file>" 1>&2 + exit 64 +fi + +if [ ! -f "$changes_file" ]; then + exit 0 +fi + +changes_file_dir=$(dirname "$changes_file") +if test "$changes_file_dir" = '.'; then + changes_file_dir= +else + changes_file_dir="$changes_file_dir/" +fi + +# Include the .changes file itself in the list. +echo "$changes_file_dir$(basename "$changes_file")" + +# We want to match lines with the following format (it starts +# with a single space): +# f752d307528f0ca87d57995c217344ec 5184732 net extra rabbitmq-(...) +awk ' +/^ [a-fA-F0-9]+ / { + if (length($1) == 32) { + print "'$changes_file_dir'" $5; + } +}' < "$changes_file" diff --git a/packaging/debs/Debian/scripts/update-changelog.sh b/packaging/debs/Debian/scripts/update-changelog.sh new file mode 100755 index 0000000000..70076bfaf6 --- /dev/null +++ b/packaging/debs/Debian/scripts/update-changelog.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +set -e + +PACKAGE_VERSION=$1 + +if test -z "$PACKAGE_VERSION"; then + echo "Syntax: $(basename "$0") <debian version>" 1>&2 + exit 64 +fi + +PACKAGE_NAME=$(awk '/^Source:/ { print $2; }' < debian/control) +CHANGELOG_DATE=$(date -R) + +if dpkg-parsechangelog --all | \ + grep -E -q "^ $PACKAGE_NAME \(${PACKAGE_VERSION}-[^)]\) "; then + exit 0 +fi + +cat > debian/changelog.tmp <<EOF +${PACKAGE_NAME} (${PACKAGE_VERSION}-1) unstable; urgency=low + + * New Upstream Release. + + -- RabbitMQ Team <info@rabbitmq.com> ${CHANGELOG_DATE} + +EOF + +cat debian/changelog >> debian/changelog.tmp +mv -f debian/changelog.tmp debian/changelog + +echo +echo '--------------------------------------------------' +dpkg-parsechangelog +echo '--------------------------------------------------' +echo diff --git a/packaging/debs/apt-repository/Makefile b/packaging/debs/apt-repository/Makefile new file mode 100644 index 0000000000..dbf8871a51 --- /dev/null +++ b/packaging/debs/apt-repository/Makefile @@ -0,0 +1,31 @@ +PACKAGES_DIR ?= ../../../PACKAGES +REPO_DIR ?= debian + +SIGNING_KEY ?= default + +ifeq "$(UNOFFICIAL_RELEASE)" "" +HOME_ARG = HOME=$(GNUPG_PATH) +endif + +all: debian_apt_repository + +clean: + rm -rf $(REPO_DIR) + +CAN_HAS_REPREPRO=$(shell [ -f /usr/bin/reprepro ] && echo true) +ifeq ($(CAN_HAS_REPREPRO), true) +debian_apt_repository: clean + mkdir -p $(REPO_DIR)/conf + cp -a distributions $(REPO_DIR)/conf +ifeq "$(UNOFFICIAL_RELEASE)" "" + echo SignWith: $(SIGNING_KEY) >> $(REPO_DIR)/conf/distributions +endif + for FILE in $(PACKAGES_DIR)/*.changes ; do \ + $(HOME_ARG) reprepro --ignore=wrongdistribution \ + -Vb $(REPO_DIR) include kitten $${FILE} ; \ + done + reprepro -Vb $(REPO_DIR) createsymlinks +else +debian_apt_repository: + @echo Not building APT repository as reprepro could not be found +endif diff --git a/packaging/debs/apt-repository/README b/packaging/debs/apt-repository/README new file mode 100644 index 0000000000..514a37f33e --- /dev/null +++ b/packaging/debs/apt-repository/README @@ -0,0 +1,17 @@ +APT repository for RabbitMQ + +Previously we've attempted to run a repository in the same way that +Debian would: have repository management software installed on the +server, and upload new packages to the repository as and when they're +ready. + +This turned out to be both fiddly and annoying to do (and more +particularly to automate) so since our repository is always going to be +small it's easier just to create the entire repository as part of the +build process, just like a package. It can then be moved into place as a +single unit. The make target "debian_apt_repository" (invoked by "dist") +will create it, and it can get moved onto the server with the rest of +the packages. + +Read "README-real-repository" for information on how we used to do +this. diff --git a/packaging/debs/apt-repository/README-real-repository b/packaging/debs/apt-repository/README-real-repository new file mode 100644 index 0000000000..faa7b62425 --- /dev/null +++ b/packaging/debs/apt-repository/README-real-repository @@ -0,0 +1,130 @@ +APT Repository for RabbitMQ in Debian +===================================== + +First, a note on what we're trying to do. We want a single "testing" +repository. When RabbitMQ is more stable we will also want a +"stable" repository. It is very important to understand that these refer +to the state of the rabbit code, *NOT* which Debian distribution they go +with. At the moment our dependencies are very simple so our packages can +be used with any current Debian version (etch, lenny, sid) as well as +with Ubuntu. So although we have a "testing" distribution, this is not +codenamed "lenny". Instead it's currently codenamed "kitten" since +that's a baby rabbit. + +Secondly, a note on software. We need a tool to manage the repository, +and a tool to perform uploads to the repository. Debian being Debian +there are quite a few of each. We will use "reprepro" to manage the +repository since it's modern, maintained, and fairly simple. We will use +"dupload" to perform the uploads since it gives us the ability to run +arbitrary commands after the upload, which means we don't need to run a +cron job on the web server to process uploads. + +Creating a repository +===================== + +Much of this was cribbed from: +https://www.debian-administration.org/articles/286 + +The repository is fundamentally just some files in a folder, served over +HTTP (or FTP etc). So let's make it "debian" in the root of +www.rabbitmq.com. + +This means the repository will be at https://www.rabbitmq.com/debian/ and +can be added to a sources.list as: + +deb https://www.rabbitmq.com/debian/ testing main +deb-src https://www.rabbitmq.com/debian/ testing main + +Inside this folder we need a "conf" folder, and in +that we need a "distributions" configuration file - see the file in this +folder. Note that: + +* We list all architectures so that people can install rabbitmq-server + on to anything. +* We don't list the "all" architecture even though we use it; it's + implied. +* We only have a "main" component, we could have non-free and contrib + here if it was relevant. +* We list the email address associated with the key we want to use to + sign the repository. Yes, even after signing packages we still want to + sign the repository. + +We're now ready to go. Assuming the path to our repository is /path, +(and hence configuration is in /path/conf) we can upload a file to the +repository (creating it in the process) by doing something like this on +the repository host: + +$ reprepro --ignore=wrongdistribution -Vb /path include kitten \ + rabbitmq-server_1.0.0-alpha-1_i386.changes + +Note that we upload to the distribution "kitten" rather than "testing". +We also pass --ignore=wrongdistribution since the current packages are +built to go in "unstable" (this will be changed obviously). + +Note also that the .changes file claims to be for i386 even though the +package is for architecture "all". This is a bug in debhelper. + +Finally, if you've just created a repository, you want to run: + +$ reprepro -Vb /path createsymlinks + +since this will create "kitten" -> "testing" symlinks. You only need to +do this once. + +Removing packages +================= + +Fairly simple: + +$ reprepro --ignore=wrongdistribution -Vb /path remove kitten \ + rabbitmq-server + +Subsequent updates and "dupload" +================================ + +You can run the "reprepro" command above again to update the versions of +software in the repository. Since we probably don't want to have to log +into the machine in question to do this, we can use "dupload". This is a +tool which uploads Debian packages. The supplied file "dupload.conf" can +be renamed to ~/.dupload.conf. If you then run: + +$ dupload -to rabbit --nomail . + +in the folder with the .changes file, dupload will: + +* create an incoming folder in your home directory on the repository +machine +* upload everything there +* run reprepro to move the packages into the repository +* "rm -rf" the uploads folder + +This is a bit cheesy but should be enough for our purposes. The +dupload.conf uses scp and ssh so you need a public-key login (or type +your password lots). + +There's still an open question as to whether dupload is really needed +for our case. + +Keys and signing +================ + +We currently sign the package as we build it; but we also need to sign +the repository. The key is currently on my machine (mrforgetful) and has +ID 056E8E56. We should put it on CDs though. + +reprepro will automatically sign the repository if we have the right +SignWith line in the configuration, AND the secret key is installed on +the repository server. This is obviously not ideal; not sure what the +solution is right now. + +You can export the public key with: + +$ gpg --export --armor 056E8E56 > rabbit.pub + +(Open question: do we want to get our key on subkeys.pgp.net?) + +We can then add this key to the website and tell our users to import the +key into apt with: + +# apt-key add rabbit.pub + diff --git a/packaging/debs/apt-repository/distributions b/packaging/debs/apt-repository/distributions new file mode 100644 index 0000000000..00d6b219f1 --- /dev/null +++ b/packaging/debs/apt-repository/distributions @@ -0,0 +1,7 @@ +Origin: RabbitMQ +Label: RabbitMQ Repository for Debian / Ubuntu etc +Suite: testing +Codename: kitten +Architectures: alpha amd64 arm arm64 armeb armel armhf avr32 hppa hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 m32 m32r m68k mips mips64 mips64el mips64r6 mips64r6el mipsel mipsr6 mipsr6el netbsd-alpha netbsd-i386 nios2 or1k powerpc powerpcel ppc64 ppc64el s390 s390x sh sh3 sh3eb sh4 sh4eb sparc sparc64 tilegx source +Components: main +Description: RabbitMQ Repository for Debian / Ubuntu etc diff --git a/packaging/debs/apt-repository/dupload.conf b/packaging/debs/apt-repository/dupload.conf new file mode 100644 index 0000000000..9ceed76000 --- /dev/null +++ b/packaging/debs/apt-repository/dupload.conf @@ -0,0 +1,16 @@ +package config; + +$rabbit_user = "simon"; +$rabbit_host = "mrforgetful.lshift.net"; +$rabbit_repo_path = "/srv/debian"; +$rabbit_reprepro_extra_args = "--ignore=wrongdistribution"; + +$cfg{'rabbit'} = { + fqdn => "$rabbit_host", + login => "$rabbit_user", + method => "scp", + incoming => "incoming", +}; + +$preupload{'deb'} = "ssh ${rabbit_host} mkdir incoming"; +$postupload{'deb'} = "ssh ${rabbit_host} \"cd incoming && reprepro ${$rabbit_reprepro_extra_args} -Vb ${rabbit_repo_path} include kitten *.changes && cd .. && rm -r incoming\""; diff --git a/packaging/docker-image/Dockerfile b/packaging/docker-image/Dockerfile new file mode 100644 index 0000000000..1089bb1ec9 --- /dev/null +++ b/packaging/docker-image/Dockerfile @@ -0,0 +1,301 @@ +# The official Canonical Ubuntu Bionic image is ideal from a security perspective, +# especially for the enterprises that we, the RabbitMQ team, have to deal with +FROM ubuntu:18.04 + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ +# grab gosu for easy step-down from root + gosu \ + ; \ + rm -rf /var/lib/apt/lists/*; \ +# verify that the "gosu" binary works + gosu nobody true + +# Default to a PGP keyserver that pgp-happy-eyeballs recognizes, but allow for substitutions locally +ARG PGP_KEYSERVER=ha.pool.sks-keyservers.net +# If you are building this image locally and are getting `gpg: keyserver receive failed: No data` errors, +# run the build with a different PGP_KEYSERVER, e.g. docker build --tag rabbitmq:3.7 --build-arg PGP_KEYSERVER=pgpkeys.eu 3.7/ubuntu +# For context, see https://github.com/docker-library/official-images/issues/4252 + +# Using the latest OpenSSL LTS release, with support until September 2023 - https://www.openssl.org/source/ +ENV OPENSSL_VERSION 1.1.1g +ENV OPENSSL_SOURCE_SHA256="ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46" +# https://www.openssl.org/community/omc.html +ENV OPENSSL_PGP_KEY_IDS="0x8657ABB260F056B1E5190839D9C4D26D0E604491 0x5B2545DAB21995F4088CEFAA36CEE4DEB00CFE33 0xED230BEC4D4F2518B9D7DF41F0DB4D21C1D35231 0xC1F33DD8CE1D4CC613AF14DA9195C48241FBF7DD 0x7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C 0xE5E52560DD91C556DDBDA5D02064C53641C25E5D" + +# Use the latest stable Erlang/OTP release - make find-latest-otp - https://github.com/erlang/otp/tags +ARG OTP_VERSION +ENV OTP_VERSION ${OTP_VERSION} +# TODO add PGP checking when the feature will be added to Erlang/OTP's build system +# http://erlang.org/pipermail/erlang-questions/2019-January/097067.html +ARG OTP_SHA256 +ENV OTP_SOURCE_SHA256=${OTP_SHA256} + +# Install dependencies required to build Erlang/OTP from source +# http://erlang.org/doc/installation_guide/INSTALL.html +# autoconf: Required to configure Erlang/OTP before compiling +# dpkg-dev: Required to set up host & build type when compiling Erlang/OTP +# gnupg: Required to verify OpenSSL artefacts +# libncurses5-dev: Required for Erlang/OTP new shell & observer_cli - https://github.com/zhongwencool/observer_cli +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install --yes --no-install-recommends \ + autoconf \ + ca-certificates \ + dpkg-dev \ + gcc \ + gnupg \ + libncurses5-dev \ + make \ + wget \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + OPENSSL_SOURCE_URL="https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz"; \ + OPENSSL_PATH="/usr/local/src/openssl-$OPENSSL_VERSION"; \ + OPENSSL_CONFIG_DIR=/usr/local/etc/ssl; \ + \ +# Required by the crypto & ssl Erlang/OTP applications + wget --progress dot:giga --output-document "$OPENSSL_PATH.tar.gz.asc" "$OPENSSL_SOURCE_URL.asc"; \ + wget --progress dot:giga --output-document "$OPENSSL_PATH.tar.gz" "$OPENSSL_SOURCE_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $OPENSSL_PGP_KEY_IDS; do \ + gpg --batch --keyserver "$PGP_KEYSERVER" --recv-keys "$key" || true; \ + done; \ + gpg --batch --verify "$OPENSSL_PATH.tar.gz.asc" "$OPENSSL_PATH.tar.gz"; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + echo "$OPENSSL_SOURCE_SHA256 *$OPENSSL_PATH.tar.gz" | sha256sum --check --strict -; \ + mkdir -p "$OPENSSL_PATH"; \ + tar --extract --file "$OPENSSL_PATH.tar.gz" --directory "$OPENSSL_PATH" --strip-components 1; \ + \ +# Configure OpenSSL for compilation + cd "$OPENSSL_PATH"; \ +# OpenSSL's "config" script uses a lot of "uname"-based target detection... + MACHINE="$(dpkg-architecture --query DEB_BUILD_GNU_CPU)" \ + RELEASE="4.x.y-z" \ + SYSTEM='Linux' \ + BUILD='???' \ + ./config \ + --openssldir="$OPENSSL_CONFIG_DIR" \ +# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364) + -Wl,-rpath=/usr/local/lib \ + ; \ +# Compile, install OpenSSL, verify that the command-line works & development headers are present + make -j "$(getconf _NPROCESSORS_ONLN)"; \ + make install_sw install_ssldirs; \ + cd ..; \ + rm -rf "$OPENSSL_PATH"*; \ + ldconfig; \ +# use Debian's CA certificates + rmdir "$OPENSSL_CONFIG_DIR/certs" "$OPENSSL_CONFIG_DIR/private"; \ + ln -sf /etc/ssl/certs /etc/ssl/private "$OPENSSL_CONFIG_DIR"; \ +# smoke test + openssl version; \ + \ + OTP_SOURCE_URL="https://github.com/erlang/otp/archive/OTP-$OTP_VERSION.tar.gz"; \ + OTP_PATH="/usr/local/src/otp-$OTP_VERSION"; \ + \ +# Download, verify & extract OTP_SOURCE + mkdir -p "$OTP_PATH"; \ + wget --progress dot:giga --output-document "$OTP_PATH.tar.gz" "$OTP_SOURCE_URL"; \ + echo "$OTP_SOURCE_SHA256 *$OTP_PATH.tar.gz" | sha256sum --check --strict -; \ + tar --extract --file "$OTP_PATH.tar.gz" --directory "$OTP_PATH" --strip-components 1; \ + \ +# Configure Erlang/OTP for compilation, disable unused features & applications +# http://erlang.org/doc/applications.html +# ERL_TOP is required for Erlang/OTP makefiles to find the absolute path for the installation + cd "$OTP_PATH"; \ + export ERL_TOP="$OTP_PATH"; \ + ./otp_build autoconf; \ + CFLAGS="$(dpkg-buildflags --get CFLAGS)"; export CFLAGS; \ +# add -rpath to avoid conflicts between our OpenSSL's "libssl.so" and the libssl package by making sure /usr/local/lib is searched first (but only for Erlang/OpenSSL to avoid issues with other tools using libssl; https://github.com/docker-library/rabbitmq/issues/364) + export CFLAGS="$CFLAGS -Wl,-rpath=/usr/local/lib"; \ + hostArch="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"; \ + buildArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + dpkgArch="$(dpkg --print-architecture)"; dpkgArch="${dpkgArch##*-}"; \ + ./configure \ + --host="$hostArch" \ + --build="$buildArch" \ + --disable-dynamic-ssl-lib \ + --disable-hipe \ + --disable-sctp \ + --disable-silent-rules \ + --enable-clock-gettime \ + --enable-hybrid-heap \ + --enable-kernel-poll \ + --enable-shared-zlib \ + --enable-smp-support \ + --enable-threads \ + --with-microstate-accounting=extra \ + --without-common_test \ + --without-debugger \ + --without-dialyzer \ + --without-diameter \ + --without-edoc \ + --without-erl_docgen \ + --without-erl_interface \ + --without-et \ + --without-eunit \ + --without-ftp \ + --without-hipe \ + --without-jinterface \ + --without-megaco \ + --without-observer \ + --without-odbc \ + --without-reltool \ + --without-ssh \ + --without-tftp \ + --without-wx \ + ; \ +# Compile & install Erlang/OTP + make -j "$(getconf _NPROCESSORS_ONLN)" GEN_OPT_FLGS="-O2 -fno-strict-aliasing"; \ + make install; \ + cd ..; \ + rm -rf \ + "$OTP_PATH"* \ + /usr/local/lib/erlang/lib/*/examples \ + /usr/local/lib/erlang/lib/*/src \ + ; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# Check that OpenSSL still works after purging build dependencies + openssl version; \ +# Check that Erlang/OTP crypto & ssl were compiled against OpenSSL correctly + erl -noshell -eval 'io:format("~p~n~n~p~n~n", [crypto:supports(), ssl:versions()]), init:stop().' + +ENV RABBITMQ_DATA_DIR=/var/lib/rabbitmq +# Create rabbitmq system user & group, fix permissions & allow root user to connect to the RabbitMQ Erlang VM +RUN set -eux; \ + groupadd --gid 999 --system rabbitmq; \ + useradd --uid 999 --system --home-dir "$RABBITMQ_DATA_DIR" --gid rabbitmq rabbitmq; \ + mkdir -p "$RABBITMQ_DATA_DIR" /etc/rabbitmq /tmp/rabbitmq-ssl /var/log/rabbitmq; \ + chown -fR rabbitmq:rabbitmq "$RABBITMQ_DATA_DIR" /etc/rabbitmq /tmp/rabbitmq-ssl /var/log/rabbitmq; \ + chmod 777 "$RABBITMQ_DATA_DIR" /etc/rabbitmq /tmp/rabbitmq-ssl /var/log/rabbitmq; \ + ln -sf "$RABBITMQ_DATA_DIR/.erlang.cookie" /root/.erlang.cookie + +# Use the latest alpha RabbitMQ 3.8 release - https://dl.bintray.com/rabbitmq/all-dev/rabbitmq-server/ +ARG RABBITMQ_VERSION +ENV RABBITMQ_VERSION=${RABBITMQ_VERSION} +# https://www.rabbitmq.com/signatures.html#importing-gpg +# ENV RABBITMQ_PGP_KEY_ID="0x0A9AF2115F4687BD29803A206B73A36E6026DFCA" +ENV RABBITMQ_HOME=/opt/rabbitmq + +# Add RabbitMQ to PATH, send all logs to TTY +ENV PATH=$RABBITMQ_HOME/sbin:$PATH \ + RABBITMQ_LOGS=- + +ARG RABBITMQ_BUILD +COPY ${RABBITMQ_BUILD} $RABBITMQ_HOME + +# Install RabbitMQ +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install --yes --no-install-recommends \ + ca-certificates \ + gnupg \ + wget \ + xz-utils \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + # RABBITMQ_SOURCE_URL="https://dl.bintray.com/rabbitmq/all-dev/rabbitmq-server/$RABBITMQ_VERSION/rabbitmq-server-generic-unix-latest-toolchain-${RABBITMQ_VERSION}.tar.xz"; \ + # RABBITMQ_PATH="/usr/local/src/rabbitmq-$RABBITMQ_VERSION"; \ + \ + # wget --progress dot:giga --output-document "$RABBITMQ_PATH.tar.xz.asc" "$RABBITMQ_SOURCE_URL.asc"; \ + # wget --progress dot:giga --output-document "$RABBITMQ_PATH.tar.xz" "$RABBITMQ_SOURCE_URL"; \ + \ + # export GNUPGHOME="$(mktemp -d)"; \ + # gpg --batch --keyserver "$PGP_KEYSERVER" --recv-keys "$RABBITMQ_PGP_KEY_ID"; \ + # gpg --batch --verify "$RABBITMQ_PATH.tar.xz.asc" "$RABBITMQ_PATH.tar.xz"; \ + # gpgconf --kill all; \ + # rm -rf "$GNUPGHOME"; \ + \ + # mkdir -p "$RABBITMQ_HOME"; \ + # tar --extract --file "$RABBITMQ_PATH.tar.xz" --directory "$RABBITMQ_HOME" --strip-components 1; \ + # rm -rf "$RABBITMQ_PATH"*; \ +# Do not default SYS_PREFIX to RABBITMQ_HOME, leave it empty + grep -qE '^SYS_PREFIX=\$\{RABBITMQ_HOME\}$' "$RABBITMQ_HOME/sbin/rabbitmq-defaults"; \ + sed -i 's/^SYS_PREFIX=.*$/SYS_PREFIX=/' "$RABBITMQ_HOME/sbin/rabbitmq-defaults"; \ + grep -qE '^SYS_PREFIX=$' "$RABBITMQ_HOME/sbin/rabbitmq-defaults"; \ + chown -R rabbitmq:rabbitmq "$RABBITMQ_HOME"; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# verify assumption of no stale cookies + [ ! -e "$RABBITMQ_DATA_DIR/.erlang.cookie" ]; \ +# Ensure RabbitMQ was installed correctly by running a few commands that do not depend on a running server, as the rabbitmq user +# If they all succeed, it's safe to assume that things have been set up correctly + gosu rabbitmq rabbitmqctl help; \ + gosu rabbitmq rabbitmqctl list_ciphers; \ + gosu rabbitmq rabbitmq-plugins list; \ +# no stale cookies + rm "$RABBITMQ_DATA_DIR/.erlang.cookie" + +# Added for backwards compatibility - users can simply COPY custom plugins to /plugins +RUN ln -sf /opt/rabbitmq/plugins /plugins + +# set home so that any `--user` knows where to put the erlang cookie +ENV HOME $RABBITMQ_DATA_DIR +# Hint that the data (a.k.a. home dir) dir should be separate volume +VOLUME $RABBITMQ_DATA_DIR + +# warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) +# Setting all environment variables that control language preferences, behaviour differs - https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable +# https://docs.docker.com/samples/library/ubuntu/#locales +ENV LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 4369 5671 5672 25672 +CMD ["rabbitmq-server"] + +# rabbitmq_management +RUN rabbitmq-plugins enable --offline rabbitmq_management && \ + rabbitmq-plugins is_enabled rabbitmq_management --offline +# extract "rabbitmqadmin" from inside the "rabbitmq_management-X.Y.Z.ez" plugin zipfile +# see https://github.com/docker-library/rabbitmq/issues/207 +RUN set -eux; \ + erl -noinput -eval ' \ + { ok, AdminBin } = zip:foldl(fun(FileInArchive, GetInfo, GetBin, Acc) -> \ + case Acc of \ + "" -> \ + case lists:suffix("/rabbitmqadmin", FileInArchive) of \ + true -> GetBin(); \ + false -> Acc \ + end; \ + _ -> Acc \ + end \ + end, "", init:get_plain_arguments()), \ + io:format("~s", [ AdminBin ]), \ + init:stop(). \ + ' -- /plugins/rabbitmq_management-*.ez > /usr/local/bin/rabbitmqadmin; \ + [ -s /usr/local/bin/rabbitmqadmin ]; \ + chmod +x /usr/local/bin/rabbitmqadmin; \ + apt-get update; apt-get install -y --no-install-recommends python3; rm -rf /var/lib/apt/lists/*; \ + rabbitmqadmin --version +EXPOSE 15671 15672 + +RUN rabbitmq-plugins enable --offline rabbitmq_prometheus && \ + rabbitmq-plugins is_enabled rabbitmq_prometheus --offline +EXPOSE 15692 diff --git a/packaging/docker-image/Makefile b/packaging/docker-image/Makefile new file mode 100644 index 0000000000..2a39c7bade --- /dev/null +++ b/packaging/docker-image/Makefile @@ -0,0 +1,35 @@ +GENERIC_UNIX_ARCHIVE ?= $(wildcard $(PACKAGES_DIR)/rabbitmq-server-generic-unix-*.tar.xz) + +ifneq ($(filter-out clean,$(MAKECMDGOALS)),) +ifeq ($(GENERIC_UNIX_ARCHIVE),) +$(error Cannot find generic-unix archive; please specify GENERIC_UNIX_ARCHIVE) +endif +ifneq ($(words $(SOURCE_DIST_FILE)),1) +$(error Multiple generic-unix archives found; please specify GENERIC_UNIX_ARCHIVE) +endif + +VERSION ?= $(patsubst rabbitmq-server-generic-unix-%.tar.xz,%,$(notdir $(GENERIC_UNIX_ARCHIVE))) +ifeq ($(VERSION),) +$(error Cannot determine version; please specify VERSION) +endif +endif + +OTP_VERSION ?= 22.3 +OTP_SHA256 ?= 886e6dbe1e4823c7e8d9c9c1ba8315075a1a9f7717f5a1eaf3b98345ca6c798e + +all: dist + +dist: + xzcat $(GENERIC_UNIX_ARCHIVE) | tar xvf - + echo docker build --pull \ + --build-arg PGP_KEYSERVER=pgpkeys.uk \ + --build-arg OTP_VERSION=$(OTP_VERSION) \ + --build-arg OTP_SHA256=$(OTP_SHA256) \ + --build-arg RABBITMQ_VERSION=$(VERSION) \ + --build-arg RABBITMQ_BUILD=rabbitmq_server-$(VERSION) \ + --tag pivotalrabbitmq/rabbitmq:$(VERSION) \ + . \ + && docker push pivotalrabbitmq/rabbitmq:$(VERSION) + +clean: + rm -rf rabbitmq_server-* diff --git a/packaging/docker-image/docker-entrypoint.sh b/packaging/docker-image/docker-entrypoint.sh new file mode 100755 index 0000000000..55577a9e6e --- /dev/null +++ b/packaging/docker-image/docker-entrypoint.sh @@ -0,0 +1,407 @@ +#!/bin/bash +set -eu + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# backwards compatibility for old environment variables +: "${RABBITMQ_SSL_CERTFILE:=${RABBITMQ_SSL_CERT_FILE:-}}" +: "${RABBITMQ_SSL_KEYFILE:=${RABBITMQ_SSL_KEY_FILE:-}}" +: "${RABBITMQ_SSL_CACERTFILE:=${RABBITMQ_SSL_CA_FILE:-}}" + +# "management" SSL config should default to using the same certs +: "${RABBITMQ_MANAGEMENT_SSL_CACERTFILE:=$RABBITMQ_SSL_CACERTFILE}" +: "${RABBITMQ_MANAGEMENT_SSL_CERTFILE:=$RABBITMQ_SSL_CERTFILE}" +: "${RABBITMQ_MANAGEMENT_SSL_KEYFILE:=$RABBITMQ_SSL_KEYFILE}" + +# Allowed env vars that will be read from mounted files (i.e. Docker Secrets): +fileEnvKeys=( + default_user + default_pass +) + +# https://www.rabbitmq.com/configure.html +sslConfigKeys=( + cacertfile + certfile + depth + fail_if_no_peer_cert + keyfile + verify +) +managementConfigKeys=( + "${sslConfigKeys[@]/#/ssl_}" +) +rabbitConfigKeys=( + default_pass + default_user + default_vhost + vm_memory_high_watermark +) +fileConfigKeys=( + management_ssl_cacertfile + management_ssl_certfile + management_ssl_keyfile + ssl_cacertfile + ssl_certfile + ssl_keyfile +) +allConfigKeys=( + "${managementConfigKeys[@]/#/management_}" + "${rabbitConfigKeys[@]}" + "${sslConfigKeys[@]/#/ssl_}" +) + +declare -A configDefaults=( + [management_ssl_fail_if_no_peer_cert]='false' + [management_ssl_verify]='verify_none' + + [ssl_fail_if_no_peer_cert]='true' + [ssl_verify]='verify_peer' +) + +# allow the container to be started with `--user` +if [[ "$1" == rabbitmq* ]] && [ "$(id -u)" = '0' ]; then + # this needs to happen late enough that we have the SSL config + # https://github.com/docker-library/rabbitmq/issues/283 + for conf in "${allConfigKeys[@]}"; do + var="RABBITMQ_${conf^^}" + val="${!var:-}" + [ -n "$val" ] || continue + case "$conf" in + *_ssl_*file | ssl_*file ) + if [ -f "$val" ] && ! gosu rabbitmq test -r "$val"; then + newFile="/tmp/rabbitmq-ssl/$conf.pem" + echo >&2 + echo >&2 "WARNING: '$val' ($var) is not readable by rabbitmq ($(id rabbitmq)); copying to '$newFile'" + echo >&2 + cat "$val" > "$newFile" + chown rabbitmq "$newFile" + chmod 0400 "$newFile" + eval 'export '$var'="$newFile"' + fi + ;; + esac + done + + if [ "$1" = 'rabbitmq-server' ]; then + find /var/lib/rabbitmq \! -user rabbitmq -exec chown rabbitmq '{}' + + fi + + exec gosu rabbitmq "$BASH_SOURCE" "$@" +fi + +haveConfig= +haveSslConfig= +haveManagementSslConfig= +for fileEnvKey in "${fileEnvKeys[@]}"; do file_env "RABBITMQ_${fileEnvKey^^}"; done +for conf in "${allConfigKeys[@]}"; do + var="RABBITMQ_${conf^^}" + val="${!var:-}" + if [ "$val" ]; then + if [ "${configDefaults[$conf]:-}" ] && [ "${configDefaults[$conf]}" = "$val" ]; then + # if the value set is the same as the default, treat it as if it isn't set + continue + fi + haveConfig=1 + case "$conf" in + ssl_*) haveSslConfig=1 ;; + management_ssl_*) haveManagementSslConfig=1 ;; + esac + fi +done +if [ "$haveSslConfig" ]; then + missing=() + for sslConf in cacertfile certfile keyfile; do + var="RABBITMQ_SSL_${sslConf^^}" + val="${!var}" + if [ -z "$val" ]; then + missing+=( "$var" ) + fi + done + if [ "${#missing[@]}" -gt 0 ]; then + { + echo + echo 'error: SSL requested, but missing required configuration' + for miss in "${missing[@]}"; do + echo " - $miss" + done + echo + } >&2 + exit 1 + fi +fi +missingFiles=() +for conf in "${fileConfigKeys[@]}"; do + var="RABBITMQ_${conf^^}" + val="${!var}" + if [ "$val" ] && [ ! -f "$val" ]; then + missingFiles+=( "$val ($var)" ) + fi +done +if [ "${#missingFiles[@]}" -gt 0 ]; then + { + echo + echo 'error: files specified, but missing' + for miss in "${missingFiles[@]}"; do + echo " - $miss" + done + echo + } >&2 + exit 1 +fi + +# set defaults for missing values (but only after we're done with all our checking so we don't throw any of that off) +for conf in "${!configDefaults[@]}"; do + default="${configDefaults[$conf]}" + var="RABBITMQ_${conf^^}" + [ -z "${!var:-}" ] || continue + eval "export $var=\"\$default\"" +done + +# if long and short hostnames are not the same, use long hostnames +if [ "$(hostname)" != "$(hostname -s)" ]; then + : "${RABBITMQ_USE_LONGNAME:=true}" +fi + +if [ "${RABBITMQ_ERLANG_COOKIE:-}" ]; then + cookieFile='/var/lib/rabbitmq/.erlang.cookie' + if [ -e "$cookieFile" ]; then + if [ "$(cat "$cookieFile" 2>/dev/null)" != "$RABBITMQ_ERLANG_COOKIE" ]; then + echo >&2 + echo >&2 "warning: $cookieFile contents do not match RABBITMQ_ERLANG_COOKIE" + echo >&2 + fi + else + echo "$RABBITMQ_ERLANG_COOKIE" > "$cookieFile" + fi + chmod 600 "$cookieFile" +fi + +configBase="${RABBITMQ_CONFIG_FILE:-/etc/rabbitmq/rabbitmq}" +oldConfigFile="$configBase.config" +newConfigFile="$configBase.conf" + +shouldWriteConfig="$haveConfig" +if [ -n "$shouldWriteConfig" ] && [ -f "$oldConfigFile" ]; then + { + echo "error: Docker configuration environment variables specified, but old-style (Erlang syntax) configuration file '$oldConfigFile' exists" + echo " Suggested fixes: (choose one)" + echo " - remove '$oldConfigFile'" + echo " - remove any Docker-specific 'RABBITMQ_...' environment variables" + echo " - convert '$oldConfigFile' to the newer sysctl format ('$newConfigFile'); see https://www.rabbitmq.com/configure.html#config-file" + } >&2 + exit 1 +fi +if [ -z "$shouldWriteConfig" ] && [ ! -f "$oldConfigFile" ] && [ ! -f "$newConfigFile" ]; then + # no config files, we should write one + shouldWriteConfig=1 +fi + +# http://stackoverflow.com/a/2705678/433558 +sed_escape_lhs() { + echo "$@" | sed -e 's/[]\/$*.^|[]/\\&/g' +} +sed_escape_rhs() { + echo "$@" | sed -e 's/[\/&]/\\&/g' +} +rabbit_set_config() { + local key="$1"; shift + local val="$1"; shift + + [ -e "$newConfigFile" ] || touch "$newConfigFile" + + local sedKey="$(sed_escape_lhs "$key")" + local sedVal="$(sed_escape_rhs "$val")" + sed -ri \ + "s/^[[:space:]]*(${sedKey}[[:space:]]*=[[:space:]]*)\S.*\$/\1${sedVal}/" \ + "$newConfigFile" + if ! grep -qE "^${sedKey}[[:space:]]*=" "$newConfigFile"; then + echo "$key = $val" >> "$newConfigFile" + fi +} +rabbit_comment_config() { + local key="$1"; shift + + [ -e "$newConfigFile" ] || touch "$newConfigFile" + + local sedKey="$(sed_escape_lhs "$key")" + sed -ri \ + "s/^[[:space:]]*#?[[:space:]]*(${sedKey}[[:space:]]*=[[:space:]]*\S.*)\$/# \1/" \ + "$newConfigFile" +} +rabbit_env_config() { + local prefix="$1"; shift + + local conf + for conf; do + local var="rabbitmq${prefix:+_$prefix}_$conf" + var="${var^^}" + + local key="$conf" + case "$prefix" in + ssl) key="ssl_options.$key" ;; + management_ssl) key="management.ssl.$key" ;; + esac + + local val="${!var:-}" + local rawVal="$val" + case "$conf" in + fail_if_no_peer_cert) + case "${val,,}" in + false|no|0|'') rawVal='false' ;; + true|yes|1|*) rawVal='true' ;; + esac + ;; + + vm_memory_high_watermark) continue ;; # handled separately + esac + + if [ -n "$rawVal" ]; then + rabbit_set_config "$key" "$rawVal" + else + rabbit_comment_config "$key" + fi + done +} + +if [ "$1" = 'rabbitmq-server' ] && [ "$shouldWriteConfig" ]; then + rabbit_set_config 'loopback_users.guest' 'false' + + # determine whether to set "vm_memory_high_watermark" (based on cgroups) + memTotalKb= + if [ -r /proc/meminfo ]; then + memTotalKb="$(awk -F ':? +' '$1 == "MemTotal" { print $2; exit }' /proc/meminfo)" + fi + memLimitB= + if [ -r /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then + # "18446744073709551615" is a valid value for "memory.limit_in_bytes", which is too big for Bash math to handle + # "$(( 18446744073709551615 / 1024 ))" = 0; "$(( 18446744073709551615 * 40 / 100 ))" = 0 + memLimitB="$(awk -v totKb="$memTotalKb" '{ + limB = $0; + limKb = limB / 1024; + if (!totKb || limKb < totKb) { + printf "%.0f\n", limB; + } + }' /sys/fs/cgroup/memory/memory.limit_in_bytes)" + fi + if [ -n "$memLimitB" ]; then + # if we have a cgroup memory limit, let's inform RabbitMQ of what it is (so it can calculate vm_memory_high_watermark properly) + # https://github.com/rabbitmq/rabbitmq-server/pull/1234 + rabbit_set_config 'total_memory_available_override_value' "$memLimitB" + fi + # https://www.rabbitmq.com/memory.html#memsup-usage + if [ "${RABBITMQ_VM_MEMORY_HIGH_WATERMARK:-}" ]; then + # https://github.com/docker-library/rabbitmq/pull/105#issuecomment-242165822 + vmMemoryHighWatermark="$( + echo "$RABBITMQ_VM_MEMORY_HIGH_WATERMARK" | awk ' + /^[0-9]*[.][0-9]+$|^[0-9]+([.][0-9]+)?%$/ { + perc = $0; + if (perc ~ /%$/) { + gsub(/%$/, "", perc); + perc = perc / 100; + } + if (perc > 1.0 || perc < 0.0) { + printf "error: invalid percentage for vm_memory_high_watermark: %s (must be >= 0%%, <= 100%%)\n", $0 > "/dev/stderr"; + exit 1; + } + printf "vm_memory_high_watermark.relative %0.03f\n", perc; + next; + } + /^[0-9]+$/ { + printf "vm_memory_high_watermark.absolute %s\n", $0; + next; + } + /^[0-9]+([.][0-9]+)?[a-zA-Z]+$/ { + printf "vm_memory_high_watermark.absolute %s\n", $0; + next; + } + { + printf "error: unexpected input for vm_memory_high_watermark: %s\n", $0; + exit 1; + } + ' + )" + if [ "$vmMemoryHighWatermark" ]; then + vmMemoryHighWatermarkKey="${vmMemoryHighWatermark%% *}" + vmMemoryHighWatermarkVal="${vmMemoryHighWatermark#$vmMemoryHighWatermarkKey }" + rabbit_set_config "$vmMemoryHighWatermarkKey" "$vmMemoryHighWatermarkVal" + case "$vmMemoryHighWatermarkKey" in + # make sure we only set one or the other + 'vm_memory_high_watermark.absolute') rabbit_comment_config 'vm_memory_high_watermark.relative' ;; + 'vm_memory_high_watermark.relative') rabbit_comment_config 'vm_memory_high_watermark.absolute' ;; + esac + fi + fi + + if [ "$haveSslConfig" ]; then + rabbit_set_config 'listeners.ssl.default' 5671 + rabbit_env_config 'ssl' "${sslConfigKeys[@]}" + else + rabbit_set_config 'listeners.tcp.default' 5672 + fi + + rabbit_env_config '' "${rabbitConfigKeys[@]}" + + # if management plugin is installed, generate config for it + # https://www.rabbitmq.com/management.html#configuration + if [ "$(rabbitmq-plugins list -q -m -e 'rabbitmq_management$')" ]; then + if [ "$haveManagementSslConfig" ]; then + rabbit_set_config 'management.listener.port' 15671 + rabbit_set_config 'management.listener.ssl' 'true' + rabbit_env_config 'management_ssl' "${sslConfigKeys[@]}" + else + rabbit_set_config 'management.listener.port' 15672 + rabbit_set_config 'management.listener.ssl' 'false' + fi + + # if definitions file exists, then load it + # https://www.rabbitmq.com/management.html#load-definitions + managementDefinitionsFile='/etc/rabbitmq/definitions.json' + if [ -f "$managementDefinitionsFile" ]; then + # see also https://github.com/docker-library/rabbitmq/pull/112#issuecomment-271485550 + rabbit_set_config 'management.load_definitions' "$managementDefinitionsFile" + fi + fi +fi + +combinedSsl='/tmp/rabbitmq-ssl/combined.pem' +if [ "$haveSslConfig" ] && [[ "$1" == rabbitmq* ]] && [ ! -f "$combinedSsl" ]; then + # Create combined cert + { + cat "$RABBITMQ_SSL_CERTFILE" + echo # https://github.com/docker-library/rabbitmq/issues/357#issuecomment-517755647 + cat "$RABBITMQ_SSL_KEYFILE" + } > "$combinedSsl" + chmod 0400 "$combinedSsl" +fi +if [ "$haveSslConfig" ] && [ -f "$combinedSsl" ]; then + # More ENV vars for make clustering happiness + # we don't handle clustering in this script, but these args should ensure + # clustered SSL-enabled members will talk nicely + export ERL_SSL_PATH="$(erl -eval 'io:format("~p", [code:lib_dir(ssl, ebin)]),halt().' -noshell)" + sslErlArgs="-pa $ERL_SSL_PATH -proto_dist inet_tls -ssl_dist_opt server_certfile $combinedSsl -ssl_dist_opt server_secure_renegotiate true client_secure_renegotiate true" + export RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="${RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS:-} $sslErlArgs" + export RABBITMQ_CTL_ERL_ARGS="${RABBITMQ_CTL_ERL_ARGS:-} $sslErlArgs" +fi + +exec "$@" diff --git a/packaging/generic-unix/Makefile b/packaging/generic-unix/Makefile new file mode 100644 index 0000000000..69f86ae4ec --- /dev/null +++ b/packaging/generic-unix/Makefile @@ -0,0 +1,82 @@ +SOURCE_DIST_FILE ?= $(wildcard ../../../rabbitmq-server-*.tar.xz) + +ifneq ($(filter-out clean,$(MAKECMDGOALS)),) +ifeq ($(SOURCE_DIST_FILE),) +$(error Cannot find source archive; please specify SOURCE_DIST_FILE) +endif +ifneq ($(words $(SOURCE_DIST_FILE)),1) +$(error Multiple source archives found; please specify SOURCE_DIST_FILE) +endif + +VERSION ?= $(patsubst rabbitmq-server-%.tar.xz,%,$(notdir $(SOURCE_DIST_FILE))) +ifeq ($(VERSION),) +$(error Cannot determine version; please specify VERSION) +endif +endif + +SOURCE_DIR = rabbitmq-server-$(VERSION) +TARGET_DIR = rabbitmq_server-$(VERSION) +TARBALL_SUFFIX ?= generic-unix +TARGET_TARBALL = rabbitmq-server-$(TARBALL_SUFFIX)-$(VERSION) + +unexport DEPS_DIR +unexport ERL_LIBS +MAKEOVERRIDES = + +# See comment below about `$(HOME)` and Freedesktop.org variables. +XDG_DATA_HOME ?= $(HOME)/.local/share +XDG_CONFIG_HOME ?= $(HOME)/.config + +all: dist + @: + +dist: +# Log Erlang version. + @echo + @echo '--------------------------------------------------' + @echo "Erlang and Elixir versions used to compile:" + @elixir --version + @echo '--------------------------------------------------' + @echo + xzcat $(SOURCE_DIST_FILE) | tar -xf - + +# web-manpages are not used by generic-unix but by `make release` in the +# Umbrella. Those manpages are copied to www.rabbitmq.com +# +# We explicitely set $HOME as a Make variable below because some package +# builders do that, as part of cleaning the build environment. It +# exercises our hack to convince mix(1) to work offline because that +# hack depends on `$HOME`. A Make variable on the command line takes +# precedence over variables declared in Makefiles, so our hack needs +# to consider this. We do the same with the Freedesktop.org-specified +# variables ($XDG_*_HOME). + $(MAKE) -C $(SOURCE_DIR) \ + HOME="$(HOME)" \ + XDG_DATA_HOME="$(XDG_DATA_HOME)" \ + XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)" \ + PREFIX= RMQ_ROOTDIR= \ + RMQ_ERLAPP_DIR=`pwd`/$(TARGET_DIR) \ + MANDIR=`pwd`/$(TARGET_DIR)/share/man \ + manpages web-manpages install install-man + + sed -e 's:^SYS_PREFIX=$$:SYS_PREFIX=\$${RABBITMQ_HOME}:' \ + $(TARGET_DIR)/sbin/rabbitmq-defaults >$(TARGET_DIR)/sbin/rabbitmq-defaults.tmp \ + && mv $(TARGET_DIR)/sbin/rabbitmq-defaults.tmp $(TARGET_DIR)/sbin/rabbitmq-defaults + chmod 0755 $(TARGET_DIR)/sbin/rabbitmq-defaults + + mkdir -p $(TARGET_DIR)/etc/rabbitmq + + find $(TARGET_DIR) | LC_COLLATE=C sort > $(TARGET_TARBALL).manifest + tar --no-recursion -T $(TARGET_TARBALL).manifest -cf - | \ + xz > $(CURDIR)/$(TARGET_TARBALL).tar.xz + + if test "$(PACKAGES_DIR)"; then \ + mkdir -p "$(PACKAGES_DIR)"; \ + mv $(TARGET_TARBALL).tar.xz "$(PACKAGES_DIR)"; \ + fi + +clean: clean_partial + rm -f rabbitmq-server-$(TARBALL_SUFFIX)-*.tar.xz + +clean_partial: + rm -rf rabbitmq-server-* rabbitmq_server-* diff --git a/packaging/windows-exe/Makefile b/packaging/windows-exe/Makefile new file mode 100644 index 0000000000..2d2adeefdb --- /dev/null +++ b/packaging/windows-exe/Makefile @@ -0,0 +1,36 @@ +ifeq ($(PACKAGES_DIR),) +ZIP_DIR = ../windows +else +ZIP_DIR = $(PACKAGES_DIR) +endif +ZIP = $(notdir $(wildcard $(ZIP_DIR)/rabbitmq-server-windows-*.zip)) + +VERSION = $(patsubst rabbitmq-server-windows-%.zip,%,$(ZIP)) +PRODUCT_VERSION ?= $(shell echo "$(VERSION)" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1.0/') + +unexport DEPS_DIR +unexport ERL_LIBS +MAKEOVERRIDES = + +all: dist + @: + +dist: rabbitmq-$(VERSION).nsi rabbitmq_server-$(VERSION) + makensis -V2 rabbitmq-$(VERSION).nsi + + if test "$(PACKAGES_DIR)"; then \ + mkdir -p "$(PACKAGES_DIR)"; \ + mv rabbitmq-server-$(VERSION).exe "$(PACKAGES_DIR)"; \ + fi + +rabbitmq-$(VERSION).nsi: rabbitmq_nsi.in + sed \ + -e 's|%%VERSION%%|$(VERSION)|' \ + -e 's|%%PRODUCT_VERSION%%|$(PRODUCT_VERSION)|' \ + $< > $@ + +rabbitmq_server-$(VERSION): + unzip -q $(ZIP_DIR)/$(ZIP) + +clean: + rm -rf rabbitmq-*.nsi rabbitmq_server-* rabbitmq-server-*.exe diff --git a/packaging/windows-exe/plugins/ExecDos.dll b/packaging/windows-exe/plugins/ExecDos.dll Binary files differnew file mode 100644 index 0000000000..0d8a871a9d --- /dev/null +++ b/packaging/windows-exe/plugins/ExecDos.dll diff --git a/packaging/windows-exe/plugins/ShellLink.dll b/packaging/windows-exe/plugins/ShellLink.dll Binary files differnew file mode 100755 index 0000000000..f57ded34da --- /dev/null +++ b/packaging/windows-exe/plugins/ShellLink.dll diff --git a/packaging/windows-exe/rabbitmq.ico b/packaging/windows-exe/rabbitmq.ico Binary files differnew file mode 100644 index 0000000000..5e169a7996 --- /dev/null +++ b/packaging/windows-exe/rabbitmq.ico diff --git a/packaging/windows-exe/rabbitmq_nsi.in b/packaging/windows-exe/rabbitmq_nsi.in new file mode 100644 index 0000000000..665d176c1d --- /dev/null +++ b/packaging/windows-exe/rabbitmq_nsi.in @@ -0,0 +1,299 @@ +; Use the "Modern" UI +!include MUI2.nsh +!include LogicLib.nsh +!include WinMessages.nsh +!include FileFunc.nsh +!include WordFunc.nsh +!include x64.nsh + +!addplugindir plugins + +!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' +!define uninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\RabbitMQ" +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_UNFINISHPAGE_NOAUTOCLOSE + +;-------------------------------- + +; The name of the installer +Name "RabbitMQ Server %%VERSION%%" + +; The file to write +OutFile "rabbitmq-server-%%VERSION%%.exe" + +; Icons +!define MUI_ICON "rabbitmq.ico" + +; The default installation directory is empty. The .onInit function +; below takes care of selecting the appropriate (32-bit vs. 64-bit) +; "Program Files". +InstallDir "" + +; Registry key to check for directory (so if you install again, it will +; overwrite the old one automatically) +InstallDirRegKey HKLM "Software\VMware, Inc.\RabbitMQ Server" "Install_Dir" + +; Request application privileges for Windows Vista +RequestExecutionLevel admin + +SetCompressor /solid lzma + +;-------------------------------- + +; Pages + + +; !insertmacro MUI_PAGE_LICENSE "..\..\LICENSE-MPL-RabbitMQ" + !insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + !define MUI_FINISHPAGE_TEXT "RabbitMQ Server %%VERSION%% has been uninstalled from your computer.$\n$\nPlease note that the log and database directories located at $APPDATA\RabbitMQ have not been removed. You can remove them manually if desired." + !insertmacro MUI_UNPAGE_FINISH + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- + +VIProductVersion "%%PRODUCT_VERSION%%" +VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "%%VERSION%%" +VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "RabbitMQ Server" +;VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "" +VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "VMware, Inc." +;VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "" ; TODO ? +VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved." +VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "RabbitMQ Server" +VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "%%VERSION%%" + +; The stuff to install +Section "RabbitMQ Server (required)" Rabbit + + SectionIn RO + + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put files there + File /r "rabbitmq_server-%%VERSION%%" + File "rabbitmq.ico" + + ; Set output path to the user's data directory + SetOutPath $APPDATA\RabbitMQ + + IfFileExists advanced.config 0 +2 + Goto config_written + IfFileExists rabbitmq.config 0 +3 + Rename rabbitmq.config advanced.config + Goto config_written + ClearErrors + FileOpen $0 advanced.config w + IfErrors config_written + FileWrite $0 "[]." + FileClose $0 + config_written: + + ; Write the installation path into the registry + WriteRegStr HKLM "SOFTWARE\VMware, Inc.\RabbitMQ Server" "Install_Dir" "$INSTDIR" + + ; Write the uninstall keys for Windows + WriteRegStr HKLM ${uninstall} "DisplayName" "RabbitMQ Server %%VERSION%%" + WriteRegStr HKLM ${uninstall} "UninstallString" "$INSTDIR\uninstall.exe" + WriteRegStr HKLM ${uninstall} "DisplayIcon" "$INSTDIR\rabbitmq.ico" + WriteRegStr HKLM ${uninstall} "Publisher" "VMware, Inc." + WriteRegStr HKLM ${uninstall} "DisplayVersion" "%%VERSION%%" + WriteRegDWORD HKLM ${uninstall} "NoModify" 1 + WriteRegDWORD HKLM ${uninstall} "NoRepair" 1 + + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 + WriteRegDWORD HKLM "${uninstall}" "EstimatedSize" "$0" + + WriteUninstaller "uninstall.exe" +SectionEnd + +;-------------------------------- + +Section "RabbitMQ Service" RabbitService + DetailPrint "Installing RabbitMQ service..." + ExecDos::exec /DETAILED '"$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" install' "" + DetailPrint "Starting RabbitMQ service..." + ExecDos::exec /DETAILED '"$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" start' "" + ReadEnvStr $1 "HOMEDRIVE" + ReadEnvStr $2 "HOMEPATH" + Delete "$1$2\.erlang.cookie" + ${If} ${RunningX64} + ${DisableX64FSRedirection} + ${EndIf} + IfFileExists "$SYSDIR\config\systemprofile\.erlang.cookie" 0 cookie_check_windir + CopyFiles "$SYSDIR\config\systemprofile\.erlang.cookie" "$1$2\.erlang.cookie" + Goto cookie_done + cookie_check_windir: + IfFileExists "$WINDIR\.erlang.cookie" 0 cookie_done + CopyFiles "$WINDIR\.erlang.cookie" "$1$2\.erlang.cookie" + cookie_done: + ${If} ${RunningX64} + ${EnableX64FSRedirection} + ${EndIf} +SectionEnd + +;-------------------------------- + +Section "Start Menu" RabbitStartMenu + ; In case the service is not installed, or the service installation fails, + ; make sure these exist or Explorer will get confused. + CreateDirectory "$APPDATA\RabbitMQ\log" + CreateDirectory "$APPDATA\RabbitMQ\db" + + CreateDirectory "$SMPROGRAMS\RabbitMQ Server" + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\Uninstall RabbitMQ.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Plugins.lnk" "$INSTDIR\rabbitmq_server-%%VERSION%%\plugins" + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Logs.lnk" "$APPDATA\RabbitMQ\log" + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Database Directory.lnk" "$APPDATA\RabbitMQ\db" + + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - (re)install.lnk" "%comspec%" '/k "$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" install & if not errorlevel 1 exit /b 0' "$INSTDIR\rabbitmq.ico" + ShellLink::SetRunAsAdministrator "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - (re)install.lnk" + + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - remove.lnk" "%comspec%" '/k "$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" remove & if not errorlevel 1 exit /b 0' "$INSTDIR\rabbitmq.ico" + ShellLink::SetRunAsAdministrator "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - remove.lnk" + + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - start.lnk" "%comspec%" '/k "$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" start & if not errorlevel 1 exit /b 0' "$INSTDIR\rabbitmq.ico" + ShellLink::SetRunAsAdministrator "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - start.lnk" + + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - stop.lnk" "%comspec%" '/k "$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" stop & if not errorlevel 1 exit /b 0' "$INSTDIR\rabbitmq.ico" + ShellLink::SetRunAsAdministrator "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Service - stop.lnk" + + SetOutPath "$INSTDIR\rabbitmq_server-%%VERSION%%\sbin" + CreateShortCut "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Command Prompt (sbin dir).lnk" "$SYSDIR\cmd.exe" "/k cd /d $INSTDIR\rabbitmq_server-%%VERSION%%\sbin" "$SYSDIR\cmd.exe" + ShellLink::SetRunAsAdministrator "$SMPROGRAMS\RabbitMQ Server\RabbitMQ Command Prompt (sbin dir).lnk" + + SetOutPath $INSTDIR +SectionEnd + +;-------------------------------- + +; Section descriptions + +LangString DESC_Rabbit ${LANG_ENGLISH} "The RabbitMQ Server." +LangString DESC_RabbitService ${LANG_ENGLISH} "Set up RabbitMQ as a Windows Service." +LangString DESC_RabbitStartMenu ${LANG_ENGLISH} "Add some useful links to the start menu." + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${Rabbit} $(DESC_Rabbit) + !insertmacro MUI_DESCRIPTION_TEXT ${RabbitService} $(DESC_RabbitService) + !insertmacro MUI_DESCRIPTION_TEXT ${RabbitStartMenu} $(DESC_RabbitStartMenu) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- + +; Uninstaller + +Section "Uninstall" + + ; Remove registry keys + DeleteRegKey HKLM ${uninstall} + DeleteRegKey HKLM "SOFTWARE\VMware, Inc.\RabbitMQ Server" + + ; TODO these will fail if the service is not installed - do we care? + DetailPrint "Stopping RabbitMQ service..." + ExecDos::exec /DETAILED '"$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" stop' "" + DetailPrint "Removing RabbitMQ service..." + ExecDos::exec /DETAILED '"$INSTDIR\rabbitmq_server-%%VERSION%%\sbin\rabbitmq-service.bat" remove' "" + + ; Remove files and uninstaller + RMDir /r "$INSTDIR\rabbitmq_server-%%VERSION%%" + Delete "$INSTDIR\rabbitmq.ico" + Delete "$INSTDIR\uninstall.exe" + RMDir "$INSTDIR" + + ; Remove start menu items + RMDir /r "$SMPROGRAMS\RabbitMQ Server" + + DeleteRegValue ${env_hklm} ERLANG_HOME + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + +SectionEnd + +;-------------------------------- + +; Functions + +Function .onInit + ; By default, always install in "\Program Files", not matter if we run + ; on a 32-bit or 64-bit Windows. + ${If} $INSTDIR == ""; + ${If} ${RunningX64} + StrCpy $INSTDIR "$PROGRAMFILES64\RabbitMQ Server" + ${Else} + StrCpy $INSTDIR "$PROGRAMFILES\RabbitMQ Server" + ${EndIf} + ${EndIf} + + Call findErlang + + ReadRegStr $0 HKLM ${uninstall} "UninstallString" + ${If} $0 != "" + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "RabbitMQ is already installed. $\n$\nClick 'OK' to remove the previous version or 'Cancel' to cancel this installation." /SD IDOK IDOK rununinstall IDCANCEL norun + + norun: + Abort + + rununinstall: + ;Run the uninstaller + ClearErrors + ExecWait '"$INSTDIR\uninstall.exe" /S _?=$INSTDIR' + Delete "$INSTDIR\uninstall.exe" + RMDir "$INSTDIR" + ; the unistaller removes the ERLANG_HOME. + ; called again since this is an update + Call findErlang + + ${EndIf} +FunctionEnd + +Function findErlang + + StrCpy $0 0 + StrCpy $2 "not-found" + ${Do} + EnumRegKey $1 HKLM Software\Ericsson\Erlang $0 + ${If} $1 = "" + ${Break} + ${EndIf} + ${If} $1 <> "ErlSrv" + StrCpy $2 $1 + ${EndIf} + + IntOp $0 $0 + 1 + ${Loop} + + ${If} $2 = "not-found" + MessageBox MB_YESNO|MB_ICONEXCLAMATION "Erlang could not be detected.$\nYou must install Erlang before installing RabbitMQ. Would you like the installer to open a browser window to the Erlang download site?" IDNO abort + ExecShell "open" "https://www.erlang.org/download.html" + abort: + Abort + ${Else} + ${VersionCompare} $2 "8.3" $0 + + ${If} $0 = 2 + MessageBox MB_OK|MB_ICONEXCLAMATION "Your installed version of Erlang ($2) is too old. Please install a more recent version." + Abort + ${EndIf} + + ReadRegStr $0 HKLM "Software\Ericsson\Erlang\$2" "" + + ; See https://nsis.sourceforge.io/Setting_Environment_Variables + WriteRegExpandStr ${env_hklm} ERLANG_HOME $0 + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + ; On Windows XP changing the permanent environment does not change *our* + ; environment, so do that as well. + System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("ERLANG_HOME", "$0").r0' + ${EndIf} + +FunctionEnd diff --git a/packaging/windows/Makefile b/packaging/windows/Makefile new file mode 100644 index 0000000000..1ff655aeaa --- /dev/null +++ b/packaging/windows/Makefile @@ -0,0 +1,66 @@ +SOURCE_DIST_FILE ?= $(wildcard ../../../rabbitmq-server-*.tar.xz) + +ifneq ($(filter-out clean,$(MAKECMDGOALS)),) +ifeq ($(SOURCE_DIST_FILE),) +$(error Cannot find source archive; please specify SOURCE_DIST_FILE) +endif +ifneq ($(words $(SOURCE_DIST_FILE)),1) +$(error Multiple source archives found; please specify SOURCE_DIST_FILE) +endif + +VERSION ?= $(patsubst rabbitmq-server-%.tar.xz,%,$(notdir $(SOURCE_DIST_FILE))) +ifeq ($(VERSION),) +$(error Cannot determine version; please specify VERSION) +endif +endif + +SOURCE_DIR = rabbitmq-server-$(VERSION) +TARGET_DIR = rabbitmq_server-$(VERSION) +TARGET_ZIP = rabbitmq-server-windows-$(VERSION) + +unexport DEPS_DIR +unexport ERL_LIBS +MAKEOVERRIDES = + +# See comment below about `$(HOME)` and Freedesktop.org variables. +XDG_DATA_HOME ?= $(HOME)/.local/share +XDG_CONFIG_HOME ?= $(HOME)/.config + +all: dist + @: + +dist: +# Log Erlang version. + @echo + @echo '--------------------------------------------------' + @echo "Erlang and Elixir versions used to compile:" + @elixir --version + @echo '--------------------------------------------------' + @echo + xzcat $(SOURCE_DIST_FILE) | tar -xf - + +# We explicitely set $HOME as a Make variable below because some package +# builders do that, as part of cleaning the build environment. It +# exercises our hack to convince mix(1) to work offline because that +# hack depends on `$HOME`. A Make variable on the command line takes +# precedence over variables declared in Makefiles, so our hack needs +# to consider this. We do the same with the Freedesktop.org-specified +# variables ($XDG_*_HOME). + $(MAKE) -C $(SOURCE_DIR) install-windows \ + DESTDIR=$(abspath $(TARGET_DIR)) \ + WINDOWS_PREFIX= \ + HOME="$(HOME)" \ + XDG_DATA_HOME="$(XDG_DATA_HOME)" \ + XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)" + + cp -a README-etc $(TARGET_DIR)/etc/README.txt + + zip -q -r $(TARGET_ZIP).zip $(TARGET_DIR) + + if test "$(PACKAGES_DIR)"; then \ + mkdir -p "$(PACKAGES_DIR)"; \ + mv $(TARGET_ZIP).zip "$(PACKAGES_DIR)"; \ + fi + +clean: + rm -rf rabbitmq-server-* rabbitmq_server-* diff --git a/packaging/windows/README-etc b/packaging/windows/README-etc new file mode 100644 index 0000000000..b431247c6b --- /dev/null +++ b/packaging/windows/README-etc @@ -0,0 +1,7 @@ +In this directory you can find an example configuration file for RabbitMQ.
+
+Note that this directory is *not* where the real RabbitMQ
+configuration lives. The default location for the real configuration
+file is %APPDATA%\RabbitMQ\rabbitmq.config.
+
+%APPDATA% usually expands to C:\Users\%USERNAME%\AppData\Roaming or similar.
|