mirror of https://github.com/zulip/zulip.git
Make rabbitmq, redis, and memcached configurable via user settings.py.
Previously these were hardcoded in zproject/settings.py to be accessed on localhost. [Modified by Tim Abbott to adjust comments and fix configure-rabbitmq]
This commit is contained in:
parent
6943a142ea
commit
84f7a1f1ea
|
@ -3,9 +3,11 @@
|
|||
# Delete the "guest" default user and replace it with a Zulip user
|
||||
# with a real password
|
||||
|
||||
RMQPW=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD)
|
||||
RABBITMQ_USERNAME=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_USERNAME)
|
||||
RABBITMQ_PASSWORD=$("$(dirname "$0")/../../bin/get-django-setting" RABBITMQ_PASSWORD)
|
||||
sudo rabbitmqctl delete_user "$RABBITMQ_USERNAME" || true
|
||||
sudo rabbitmqctl delete_user zulip || true
|
||||
sudo rabbitmqctl delete_user guest || true
|
||||
sudo rabbitmqctl add_user zulip "$RMQPW"
|
||||
sudo rabbitmqctl set_user_tags zulip administrator
|
||||
sudo rabbitmqctl set_permissions -p / zulip '.*' '.*' '.*'
|
||||
sudo rabbitmqctl add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD"
|
||||
sudo rabbitmqctl set_user_tags "$RABBITMQ_USERNAME" administrator
|
||||
sudo rabbitmqctl set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*'
|
||||
|
|
|
@ -37,7 +37,7 @@ class SimpleQueueClient(object):
|
|||
self._connect()
|
||||
|
||||
def _get_parameters(self):
|
||||
return pika.ConnectionParameters('localhost',
|
||||
return pika.ConnectionParameters(settings.RABBITMQ_HOST,
|
||||
credentials = pika.PlainCredentials(
|
||||
settings.RABBITMQ_USERNAME, settings.RABBITMQ_PASSWORD))
|
||||
|
||||
|
|
|
@ -298,3 +298,32 @@ AUTH_LDAP_USER_ATTR_MAP = {
|
|||
}
|
||||
|
||||
CAMO_URI = ''
|
||||
|
||||
# RabbitMQ configuration
|
||||
#
|
||||
# By default, Zulip connects to rabbitmq running locally on the machine,
|
||||
# but Zulip also supports connecting to RabbitMQ over the network;
|
||||
# to use a remote RabbitMQ instance, set RABBITMQ_HOST here.
|
||||
# RABBITMQ_HOST = "localhost"
|
||||
# To use another rabbitmq user than the default 'zulip', set RABBITMQ_USERNAME here.
|
||||
# RABBITMQ_USERNAME = 'zulip'
|
||||
|
||||
# Memcached configuration
|
||||
#
|
||||
# By default, Zulip connects to memcached running locally on the machine,
|
||||
# but Zulip also supports connecting to memcached over the network;
|
||||
# to use a remote Memcached instance, set MEMCACHED_LOCATION here.
|
||||
# Format HOST:PORT
|
||||
# MEMCACHED_LOCATION = 127.0.0.1:11211
|
||||
|
||||
# Redis configuration
|
||||
#
|
||||
# By default, Zulip connects to redis running locally on the machine,
|
||||
# but Zulip also supports connecting to redis over the network;
|
||||
# to use a remote RabbitMQ instance, set REDIS_HOST here.
|
||||
# REDIS_HOST = '127.0.0.1'
|
||||
# For a different redis port set the REDIS_PORT here.
|
||||
# REDIS_PORT = 6379
|
||||
|
||||
# Controls whether Zulip will rate-limit user requests.
|
||||
# RATE_LIMITING = True
|
||||
|
|
|
@ -126,6 +126,12 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
|||
'JWT_AUTH_KEYS': {},
|
||||
'NAME_CHANGES_DISABLED': False,
|
||||
'DEPLOYMENT_ROLE_NAME': "",
|
||||
'RABBITMQ_HOST': 'localhost',
|
||||
'RABBITMQ_USERNAME': 'zulip',
|
||||
'MEMCACHED_LOCATION': '127.0.0.1:11211',
|
||||
'RATE_LIMITING': True,
|
||||
'REDIS_HOST': '127.0.0.1',
|
||||
'REDIS_PORT': 6379,
|
||||
# The following bots only exist in non-VOYAGER installs
|
||||
'ERROR_BOT': None,
|
||||
'NEW_USER_BOT': None,
|
||||
|
@ -327,7 +333,6 @@ elif REMOTE_POSTGRES_HOST != '':
|
|||
########################################################################
|
||||
|
||||
USING_RABBITMQ = True
|
||||
RABBITMQ_USERNAME = 'zulip'
|
||||
RABBITMQ_PASSWORD = get_secret("rabbitmq_password")
|
||||
|
||||
########################################################################
|
||||
|
@ -339,7 +344,7 @@ SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
|||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
'LOCATION': MEMCACHED_LOCATION,
|
||||
'TIMEOUT': 3600
|
||||
},
|
||||
'database': {
|
||||
|
@ -359,10 +364,6 @@ CACHES = {
|
|||
# REDIS-BASED RATE LIMITING CONFIGURATION
|
||||
########################################################################
|
||||
|
||||
RATE_LIMITING = True
|
||||
REDIS_HOST = '127.0.0.1'
|
||||
REDIS_PORT = 6379
|
||||
|
||||
RATE_LIMITING_RULES = [
|
||||
(60, 100), # 100 requests max every minute
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue