mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	run-dev: Display ports more nicely.
Here is the new output for displaying ports:
    Zulip services will listen on ports:
       9991: web proxy
       9992: Django
       9993: Tornado
       9994: webpack
       9995: Thumbor
    Note to Vagrant users: Only the proxy port (9991) is exposed.
I tone down the yellow for the Vagrant warning, and I show
the web proxy in cyan to emphasize it.
I also extracted the code into a function, and I don't call
that function until after `app.listen()`.  (The users probably
won't notice much difference in the timing of this message, but
the message won't show if the `listen` step fails for some
reason, which I think is what we want here.)
			
			
This commit is contained in:
		@@ -100,7 +100,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
 | 
			
		||||
 | 
			
		||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 | 
			
		||||
 | 
			
		||||
from scripts.lib.zulip_tools import WARNING, ENDC
 | 
			
		||||
from scripts.lib.zulip_tools import CYAN, WARNING, ENDC
 | 
			
		||||
 | 
			
		||||
proxy_port = base_port
 | 
			
		||||
django_port = base_port + 1
 | 
			
		||||
@@ -325,18 +325,25 @@ def shutdown_handler(*args: Any, **kwargs: Any) -> None:
 | 
			
		||||
    else:
 | 
			
		||||
        io_loop.stop()
 | 
			
		||||
 | 
			
		||||
# log which services/ports will be started
 | 
			
		||||
print("Starting Zulip services on ports: web proxy: {},".format(proxy_port),
 | 
			
		||||
      "Django: {}, Tornado: {}, Thumbor: {}".format(django_port, tornado_port, thumbor_port),
 | 
			
		||||
      end='')
 | 
			
		||||
if options.test:
 | 
			
		||||
    print("")  # no webpack for --test
 | 
			
		||||
else:
 | 
			
		||||
    print(", webpack: {}".format(webpack_port))
 | 
			
		||||
def print_listeners() -> None:
 | 
			
		||||
    print("\nZulip services will listen on ports:")
 | 
			
		||||
    ports = [
 | 
			
		||||
        (proxy_port, CYAN + 'web proxy' + ENDC),
 | 
			
		||||
        (django_port, 'Django'),
 | 
			
		||||
        (tornado_port, 'Tornado'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
print("".join((WARNING,
 | 
			
		||||
               "Note: only port {} is exposed to the host in a Vagrant environment.".format(
 | 
			
		||||
                   proxy_port), ENDC)))
 | 
			
		||||
    if not options.test:
 | 
			
		||||
        ports.append((webpack_port, 'webpack'))
 | 
			
		||||
 | 
			
		||||
    ports.append((thumbor_port, 'Thumbor'))
 | 
			
		||||
 | 
			
		||||
    for port, label in ports:
 | 
			
		||||
        print(f'   {port}: {label}')
 | 
			
		||||
    print()
 | 
			
		||||
 | 
			
		||||
    proxy_warning = f"Only the proxy port ({proxy_port}) is exposed."
 | 
			
		||||
    print(WARNING + "Note to Vagrant users: " + ENDC + proxy_warning + '\n')
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    app = Application(enable_logging=options.enable_tornado_logging)
 | 
			
		||||
@@ -346,6 +353,9 @@ try:
 | 
			
		||||
        if e.errno == 98:
 | 
			
		||||
            print('\n\nERROR: You probably have another server running!!!\n\n')
 | 
			
		||||
        raise
 | 
			
		||||
 | 
			
		||||
    print_listeners()
 | 
			
		||||
 | 
			
		||||
    ioloop = IOLoop.instance()
 | 
			
		||||
    for s in (signal.SIGINT, signal.SIGTERM):
 | 
			
		||||
        signal.signal(s, shutdown_handler)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user