Allow deploying to either production or staging.
Requires that you set up 'cloud2' as a hostname for the staging server.
This commit is contained in:
20
deploy.sh
20
deploy.sh
@@ -1,11 +1,23 @@
|
|||||||
#!/bin/bash -e
|
#!/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.
|
# Deploys the current production branch to the production machine.
|
||||||
PROJECT_NAME="blender-cloud"
|
PROJECT_NAME="blender-cloud"
|
||||||
DOCKER_NAME="blender_cloud"
|
DOCKER_NAME="blender_cloud"
|
||||||
REMOTE_ROOT="/data/git/${PROJECT_NAME}"
|
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
|
# macOS does not support readlink -f, so we use greadlink instead
|
||||||
if [[ `uname` == 'Darwin' ]]; then
|
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
|
#${SSH} -t docker exec ${DOCKER_NAME} /data/venv/bin/pip install -U -r ${REMOTE_ROOT}/requirements.txt --exists-action w
|
||||||
|
|
||||||
# RSync the world
|
# RSync the world
|
||||||
$ATTRACT_DIR/rsync_ui.sh
|
$ATTRACT_DIR/rsync_ui.sh ${DEPLOYHOST}
|
||||||
$FLAMENCO_DIR/rsync_ui.sh
|
$FLAMENCO_DIR/rsync_ui.sh ${DEPLOYHOST}
|
||||||
./rsync_ui.sh
|
./rsync_ui.sh ${DEPLOYHOST}
|
||||||
|
|
||||||
# Notify Bugsnag of this new deploy.
|
# Notify Bugsnag of this new deploy.
|
||||||
echo
|
echo
|
||||||
|
11
rsync_ui.sh
11
rsync_ui.sh
@@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
set -e # error out when one of the commands in the script errors.
|
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 <<EOT
|
PILLAR_DIR=$(python <<EOT
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os.path
|
import os.path
|
||||||
@@ -35,8 +42,8 @@ fi
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
echo "*** SYNCING ASSETS ***"
|
echo "*** SYNCING ASSETS ***"
|
||||||
rsync -avh $ASSETS root@cloud.blender.org:/data/git/pillar/pillar/web/static/assets/
|
rsync -avh $ASSETS root@${DEPLOYHOST}:/data/git/pillar/pillar/web/static/assets/
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "*** SYNCING TEMPLATES ***"
|
echo "*** SYNCING TEMPLATES ***"
|
||||||
rsync -avh $TEMPLATES root@cloud.blender.org:/data/git/pillar/pillar/web/templates/
|
rsync -avh $TEMPLATES root@${DEPLOYHOST}:/data/git/pillar/pillar/web/templates/
|
||||||
|
Reference in New Issue
Block a user