diff --git a/puppet/zulip/templates/nginx/tornado-upstreams.conf.template.erb b/puppet/zulip/templates/nginx/tornado-upstreams.conf.template.erb index 7c72a8bef8..b60d581c3a 100644 --- a/puppet/zulip/templates/nginx/tornado-upstreams.conf.template.erb +++ b/puppet/zulip/templates/nginx/tornado-upstreams.conf.template.erb @@ -7,7 +7,7 @@ upstream tornado<%= port %> { <% end -%> <% else -%> upstream tornado { - server 127.0.0.1:9993; + server 127.0.0.1:9800; keepalive 10000; } <% end -%> diff --git a/puppet/zulip/templates/supervisor/zulip.conf.template.erb b/puppet/zulip/templates/supervisor/zulip.conf.template.erb index 2586e9d27f..c142bd59e6 100644 --- a/puppet/zulip/templates/supervisor/zulip.conf.template.erb +++ b/puppet/zulip/templates/supervisor/zulip.conf.template.erb @@ -41,7 +41,7 @@ directory=/home/zulip/deployments/current/ numprocs=<%= @tornado_processes %> <% else -%> [program:zulip-tornado] -command=env PYTHONUNBUFFERED=1 /home/zulip/deployments/current/manage.py runtornado 127.0.0.1:9993 +command=env PYTHONUNBUFFERED=1 /home/zulip/deployments/current/manage.py runtornado 127.0.0.1:9800 priority=200 ; the relative start priority (default 999) autostart=true ; start at supervisord start (default: true) autorestart=true ; whether/when to restart (default: unexpected) diff --git a/zerver/tests/test_event_queue.py b/zerver/tests/test_event_queue.py index 50497337c5..c295598811 100644 --- a/zerver/tests/test_event_queue.py +++ b/zerver/tests/test_event_queue.py @@ -483,16 +483,16 @@ class MissedMessageNotificationsTest(ZulipTestCase): class FileReloadLogicTest(ZulipTestCase): def test_persistent_queue_filename(self) -> None: with self.settings(JSON_PERSISTENT_QUEUE_FILENAME_PATTERN="/home/zulip/tornado/event_queues%s.json"): - self.assertEqual(persistent_queue_filename(9993), + self.assertEqual(persistent_queue_filename(9800), "/home/zulip/tornado/event_queues.json") - self.assertEqual(persistent_queue_filename(9993, last=True), + self.assertEqual(persistent_queue_filename(9800, last=True), "/home/zulip/tornado/event_queues.json.last") with self.settings(JSON_PERSISTENT_QUEUE_FILENAME_PATTERN="/home/zulip/tornado/event_queues%s.json", TORNADO_PROCESSES=4): - self.assertEqual(persistent_queue_filename(9993), - "/home/zulip/tornado/event_queues.9993.json") - self.assertEqual(persistent_queue_filename(9993, last=True), - "/home/zulip/tornado/event_queues.9993.last.json") + self.assertEqual(persistent_queue_filename(9800), + "/home/zulip/tornado/event_queues.9800.json") + self.assertEqual(persistent_queue_filename(9800, last=True), + "/home/zulip/tornado/event_queues.9800.last.json") class EventQueueTest(ZulipTestCase): def get_client_descriptor(self) -> ClientDescriptor: diff --git a/zerver/tornado/sharding.py b/zerver/tornado/sharding.py index 230e011095..e1328c038f 100644 --- a/zerver/tornado/sharding.py +++ b/zerver/tornado/sharding.py @@ -13,7 +13,7 @@ if os.path.exists("/etc/zulip/sharding.json"): def get_tornado_port(realm: Realm) -> int: if settings.TORNADO_SERVER is None: - return 9993 + return 9800 if settings.TORNADO_PROCESSES == 1: r = urlsplit(settings.TORNADO_SERVER) assert r.port is not None diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py index 954d049c05..15d01690eb 100644 --- a/zproject/computed_settings.py +++ b/zproject/computed_settings.py @@ -2,7 +2,7 @@ import os import sys import time from copy import deepcopy -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Dict, List, Tuple, Union from urllib.parse import urljoin from django.template.loaders import app_directories @@ -231,11 +231,7 @@ INSTALLED_APPS += EXTRA_INSTALLED_APPS ZILENCER_ENABLED = 'zilencer' in INSTALLED_APPS CORPORATE_ENABLED = 'corporate' in INSTALLED_APPS -# Base URL of the Tornado server -# We set it to None when running backend tests or populate_db. -# We override the port number when running frontend tests. TORNADO_PROCESSES = int(get_config('application_server', 'tornado_processes', '1')) -TORNADO_SERVER: Optional[str] = 'http://127.0.0.1:9993' RUNNING_INSIDE_TORNADO = False AUTORELOAD = DEBUG diff --git a/zproject/default_settings.py b/zproject/default_settings.py index 5ef7288aa9..e2a0fed4e6 100644 --- a/zproject/default_settings.py +++ b/zproject/default_settings.py @@ -149,6 +149,11 @@ THUMBOR_SERVES_CAMO = False THUMBNAIL_IMAGES = False SENDFILE_BACKEND: Optional[str] = None +# Base URL of the Tornado server +# We set it to None when running backend tests or populate_db. +# We override the port number when running frontend tests. +TORNADO_SERVER: Optional[str] = 'http://127.0.0.1:9800' + # ToS/Privacy templates PRIVACY_POLICY: Optional[str] = None TERMS_OF_SERVICE: Optional[str] = None diff --git a/zproject/dev_settings.py b/zproject/dev_settings.py index 7d53bda1a6..f9efb1fe0a 100644 --- a/zproject/dev_settings.py +++ b/zproject/dev_settings.py @@ -69,6 +69,8 @@ EXTRA_INSTALLED_APPS = ["zilencer", "analytics", "corporate"] # Disable Camo in development CAMO_URI = '' +TORNADO_SERVER = "http://127.0.0.1:9993" + OPEN_REALM_CREATION = True INVITES_MIN_USER_AGE_DAYS = 0