2013-11-08 22:41:12 +01:00
|
|
|
#!/usr/bin/python -u
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import subprocess
|
|
|
|
import datetime
|
|
|
|
import tempfile
|
|
|
|
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
|
|
from zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT, FAIL, ENDC
|
|
|
|
|
|
|
|
if len(sys.argv) != 2:
|
|
|
|
print FAIL + "Usage: %s <tarball>" % (sys.argv[0],) + ENDC
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
tarball_path = sys.argv[1]
|
|
|
|
|
|
|
|
timestamp = datetime.datetime.now().strftime(TIMESTAMP_FORMAT)
|
|
|
|
deploy_path = os.path.join(DEPLOYMENTS_DIR, timestamp)
|
|
|
|
|
|
|
|
extract_path = tempfile.mkdtemp()
|
|
|
|
subprocess.check_call(["tar", "-xf", tarball_path, "-C", extract_path])
|
|
|
|
subprocess.check_call(["mv", os.path.join(extract_path, "zulip-server"), deploy_path])
|
|
|
|
subprocess.check_call(["rmdir", extract_path])
|
2013-11-08 23:13:56 +01:00
|
|
|
subprocess.check_call(["ln", "-nsf", "/etc/zulip/settings.py",
|
|
|
|
os.path.join(deploy_path, "zproject/local_settings.py")])
|
2013-11-06 17:30:20 +01:00
|
|
|
subprocess.check_call(["cp", "-rT", os.path.join(deploy_path, 'prod-static/serve'),
|
|
|
|
'/home/zulip/prod-static'])
|
2013-11-08 22:41:12 +01:00
|
|
|
|
|
|
|
print deploy_path
|
|
|
|
sys.exit(0)
|