diff --git a/tools/restart-server b/tools/restart-server index 2fc4acf9d0..6c869480c6 100755 --- a/tools/restart-server +++ b/tools/restart-server @@ -6,12 +6,13 @@ import pylibmc import traceback import logging 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", 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 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-django"]) 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-workers:*"]) diff --git a/tools/update-deployment b/tools/update-deployment index 75b446d184..657fd3b2d0 100755 --- a/tools/update-deployment +++ b/tools/update-deployment @@ -45,8 +45,6 @@ subprocess.check_call(["find", ".", "-name", "*.pyc", "-delete"], stdout=open('/ logging.info("Updating static files") subprocess.check_call(["./tools/update-prod-static"]) -subprocess.check_call(["ln", '-nsf', deploy_path, os.path.join(DEPLOYMENTS_DIR, "current")]) - logging.info("Restarting server...") subprocess.check_call(["./tools/restart-server"])