From d590b88e3b154ef1e52d8fe7adcd7e2c453c49b7 Mon Sep 17 00:00:00 2001 From: Paul Caskey Date: Thu, 7 Jan 2021 13:07:41 -0600 Subject: [PATCH] add script to refresh instance --- Workbench/scripts/refresh-this-instance.sh | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 Workbench/scripts/refresh-this-instance.sh diff --git a/Workbench/scripts/refresh-this-instance.sh b/Workbench/scripts/refresh-this-instance.sh new file mode 100755 index 0000000..8f6447e --- /dev/null +++ b/Workbench/scripts/refresh-this-instance.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +DELETE_VOLUMES="false" + +if [[ $1 == "-dv" ]]; then + echo "will delete volumes..." + DELETE_VOLUMES="true" +fi + +function DisplayUsage() { +echo "** This script will bring down the workbench containers, " +echo "grab the latest workbench code and config from the main repo, " +echo "then restart the containers." +echo "" + echo "Usage:" + echo "$0 [-dv]" + echo "" + echo "Pass the -dv flag to also delete data volumes when refreshing this instance." + echo "" + exit 1 +} + +if [[ $1 == "--?" ]] | [[ $1 == "--help" ]]; then + DisplayUsage +fi +if [[ $# -eq 1 ]]; then + if [[ $1 != "-dv" ]]; then DisplayUsage; fi +fi + +pushd /csp-tap/InCommonTAP-Examples/Workbench +docker-compose down +if [[ $DELETE_VOLUMES == "true" ]]; then + echo "deleting volumes..." + docker volume rm $(docker volume ls -q) +fi +git pull +docker-compose up --build -d +popd