diff --git a/scripts/portal-down.sh b/scripts/portal-down.sh index b2a9593c..0b42b53a 100755 --- a/scripts/portal-down.sh +++ b/scripts/portal-down.sh @@ -2,6 +2,16 @@ set -e # exit on first error +while getopts d:t: flag +do + case "${flag}" in + d) delay=${OPTARG};; + t) timeout=${OPTARG};; + esac +done +delay=${delay:-0} # default to no delay +timeout=${timeout:-300} # default timeout is 300s + countdown() { local secs=$1 while [ $secs -gt 0 ]; do @@ -11,8 +21,11 @@ countdown() { done } +# delay disabling the portal +countdown $delay + # stop healh-check so the server is taken our of load balancer docker exec health-check cli/disable # then wait 5 minutes for the load balancer to propagate the dns records -countdown 300 +countdown $timeout diff --git a/scripts/portal-restart.sh b/scripts/portal-restart.sh new file mode 100644 index 00000000..354bfdbf --- /dev/null +++ b/scripts/portal-restart.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e # exit on first error + +# get current working directory (pwd doesn't cut it) +cwd=$(cd -P -- "$(dirname -- "$0")" && pwd -P) + +# put the server down for maintenance +. ${cwd}/portal-down.sh + +# stop the docker services +docker-compose down + +# start the docker services +docker-compose up -d + +# enable the server again +. ${cwd}/portal-up.sh diff --git a/scripts/portal-upgrade.sh b/scripts/portal-upgrade.sh index f63335bc..da863bca 100755 --- a/scripts/portal-upgrade.sh +++ b/scripts/portal-upgrade.sh @@ -21,7 +21,7 @@ docker system prune --force docker volume rm $(docker volume ls -q) # build all container without cache -docker-compose build --no-cache +docker-compose build --no-cache --parallel --pull --quiet # start the docker services docker-compose up -d