bring back up and down scripts

This commit is contained in:
Karol Wypchlo 2022-09-14 11:29:46 +02:00
parent e281e9ca78
commit 63323685cc
No known key found for this signature in database
GPG Key ID: B515DE9EEBE241E1
2 changed files with 43 additions and 0 deletions

37
scripts/portal-down.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
set -e # exit on first error
while getopts d:t:r: flag
do
case "${flag}" in
d) delay=${OPTARG};;
t) timeout=${OPTARG};;
r) reason=${OPTARG};;
esac
done
delay=${delay:-0} # default to no delay
timeout=${timeout:-300} # default timeout is 300s
if [[ -z $reason ]]; then
echo "Please provide a reason for disabling the portal (use '-r <reason>')."
exit 1
fi
countdown() {
local secs=$1
while [ $secs -gt 0 ]; do
echo -ne "Waiting $secs\033[0K\r"
sleep 1
: $((secs--))
done
}
# delay disabling the portal
countdown $delay
# stop health-check so the server is taken our of load balancer
docker exec health-check cli disable $reason
# then wait 5 minutes for the load balancer to propagate the dns records
countdown $timeout

6
scripts/portal-up.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -e # exit on first error
# start the health-checks service
docker exec health-check cli enable