mirror of https://github.com/zulip/zulip.git
Move the current deployment symlink in restart-server
This will help minimize downtime. (imported from commit 47fb66f0d2e21fc12f62c69b7c59ca6828553309)
This commit is contained in:
parent
300e57fcbd
commit
8884e81bb3
|
@ -6,12 +6,13 @@ import pylibmc
|
||||||
import traceback
|
import traceback
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from humbug_tools import ENDC, WARNING, OKGREEN
|
from humbug_tools import ENDC, WARNING, OKGREEN, DEPLOYMENTS_DIR
|
||||||
|
|
||||||
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
||||||
level=logging.INFO)
|
level=logging.INFO)
|
||||||
|
|
||||||
os.chdir("/home/humbug/humbug-deployments/current")
|
deploy_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
os.chdir(deploy_path)
|
||||||
|
|
||||||
# Send a statsd event on restarting the server
|
# Send a statsd event on restarting the server
|
||||||
subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
|
subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.server_restart", str(int(time.time()))])
|
||||||
|
@ -26,6 +27,9 @@ logging.info("Killing daemons")
|
||||||
subprocess.check_call(["supervisorctl", "stop", "humbug-workers:*"])
|
subprocess.check_call(["supervisorctl", "stop", "humbug-workers:*"])
|
||||||
subprocess.check_call(["supervisorctl", "stop", "humbug-django"])
|
subprocess.check_call(["supervisorctl", "stop", "humbug-django"])
|
||||||
subprocess.check_call(["supervisorctl", "restart", "humbug-tornado"])
|
subprocess.check_call(["supervisorctl", "restart", "humbug-tornado"])
|
||||||
|
|
||||||
|
subprocess.check_call(["ln", '-nsf', deploy_path, os.path.join(DEPLOYMENTS_DIR, "current")])
|
||||||
|
|
||||||
subprocess.check_call(["supervisorctl", "start", "humbug-django"])
|
subprocess.check_call(["supervisorctl", "start", "humbug-django"])
|
||||||
subprocess.check_call(["supervisorctl", "start", "humbug-workers:*"])
|
subprocess.check_call(["supervisorctl", "start", "humbug-workers:*"])
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,6 @@ subprocess.check_call(["find", ".", "-name", "*.pyc", "-delete"], stdout=open('/
|
||||||
logging.info("Updating static files")
|
logging.info("Updating static files")
|
||||||
subprocess.check_call(["./tools/update-prod-static"])
|
subprocess.check_call(["./tools/update-prod-static"])
|
||||||
|
|
||||||
subprocess.check_call(["ln", '-nsf', deploy_path, os.path.join(DEPLOYMENTS_DIR, "current")])
|
|
||||||
|
|
||||||
logging.info("Restarting server...")
|
logging.info("Restarting server...")
|
||||||
subprocess.check_call(["./tools/restart-server"])
|
subprocess.check_call(["./tools/restart-server"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue