46 lines
1.7 KiB
Bash
Executable File
46 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eux
|
|
|
|
install-packages rabbitmq-server
|
|
|
|
# Ensure we leave symlinks in place for RabbitMQ state paths
|
|
register-state-path --leave-symlink /var/lib/rabbitmq
|
|
register-state-path --leave-symlink /var/log/rabbitmq
|
|
|
|
FILES="$(dirname $0)/../files"
|
|
|
|
# Note(jang): the rabbitmq-server service is installed, but not started, since
|
|
# the first run of os-collect-config is required to configure it properly.
|
|
|
|
# In Ubuntu rabbit's default init.d script is broken.
|
|
if [ "$DISTRO_NAME" = "ubuntu" ] || [ "$DISTRO_NAME" = "debian" -a "$DIB_INIT_SYSTEM" = "upstart" ]; then
|
|
update-rc.d -f rabbitmq-server remove
|
|
rm /etc/init.d/rabbitmq-server
|
|
|
|
# Note(jang) The os-svc-daemon script has too many assumptions baked into it
|
|
# that it'll be running a venv-based service to use directly. Install an upstart
|
|
# configuration that's compatible with os-svc-enable and os-svc-restart
|
|
|
|
FILE=/etc/init/rabbitmq-server.conf
|
|
install -g root -o root -m 0755 "${FILES}${FILE}" "${FILE}"
|
|
fi
|
|
|
|
if [ "$DIB_INIT_SYSTEM" = "systemd" ]; then
|
|
# Delay the rc-local.service start-up until rabbitmq-server.service is started up
|
|
sed -i 's/\[Unit\]/\[Unit\]\nBefore=rc-local.service/g' /lib/systemd/system/rabbitmq-server.service
|
|
|
|
# Respawn rabbitmq-server in case the process exits with an nonzero exit code
|
|
sed -i 's/\[Service\]/\[Service\]\nRestart=on-failure/g' /lib/systemd/system/rabbitmq-server.service
|
|
fi
|
|
|
|
FILE=/etc/rabbitmq/rabbitmq-env.conf
|
|
install -g root -o root -m 0755 "${FILES}${FILE}" "${FILE}"
|
|
|
|
# Enable ulimits in pam if needed
|
|
PAM_FILE=/etc/pam.d/su
|
|
sed -i '/# session.*pam_limits\.so/s/# //' ${PAM_FILE}
|
|
|
|
# Reserve the cluster port (61000) from the ephemeral port range.
|
|
sysctl-append-value net.ipv4.ip_local_reserved_ports 61000
|