mirror of https://github.com/zulip/zulip.git
[manual] Update deployment process to run atomically.
This requires manual steps on deploy to each of staging and prod: (1) Run the new update-deployment code to setup the initial deployment directory. (2) Restart all the programs running in screen sessions. (3) Deploy the nginx changes and restart nginx. (imported from commit 1ffe27933ee79274dc0a93d35c9938712de0ef36)
This commit is contained in:
parent
f7406b9c7d
commit
1b8cf16988
|
@ -9,7 +9,7 @@ error_page 502 503 504 /static/html/5xx.html;
|
|||
|
||||
# Serve static files directly
|
||||
location /static/ {
|
||||
alias /home/humbug/humbug/prod-static/serve/;
|
||||
alias /home/humbug/humbug-deployments/current/prod-static/serve/;
|
||||
error_page 404 /static/html/404.html;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,6 @@ location ~ /json/get_updates|/api/v1/get_messages|/api/v1/messages/latest|/json/
|
|||
# Send everything else to Django via FastCGI
|
||||
location / {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/home/humbug/humbug/fastcgi-socket;
|
||||
fastcgi_pass unix:/home/humbug/humbug-deployments/current/fastcgi-socket;
|
||||
fastcgi_split_path_info ^()(.*)$;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ WARNING = '\033[93m'
|
|||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
|
||||
os.chdir("/home/humbug/humbug")
|
||||
os.chdir("/home/humbug/humbug-deployments/current")
|
||||
|
||||
# Restart the FastCGI process, which is running in a shell loop in screen.
|
||||
# TODO: real daemonization
|
||||
|
|
|
@ -6,6 +6,7 @@ import pylibmc
|
|||
import traceback
|
||||
import logging
|
||||
from humbug_tools import check_output
|
||||
import datetime
|
||||
|
||||
logging.basicConfig(format="%(asctime)s update-deployment: %(message)s",
|
||||
level=logging.INFO)
|
||||
|
@ -33,8 +34,15 @@ subprocess.check_call(["find", ".", "-name", "*.pyc", "-delete"], stdout=open('/
|
|||
logging.info("Updating static files")
|
||||
subprocess.check_call(["./tools/update-prod-static"])
|
||||
|
||||
subprocess.check_call(["mkdir", '-p', '/home/humbug/humbug-deployments'])
|
||||
timestamp = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
|
||||
deploy_path = "/home/humbug/humbug-deployments/%s" % (timestamp,)
|
||||
subprocess.check_call(["cp", '-a', '/home/humbug/humbug', deploy_path])
|
||||
subprocess.check_call(["ln", '-nsf', deploy_path, "/home/humbug/humbug-deployments/current"])
|
||||
|
||||
logging.info("Restarting server...")
|
||||
subprocess.check_call(["./tools/restart-server"])
|
||||
subprocess.check_call(["/home/humbug/humbug-deployments/current/tools/restart-server"])
|
||||
|
||||
|
||||
if newrev == '0000000000000000000000000000000000000000':
|
||||
# 0000000000000000000000000000000000000000 means we're deleting the ref
|
||||
|
|
Loading…
Reference in New Issue