Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
rabbitmq: Support non-/ vhosts.
Alex Vandiver58145836940f
diff --git a/scripts/setup/configure-rabbitmq b/scripts/setup/configure-rabbitmqindex e9ea28b0086..0e7711dd019 100755--- a/scripts/setup/configure-rabbitmq+++ b/scripts/setup/configure-rabbitmq@@ -10,6 +10,7 @@ set -euRABBITMQ_USERNAME=$("$(dirname "$0")/../get-django-setting" RABBITMQ_USERNAME)RABBITMQ_PASSWORD=$("$(dirname "$0")/../get-django-setting" RABBITMQ_PASSWORD)+RABBITMQ_VHOST=$("$(dirname "$0")/../get-django-setting" RABBITMQ_VHOST)rabbitmqctl await_startuprabbitmqctl delete_user "$RABBITMQ_USERNAME" || true@@ -17,4 +18,7 @@ rabbitmqctl delete_user zulip || truerabbitmqctl delete_user guest || truerabbitmqctl add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD"rabbitmqctl set_user_tags "$RABBITMQ_USERNAME" administrator-rabbitmqctl set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*'+if ! rabbitmqctl list_vhosts --no-table-headers --quiet | grep -qx "$RABBITMQ_VHOST"; then+ rabbitmqcql add_vhost "$RABBITMQ_VHOST"+fi+rabbitmqctl set_permissions -p "$RABBITMQ_VHOST" "$RABBITMQ_USERNAME" '.*' '.*' '.*'diff --git a/zerver/lib/queue.py b/zerver/lib/queue.pyindex 0aee5cd12ee..e7966733efa 100644--- a/zerver/lib/queue.py+++ b/zerver/lib/queue.py@@ -89,6 +89,7 @@ class QueueClient(Generic[ChannelT], metaclass=ABCMeta):return pika.ConnectionParameters(settings.RABBITMQ_HOST,port=settings.RABBITMQ_PORT,+ virtual_host=settings.RABBITMQ_VHOST,heartbeat=self.rabbitmq_heartbeat,tcp_options=tcp_options,ssl_options=ssl_options,diff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex 651b79087dd..303e3c8550f 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -191,6 +191,7 @@ MEMCACHED_LOCATION = "127.0.0.1:11211"MEMCACHED_USERNAME = None if get_secret("memcached_password") is None else "zulip@localhost"RABBITMQ_HOST = "127.0.0.1"RABBITMQ_PORT = 5672+RABBITMQ_VHOST = "/"RABBITMQ_USERNAME = "zulip"RABBITMQ_USE_TLS = FalseREDIS_HOST = "127.0.0.1"diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.pyindex d1fcc9be2d1..63d3c0408bc 100644--- a/zproject/prod_settings_template.py+++ b/zproject/prod_settings_template.py@@ -606,6 +606,8 @@ SOCIAL_AUTH_SAML_SUPPORT_CONTACT = {## optionally RABBITMQ_PORT, to the hostname and port here.# RABBITMQ_HOST = "127.0.0.1"# RABBITMQ_PORT = 5672+## To use a different RabbitMQ "virtual host", adjust this.+# RABBITMQ_VHOST = "/"## To use another RabbitMQ user than the default "zulip", set RABBITMQ_USERNAME here.# RABBITMQ_USERNAME = "zulip"## To access the RabbitMQ server over TLS, set this to True; this is