mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Thumbor and tc-aws have been dragging their feet on Python 3 support for years, and even the alphas and unofficial forks we’ve been running don’t seem to be maintained anymore. Depending on these projects is no longer viable for us. Signed-off-by: Anders Kaseorg <anders@zulip.com>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env python3
 | 
						|
import logging
 | 
						|
import os
 | 
						|
import pwd
 | 
						|
import subprocess
 | 
						|
import sys
 | 
						|
import time
 | 
						|
 | 
						|
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
 | 
						|
from scripts.lib.zulip_tools import ENDC, OKGREEN, WARNING
 | 
						|
 | 
						|
deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
 | 
						|
os.chdir(deploy_path)
 | 
						|
 | 
						|
if pwd.getpwuid(os.getuid()).pw_name != "zulip":
 | 
						|
    logging.error("Must be run as user 'zulip'.")
 | 
						|
    sys.exit(1)
 | 
						|
 | 
						|
logging.Formatter.converter = time.gmtime
 | 
						|
logging.basicConfig(format="%(asctime)s stop-server: %(message)s", level=logging.INFO)
 | 
						|
 | 
						|
services = []
 | 
						|
 | 
						|
# Start with the least-critical services:
 | 
						|
if os.path.exists("/etc/supervisor/conf.d/zulip/zulip_db.conf"):
 | 
						|
    services.append("process-fts-updates")
 | 
						|
 | 
						|
# Contrary to the order in (re)start-server, we stop django before the
 | 
						|
# workers, to increase the chance that we finish processing any work
 | 
						|
# that may have been enqueued by the Django, leaving the final state
 | 
						|
# closer to "empty."  We stop Django before Tornado so it doesn't try
 | 
						|
# to make requests to make queues with a down'd Tornado.
 | 
						|
services.append("zulip-django")
 | 
						|
services.extend(["zulip-tornado", "zulip-tornado:*"])
 | 
						|
services.append("zulip-workers:*")
 | 
						|
 | 
						|
subprocess.check_call(["supervisorctl", "stop", *services])
 | 
						|
 | 
						|
print()
 | 
						|
print(OKGREEN + "Zulip stopped successfully!" + ENDC)
 | 
						|
 | 
						|
using_sso = subprocess.check_output(["./scripts/get-django-setting", "USING_APACHE_SSO"])
 | 
						|
if using_sso.strip() == b"True":
 | 
						|
    print()
 | 
						|
    print(WARNING + "Apache2 needs to be shut down; as root, run:" + ENDC)
 | 
						|
    print("    service apache2 stop")
 | 
						|
    print()
 |