diff --git a/puppet/zulip/files/postgresql/process_fts_updates b/puppet/zulip/files/postgresql/process_fts_updates index e3ab8436e3..5225ad9d6c 100755 --- a/puppet/zulip/files/postgresql/process_fts_updates +++ b/puppet/zulip/files/postgresql/process_fts_updates @@ -73,6 +73,8 @@ try: from django.conf import settings if settings.REMOTE_POSTGRES_HOST != '': pg_args['host'] = settings.REMOTE_POSTGRES_HOST + if settings.REMOTE_POSTGRES_PORT != '': + pg_args['port'] = settings.REMOTE_POSTGRES_PORT USING_PGROONGA = settings.USING_PGROONGA except ImportError: # process_fts_updates also supports running locally on a remote diff --git a/zproject/default_settings.py b/zproject/default_settings.py index 850f0d7293..3c03af9dfb 100644 --- a/zproject/default_settings.py +++ b/zproject/default_settings.py @@ -113,6 +113,7 @@ RABBITMQ_USERNAME = 'zulip' REDIS_HOST = '127.0.0.1' REDIS_PORT = 6379 REMOTE_POSTGRES_HOST = '' +REMOTE_POSTGRES_PORT = '' REMOTE_POSTGRES_SSLMODE = '' THUMBOR_URL = '' THUMBOR_SERVES_CAMO = False diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py index 1a2fc822be..db12133137 100644 --- a/zproject/prod_settings_template.py +++ b/zproject/prod_settings_template.py @@ -393,12 +393,13 @@ ENABLE_GRAVATAR = True #DEFAULT_AVATAR_URI = '/local-static/default-avatar.png' # To access an external postgres database you should define the host name in -# REMOTE_POSTGRES_HOST, you can define the password in the secrets file in the +# REMOTE_POSTGRES_HOST, port in REMOTE_POSTGRES_PORT, password in the secrets file in the # property postgres_password, and the SSL connection mode in REMOTE_POSTGRES_SSLMODE # Valid values for REMOTE_POSTGRES_SSLMODE are documented in the # "SSL Mode Descriptions" table in # https://www.postgresql.org/docs/9.5/static/libpq-ssl.html #REMOTE_POSTGRES_HOST = 'dbserver.example.com' +#REMOTE_POSTGRES_PORT = '5432' #REMOTE_POSTGRES_SSLMODE = 'require' # If you want to set a Terms of Service for your server, set the path diff --git a/zproject/settings.py b/zproject/settings.py index b89518cf1f..6b670ba49a 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -282,6 +282,7 @@ if DEVELOPMENT: elif REMOTE_POSTGRES_HOST != '': DATABASES['default'].update({ 'HOST': REMOTE_POSTGRES_HOST, + 'PORT': REMOTE_POSTGRES_PORT }) if get_secret("postgres_password") is not None: DATABASES['default'].update({