Renamed docker/4_run/deploy
to docker/4_run/staging
"Staging" covers the meaning of what is actually happening better than "deploy". I want to keep "deploy" for actually deploying onto a production server.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,6 +21,7 @@ node_modules/
|
|||||||
/docker/2_buildpy/python/
|
/docker/2_buildpy/python/
|
||||||
/docker/4_run/wheelhouse/
|
/docker/4_run/wheelhouse/
|
||||||
/docker/4_run/deploy/
|
/docker/4_run/deploy/
|
||||||
|
/docker/4_run/staging/
|
||||||
/celerybeat-schedule.bak
|
/celerybeat-schedule.bak
|
||||||
/celerybeat-schedule.dat
|
/celerybeat-schedule.dat
|
||||||
/celerybeat-schedule.dir
|
/celerybeat-schedule.dir
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
DEPLOY_BRANCH=${DEPLOY_BRANCH:-production}
|
STAGING_BRANCH=${STAGING_BRANCH:-production}
|
||||||
|
|
||||||
# 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
|
||||||
@@ -11,34 +11,34 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")"
|
ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")"
|
||||||
DEPLOYDIR="$ROOT/docker/4_run/deploy"
|
STAGINGDIR="$ROOT/docker/4_run/staging"
|
||||||
PROJECT_NAME="$(basename $ROOT)"
|
PROJECT_NAME="$(basename $ROOT)"
|
||||||
|
|
||||||
if [ -e $DEPLOYDIR ]; then
|
if [ -e $STAGINGDIR ]; then
|
||||||
echo "$DEPLOYDIR already exists, press [ENTER] to DESTROY AND DEPLOY, Ctrl+C to abort."
|
echo "$STAGINGDIR already exists, press [ENTER] to destroy and re-install, Ctrl+C to abort."
|
||||||
read dummy
|
read dummy
|
||||||
rm -rf $DEPLOYDIR
|
rm -rf $STAGINGDIR
|
||||||
else
|
else
|
||||||
echo -n "Deploying to $DEPLOYDIR… "
|
echo -n "Installing into $STAGINGDIR… "
|
||||||
echo "press [ENTER] to continue, Ctrl+C to abort."
|
echo "press [ENTER] to continue, Ctrl+C to abort."
|
||||||
read dummy
|
read dummy
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${ROOT}
|
cd ${ROOT}
|
||||||
mkdir -p $DEPLOYDIR
|
mkdir -p $STAGINGDIR
|
||||||
REMOTE_ROOT="$DEPLOYDIR/$PROJECT_NAME"
|
REMOTE_ROOT="$STAGINGDIR/$PROJECT_NAME"
|
||||||
|
|
||||||
if [ -z "$SKIP_BRANCH_CHECK" ]; then
|
if [ -z "$SKIP_BRANCH_CHECK" ]; then
|
||||||
# Check that we're on production branch.
|
# Check that we're on production branch.
|
||||||
if [ $(git rev-parse --abbrev-ref HEAD) != "$DEPLOY_BRANCH" ]; then
|
if [ $(git rev-parse --abbrev-ref HEAD) != "$STAGING_BRANCH" ]; then
|
||||||
echo "You are NOT on the $DEPLOY_BRANCH branch, refusing to deploy." >&2
|
echo "You are NOT on the $STAGING_BRANCH branch, refusing to stage." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that production branch has been pushed.
|
# Check that production branch has been pushed.
|
||||||
if [ -n "$(git log origin/$DEPLOY_BRANCH..$DEPLOY_BRANCH --oneline)" ]; then
|
if [ -n "$(git log origin/$STAGING_BRANCH..$STAGING_BRANCH --oneline)" ]; then
|
||||||
echo "WARNING: not all changes to the $DEPLOY_BRANCH branch have been pushed."
|
echo "WARNING: not all changes to the $STAGING_BRANCH branch have been pushed."
|
||||||
echo "Press [ENTER] to continue deploying current origin/$DEPLOY_BRANCH, CTRL+C to abort."
|
echo "Press [ENTER] to continue staging current origin/$STAGING_BRANCH, CTRL+C to abort."
|
||||||
read dummy
|
read dummy
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -88,15 +88,15 @@ function git_clone() {
|
|||||||
echo "==================================================================="
|
echo "==================================================================="
|
||||||
echo "CLONING REPO ON $PROJECT_NAME @$BRANCH"
|
echo "CLONING REPO ON $PROJECT_NAME @$BRANCH"
|
||||||
URL=$(git -C $LOCAL_ROOT remote get-url origin)
|
URL=$(git -C $LOCAL_ROOT remote get-url origin)
|
||||||
git -C $DEPLOYDIR clone --depth 1 --branch $BRANCH $URL $PROJECT_NAME
|
git -C $STAGINGDIR clone --depth 1 --branch $BRANCH $URL $PROJECT_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
git_clone pillar-python-sdk master $SDK_DIR
|
git_clone pillar-python-sdk master $SDK_DIR
|
||||||
git_clone pillar $DEPLOY_BRANCH $PILLAR_DIR
|
git_clone pillar $STAGING_BRANCH $PILLAR_DIR
|
||||||
git_clone attract $DEPLOY_BRANCH $ATTRACT_DIR
|
git_clone attract $STAGING_BRANCH $ATTRACT_DIR
|
||||||
git_clone flamenco $DEPLOY_BRANCH $FLAMENCO_DIR
|
git_clone flamenco $STAGING_BRANCH $FLAMENCO_DIR
|
||||||
git_clone pillar-svnman $DEPLOY_BRANCH $SVNMAN_DIR
|
git_clone pillar-svnman $STAGING_BRANCH $SVNMAN_DIR
|
||||||
git_clone blender-cloud $DEPLOY_BRANCH $ROOT
|
git_clone blender-cloud $STAGING_BRANCH $ROOT
|
||||||
|
|
||||||
# Gulp everywhere
|
# Gulp everywhere
|
||||||
GULP=$ROOT/node_modules/.bin/gulp
|
GULP=$ROOT/node_modules/.bin/gulp
|
||||||
@@ -105,25 +105,23 @@ if [ ! -e $GULP -o gulpfile.js -nt $GULP ]; then
|
|||||||
touch $GULP # installer doesn't always touch this after a build, so we do.
|
touch $GULP # installer doesn't always touch this after a build, so we do.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# List of projects
|
# List of projects
|
||||||
declare -a proj=("pillar" "attract" "flamenco" "pillar-svnman" "blender-cloud")
|
declare -a proj=("pillar" "attract" "flamenco" "pillar-svnman" "blender-cloud")
|
||||||
|
|
||||||
# Run ./gulp for every project
|
# Run ./gulp for every project
|
||||||
for i in "${proj[@]}"
|
for i in "${proj[@]}"
|
||||||
do
|
do
|
||||||
pushd $DEPLOYDIR/$i; ./gulp --production; popd;
|
pushd $STAGINGDIR/$i; ./gulp --production; popd;
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove node_modules (only after all projects with interdependencies have been built)
|
# Remove node_modules (only after all projects with interdependencies have been built)
|
||||||
for i in "${proj[@]}"
|
for i in "${proj[@]}"
|
||||||
do
|
do
|
||||||
pushd $DEPLOYDIR/$i; rm -r node_modules; popd;
|
pushd $STAGINGDIR/$i; rm -r node_modules; popd;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "==================================================================="
|
echo "==================================================================="
|
||||||
echo "Deploy of ${PROJECT_NAME} is ready for dockerisation."
|
echo "Staging of ${PROJECT_NAME} is ready for dockerisation."
|
||||||
echo "==================================================================="
|
echo "==================================================================="
|
||||||
|
@@ -9,7 +9,6 @@ else
|
|||||||
fi
|
fi
|
||||||
ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")"
|
ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")"
|
||||||
PROJECT_NAME="$(basename $ROOT)"
|
PROJECT_NAME="$(basename $ROOT)"
|
||||||
DOCKER_DEPLOYDIR="$ROOT/docker/4_run/deploy"
|
|
||||||
DOCKER_IMAGE="armadillica/blender_cloud:latest"
|
DOCKER_IMAGE="armadillica/blender_cloud:latest"
|
||||||
REMOTE_SECRET_CONFIG_DIR="/data/config"
|
REMOTE_SECRET_CONFIG_DIR="/data/config"
|
||||||
REMOTE_DOCKER_COMPOSE_DIR="/root/docker"
|
REMOTE_DOCKER_COMPOSE_DIR="/root/docker"
|
||||||
|
@@ -8,7 +8,6 @@ else
|
|||||||
readlink='readlink'
|
readlink='readlink'
|
||||||
fi
|
fi
|
||||||
ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")"
|
ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")"
|
||||||
DOCKERDIR="$ROOT/docker/4_run"
|
|
||||||
|
|
||||||
case "$(basename "$0")" in
|
case "$(basename "$0")" in
|
||||||
build-quick.sh)
|
build-quick.sh)
|
||||||
@@ -31,4 +30,3 @@ read dummy
|
|||||||
docker push armadillica/blender_cloud:latest
|
docker push armadillica/blender_cloud:latest
|
||||||
echo
|
echo
|
||||||
echo "Build is done, ready to update the server."
|
echo "Build is done, ready to update the server."
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ ENTRYPOINT /docker-entrypoint.sh
|
|||||||
|
|
||||||
# Add the most-changing files as last step for faster rebuilds.
|
# Add the most-changing files as last step for faster rebuilds.
|
||||||
ADD config_local.py /data/git/blender-cloud/
|
ADD config_local.py /data/git/blender-cloud/
|
||||||
ADD deploy /data/git
|
ADD staging /data/git
|
||||||
RUN python3 -c "import re, secrets; \
|
RUN python3 -c "import re, secrets; \
|
||||||
f = open('/data/git/blender-cloud/config_local.py', 'a'); \
|
f = open('/data/git/blender-cloud/config_local.py', 'a'); \
|
||||||
h = re.sub(r'[_.~-]', '', secrets.token_urlsafe())[:8]; \
|
h = re.sub(r'[_.~-]', '', secrets.token_urlsafe())[:8]; \
|
||||||
|
Reference in New Issue
Block a user