#!/bin/bash

if [ $# != 3 ]; then cat << EOM

    usage: $0 DOMAIN TARGET_SPACE TARGET_APP

EOM
    exit
fi

DOMAIN=$1
TARGET_SPACE=$2
TARGET_APP=$3

cf space $TARGET_SPACE
(echo y | cf delete-route .$DOMAIN; cf map $TARGET_APP $DOMAIN) &
(echo y | cf delete-route www.$DOMAIN; cf map $TARGET_APP www $DOMAIN) &
wait

Add script to flip (www.)spring.io between spaces
Add script to flip (www.)spring.io between spaces

This script is useful when blue/green deployment within a single space
is not enough, e.g. in cases where all traffic to the database must be
stopped in order to fundamentally rebuild it (as was the case in the
previous commits).

This approach requires a few seconds of production downtime, but keeps
it to an absolute minimum, on the order of 30 seconds total.

[#57709992]
