mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	The moved files are: humbug-server humbug-local humbug-machinetype Their new names are their old names with 'humbug-' removed. zulip-puppet-apply must be run before this commit is deployed (imported from commit f4eb523244d3409b5809c279301225d3fdf0c230)
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env python
 | 
						|
import os
 | 
						|
import sys
 | 
						|
import pwd
 | 
						|
import subprocess
 | 
						|
import logging
 | 
						|
import time
 | 
						|
 | 
						|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 | 
						|
from zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR
 | 
						|
 | 
						|
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
 | 
						|
                    level=logging.INFO)
 | 
						|
 | 
						|
deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
 | 
						|
os.chdir(deploy_path)
 | 
						|
 | 
						|
if os.path.exists("/etc/zulip/server"):
 | 
						|
    with open("/etc/zulip/machinetype") as mtf:
 | 
						|
        if pwd.getpwuid(os.getuid())[0] != "zulip":
 | 
						|
            logging.error("Must be run as user 'zulip'.")
 | 
						|
            sys.exit(1)
 | 
						|
 | 
						|
# Send a statsd event on restarting the server
 | 
						|
subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
 | 
						|
 | 
						|
logging.info("Filling memcached caches")
 | 
						|
subprocess.check_call(["python", "./manage.py", "fill_memcached_caches"])
 | 
						|
 | 
						|
# Restart the FastCGI and related processes via supervisorctl.
 | 
						|
logging.info("Killing daemons")
 | 
						|
subprocess.check_call(["supervisorctl", "stop", "zulip-workers:* zulip-django zulip-tornado"])
 | 
						|
subprocess.check_call(["ln", '-nsf', deploy_path, os.path.join(DEPLOYMENTS_DIR, "current")])
 | 
						|
subprocess.check_call(["supervisorctl", "start", "zulip-tornado zulip-django zulip-workers:*"])
 | 
						|
 | 
						|
logging.info("Done!")
 | 
						|
print OKGREEN + "Application restarted successfully!" + ENDC
 |