Skip to content

Instantly share code, notes, and snippets.

@robert-bryson
Last active March 31, 2022 16:49
Show Gist options
  • Save robert-bryson/34ef80a8b5aff4eb75318cfcd4f44e24 to your computer and use it in GitHub Desktop.
Save robert-bryson/34ef80a8b5aff4eb75318cfcd4f44e24 to your computer and use it in GitHub Desktop.
Quick and dirty scripts for https://github.com/gsa/data.gov/issues/3755
#!/bin/bash
set -e
set -o pipefail
set -o xtrace
replace_hostname () {
local replace="-$1"
sed -i "s/((hostname)).*.apps/((hostname))$replace.apps/" manifest.yml
}
main () {
declare apps=(catalog-gather catalog-harvest dashboard)
declare SPACE="staging"
declare EGRESS_SPACE="$SPACE-egress"
replace_hostname "$SPACE"
for app in ${apps[@]}; do
local egress_app="$app-egress"
cf target -s "$EGRESS_SPACE"
if ! cf app "$egress_app" > /dev/null; then
cf push --vars-file vars."$egress_app".yml
fi
bin/cf-deployproxy "$egress_app" "$EGRESS_SPACE"
cf target -s "$SPACE"
cf add-network-policy "$app" "$egress_app" -s "$EGRESS_SPACE"
done
replace_hostname ""
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment