mirror of https://github.com/zulip/zulip.git
[manual] Move our deployment scripts to scripts/.
This will require updating the post-receive code on git.zulip.net to work. (imported from commit 2e51fa2d7b891c1138d3f22ae534cfb8a6cf174c)
This commit is contained in:
parent
1a448c256e
commit
56e9ad230e
|
@ -1,8 +1,11 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
|
||||||
from zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT
|
from zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT
|
||||||
|
|
||||||
logging.basicConfig(format="%(asctime)s purge-deployments: %(message)s",
|
logging.basicConfig(format="%(asctime)s purge-deployments: %(message)s",
|
|
@ -5,6 +5,8 @@ import pwd
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
|
||||||
from zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR
|
from zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR
|
||||||
|
|
||||||
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
|
@ -3,11 +3,13 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT, FAIL, WARNING, ENDC
|
|
||||||
import datetime
|
import datetime
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
|
||||||
|
from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT, FAIL, WARNING, ENDC
|
||||||
|
|
||||||
logging.basicConfig(format="%(asctime)s update-deployment: %(message)s",
|
logging.basicConfig(format="%(asctime)s update-deployment: %(message)s",
|
||||||
level=logging.INFO)
|
level=logging.INFO)
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ while time.time() - start_time < 300:
|
||||||
|
|
||||||
if not got_lock:
|
if not got_lock:
|
||||||
print FAIL + "Deployment already in progress. Please run\n" \
|
print FAIL + "Deployment already in progress. Please run\n" \
|
||||||
+ " %s/current/tools/update-deployment %s\n" % (DEPLOYMENTS_DIR, refname) \
|
+ " %s/current/scripts/update-deployment %s\n" % (DEPLOYMENTS_DIR, refname) \
|
||||||
+ "manually when the current deployment finishes." + ENDC
|
+ "manually when the current deployment finishes." + ENDC
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
@ -52,13 +54,13 @@ subprocess.check_call(["find", ".", "-name", "*.pyc", "-delete"], stdout=open('/
|
||||||
|
|
||||||
# Update static files
|
# Update static files
|
||||||
logging.info("Updating static files")
|
logging.info("Updating static files")
|
||||||
subprocess.check_call(["./tools/update-prod-static", "--prev-deploy",
|
subprocess.check_call(["./scripts/update-prod-static", "--prev-deploy",
|
||||||
os.path.join(DEPLOYMENTS_DIR, 'current')])
|
os.path.join(DEPLOYMENTS_DIR, 'current')])
|
||||||
|
|
||||||
logging.info("Restarting server...")
|
logging.info("Restarting server...")
|
||||||
subprocess.check_call(["./tools/restart-server"])
|
subprocess.check_call(["./scripts/restart-server"])
|
||||||
|
|
||||||
logging.info("Deployment complete")
|
logging.info("Deployment complete")
|
||||||
shutil.rmtree(LOCK_DIR)
|
shutil.rmtree(LOCK_DIR)
|
||||||
|
|
||||||
subprocess.check_call(["./tools/purge-deployments"])
|
subprocess.check_call(["./scripts/purge-deployments"])
|
|
@ -34,7 +34,7 @@ from zulip_tools import check_output, ENDC, FAIL
|
||||||
|
|
||||||
def update_deployment(server, refname):
|
def update_deployment(server, refname):
|
||||||
return subprocess.call(["ssh", "-l", "zulip", server, "--", "env", "-u", "GIT_DIR",
|
return subprocess.call(["ssh", "-l", "zulip", server, "--", "env", "-u", "GIT_DIR",
|
||||||
"/home/zulip/deployments/current/tools/update-deployment", refname])
|
"/home/zulip/deployments/current/scripts/update-deployment", refname])
|
||||||
|
|
||||||
def send_deployment_finished_message(branch, message):
|
def send_deployment_finished_message(branch, message):
|
||||||
subprocess.check_call(["/home/zulip/zulip/api/bin/zulip-send", "--user=commit-bot@zulip.com",
|
subprocess.check_call(["/home/zulip/zulip/api/bin/zulip-send", "--user=commit-bot@zulip.com",
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ExcludeUnminifiedMixin(object):
|
||||||
|
|
||||||
# source-map/ should also not be included.
|
# source-map/ should also not be included.
|
||||||
# However, we work around that by moving it later,
|
# However, we work around that by moving it later,
|
||||||
# in tools/update-prod-static.
|
# in update-prod-static.
|
||||||
|
|
||||||
super_class = super(ExcludeUnminifiedMixin, self)
|
super_class = super(ExcludeUnminifiedMixin, self)
|
||||||
for path, storage in super_class.list(ignore_patterns):
|
for path, storage in super_class.list(ignore_patterns):
|
||||||
|
|
|
@ -283,7 +283,7 @@ STATIC_HEADER_FILE = 'zerver/static_header.txt'
|
||||||
# To use minified files in dev, set PIPELINE = True. For the full
|
# To use minified files in dev, set PIPELINE = True. For the full
|
||||||
# cache-busting behavior, you must also set DEBUG = False.
|
# cache-busting behavior, you must also set DEBUG = False.
|
||||||
#
|
#
|
||||||
# You will need to run ./tools/update-prod-static after changing
|
# You will need to run update-prod-static after changing
|
||||||
# static files.
|
# static files.
|
||||||
|
|
||||||
PIPELINE_CSS = {
|
PIPELINE_CSS = {
|
||||||
|
|
Loading…
Reference in New Issue