canvas-lms/script/docker_dev_update.sh

49 lines
1010 B
Bash
Raw Normal View History

Match services docker workflow. Fixes OUT-2367 There are now two scripts: - docker_dev_setup.sh: will create / recreate the service and all databases locally - docker_dev_update.sh: can be used to migrate the local master branch. Will also pull plugin changes and run the relevant migrations. Both scripts now directly use parts of canvas_update under the hood, which will hopefully make future workflow changes less painful. Test Plan: - With docker: - optional: create a new canvas checkout (you can use a different directory name to avoid destroying your current database) - git fetch - check out this gerrit, and use `git checkout -b 2367` to create a branch for it - git checkout origin/master~200 - git checkout 2367 -- script - ./script/docker_dev_setup.sh (follow all prompts) - docker-compose up -d - login, accept the terms of use - docker-compose down - git checkout master - ./script/docker_dev_update.sh -n code - docker-compose up -d - login, verify you are not asked for terms of use and the school name is the same as before. - docker-compose down - ./script/docker_dev_setup.sh again (nuke the old database, change the root account name) - docker-compose up -d - login, accept the terms of use, verify the new account name Change-Id: Ie40600d7ea1e90633d9139b4cc1cf853695ac8f8 Reviewed-on: https://gerrit.instructure.com/151547 Tested-by: Jenkins Reviewed-by: Michael Brewer-Davis <mbd@instructure.com> Reviewed-by: Augusto Callejas <acallejas@instructure.com> QA-Review: Dariusz Dzien <ddzien@instructure.com> Product-Review: Neil Gupta <ngupta@instructure.com>
2018-05-26 03:01:25 +08:00
#!/bin/bash -e
usage () {
echo "usage: $0 [-f] [-h] [-n phase]"
}
bad_usage () {
usage
exit 1
}
while getopts ":fhn:" opt
do
case $opt in
n )
case $OPTARG in
build )
SKIP_BUILD=true;;
code )
SKIP_CODE=true;;
* )
bad_usage;;
esac
echo "Skipping $OPTARG";;
f )
FORCE=yes;;
h )
usage;;
* )
echo "Sorry, -$OPTARG is not a valid option!"
bad_usage;;
esac
done
if [[ -z "$FORCE" && "$(docker-compose ps | wc -l)" -gt 2 ]] ; then
echo "You should probably stop services before running this command"
echo "(use -f to skip this check)"
exit 1
fi
[[ -z "$SKIP_CODE" ]] && ./script/canvas_update -n data
[[ -z "$SKIP_BUILD" ]] && docker-compose build --pull
if [[ -z "$SKIP_BUILD" ]] ; then
# assets are currently compiled during dc build --pull
docker-compose run --rm web ./script/canvas_update -n code -n assets
else
docker-compose run --rm web ./script/canvas_update -n code
fi