diff --git a/servers/puppet/modules/humbug/files/nginx/humbug-include/app b/servers/puppet/modules/humbug/files/nginx/humbug-include/app index 5327767af7..80e1659548 100644 --- a/servers/puppet/modules/humbug/files/nginx/humbug-include/app +++ b/servers/puppet/modules/humbug/files/nginx/humbug-include/app @@ -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 ^()(.*)$; } diff --git a/tools/restart-server b/tools/restart-server index 72e95c56b8..51342e0b20 100755 --- a/tools/restart-server +++ b/tools/restart-server @@ -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 diff --git a/tools/update-deployment b/tools/update-deployment index 6729c7124c..b63783a921 100755 --- a/tools/update-deployment +++ b/tools/update-deployment @@ -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