From 727707e611426312b52cd69a6c94e0d10252af32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 10 Mar 2017 09:55:04 +0100 Subject: [PATCH] Allow deploying to either production or staging. Requires that you set up 'cloud2' as a hostname for the staging server. --- deploy.sh | 20 ++++++++++++++++---- rsync_ui.sh | 11 +++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index 8f5758f..efa8200 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,11 +1,23 @@ #!/bin/bash -e +case $1 in + production) + DEPLOYHOST="cloud.blender.org" + ;; + staging) + DEPLOYHOST="cloud2" + ;; + *) + echo "Use $0 cloud|staging" >&2 + exit 1 +esac + # Deploys the current production branch to the production machine. PROJECT_NAME="blender-cloud" DOCKER_NAME="blender_cloud" REMOTE_ROOT="/data/git/${PROJECT_NAME}" -SSH="ssh -o ClearAllForwardings=yes cloud.blender.org" +SSH="ssh -o ClearAllForwardings=yes ${DEPLOYHOST}" # macOS does not support readlink -f, so we use greadlink instead if [[ `uname` == 'Darwin' ]]; then @@ -91,9 +103,9 @@ git_pull blender-cloud production #${SSH} -t docker exec ${DOCKER_NAME} /data/venv/bin/pip install -U -r ${REMOTE_ROOT}/requirements.txt --exists-action w # RSync the world -$ATTRACT_DIR/rsync_ui.sh -$FLAMENCO_DIR/rsync_ui.sh -./rsync_ui.sh +$ATTRACT_DIR/rsync_ui.sh ${DEPLOYHOST} +$FLAMENCO_DIR/rsync_ui.sh ${DEPLOYHOST} +./rsync_ui.sh ${DEPLOYHOST} # Notify Bugsnag of this new deploy. echo diff --git a/rsync_ui.sh b/rsync_ui.sh index 50c0cd5..2c4aed1 100755 --- a/rsync_ui.sh +++ b/rsync_ui.sh @@ -2,6 +2,13 @@ set -e # error out when one of the commands in the script errors. +if [ -z "$1" ]; then + echo "Usage: $0 {host-to-deploy-to}" >&2 + exit 1 +fi + +DEPLOYHOST="$1" + PILLAR_DIR=$(python <