Last active
May 16, 2018 20:14
-
-
Save ryanjbaxter/9ec2dd5de1b1279338bf to your computer and use it in GitHub Desktop.
Revisions
-
ryanjbaxter revised this gist
Jun 1, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,8 +76,8 @@ else fi echo "Pushing application" cf push ${APP_NAME} ${CF_PUSH_ARGS} --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Jun 1, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,7 +76,7 @@ else fi echo "Pushing application" echo "app name ${CF_APP}" cf push "${APP_NAME}" "${CF_PUSH_ARGS}" --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Jun 1, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,7 +76,7 @@ else fi echo "Pushing application" echo "app name ${APP_NAME}" cf push "${APP_NAME}" "${CF_PUSH_ARGS}" --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Jun 1, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,8 +76,8 @@ else fi echo "Pushing application" echo app name "${APP_NAME}" cf push "${APP_NAME}" "${CF_PUSH_ARGS}" --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Jun 1, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,8 +76,8 @@ else fi echo "Pushing application" echo app name "{$APP_NAME}" cf push "{$APP_NAME}" "{$CF_PUSH_ARGS}" --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Jun 1, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,7 +77,7 @@ fi echo "Pushing application" cf push "$APP_NAME" "$CF_PUSH_ARGS" --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Apr 15, 2015 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,6 +47,21 @@ # take the form host1:domain1,host2:domain2,domain3 # # 5. CF_PUSH_ARGS - a string of arguments to use when calling `cf push # # For example, pushing a specific artifact or setting the memory. # # # # # # To use this script in IBM DevOps Services paste the following Bash script in # # your Deploy stage. # # # # #!/bin/bash # # git clone https://gist.github.com/9ec2dd5de1b1279338bf.git deploy # # /bin/bash deploy/bluegreen.sh # # RESULT=$? # # # # if [ $RESULT -ne 0 ]; then # # echo -e "${red}Executed failed or had warnings ${no_color}" # # exit $RESULT # # fi # # echo -e "${green}Execution complete${no_label}" # # ****************************************************************************** -
ryanjbaxter revised this gist
Apr 14, 2015 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,6 +45,8 @@ # should take the form servicename1,servicename2 # # 4. ROUTES - Routes that should be mapped to the app. The value should # # take the form host1:domain1,host2:domain2,domain3 # # 5. CF_PUSH_ARGS - a string of arguments to use when calling `cf push # # For example, pushing a specific artifact or setting the memory. # # ****************************************************************************** @@ -60,7 +62,7 @@ fi echo "Pushing application" cf push $APP_NAME $CF_PUSH_ARGS --no-start echo "Done pushing application" -
ryanjbaxter revised this gist
Apr 14, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -62,7 +62,7 @@ echo "Pushing application" cf push $APP_NAME -p ${CF_APP}.war -m 512M --no-start echo "Done pushing application" echo "Setting environment variables" -
ryanjbaxter revised this gist
Apr 14, 2015 . 1 changed file with 11 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ else export APP_NAME="${CF_APP}" fi echo "Pushing application" cf push $APP_NAME -p ${CF_APP}.war -m 512M --no-start @@ -75,20 +75,16 @@ done echo "Mapping routes in order to balance traffic between two instances" IFS=',' read -a routesarray <<< "$ROUTES" for element in "${routesarray[@]}" do if [[ $element == *":"* ]]; then IFS=':' read -a route <<< "$element" cf map-route $APP_NAME ${route[1]} -n ${route[0]} else cf map-route $APP_NAME $element fi done echo "Done mapping routes" -
ryanjbaxter revised this gist
Apr 10, 2015 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ #!/bin/bash # # This product includes software originally developed by IBM Corporation. # # # Copyright IBM Corp. 2015 # -
ryanjbaxter revised this gist
Apr 9, 2015 . 1 changed file with 41 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,32 +1,49 @@ #!/bin/bash # # Copyright IBM Corp. 2015 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # **********************************USAGE*************************************** # This script will will do a blue/green deployment of an app to Cloud Foundry. # # It assumes you are already logged in, if not make sure you run `cf login` # # before executing this script. # # # # This scrip can do the following things # # 1. Push the application # # 2. Bind Services # # 3. Set Environment Variables # # 4. Map Routes # # 5. Start the application # # # # If a version of the application already exists in the org and space being # # deployed to this script will deploy the new application under the name # # <appName>-new. The routes mapped to the existing application will be mapped # # to the new version. Then the old version of the application will be deleted # # and the new version will be renamed to <appName>. # # # # The scripts depends on a couple of environment variables being set. # # 1. CF_APP - This environment variable is set by default in IBM DevOPs # # Services # # 2. ENV_VARS - Environment variables to be set. The value should take the # # form NAME1:value1,NAME2:value2 # # 3. SERVICES - Services that should be bound to the application. The value # # should take the form servicename1,servicename2 # # 4. ROUTES - Routes that should be mapped to the app. The value should # # take the form host1:domain1,host2:domain2,domain3 # # ****************************************************************************** COMMAND="cf apps | grep -w --quiet ${CF_APP}" -
ryanjbaxter revised this gist
Apr 9, 2015 . 1 changed file with 13 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,7 +56,7 @@ done echo "Mapping routes in order to balance traffic between two instances" #if $EXISTS; then IFS=',' read -a routesarray <<< "$ROUTES" for element in "${routesarray[@]}" do @@ -67,9 +67,9 @@ if $EXISTS; then cf map-route $APP_NAME $element fi done #else # echo "App did not pre-exist, no need to map route." #fi echo "Done mapping routes" @@ -89,17 +89,17 @@ cf start $APP_NAME echo "Done starting application" echo "Cleaning up old application" if $EXISTS; then cf delete -f ${CF_APP} cf unmap-route $APP_NAME mybluemix.net -n $APP_NAME cf rename $APP_NAME ${CF_APP} else echo "No cleanup needed, app did not exist" fi echo "Done cleaning up the old application" # view logs #cf logs "${CF_APP}" --recent -
ryanjbaxter revised this gist
Apr 9, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,7 +60,7 @@ if $EXISTS; then IFS=',' read -a routesarray <<< "$ROUTES" for element in "${routesarray[@]}" do if [[ $element == *":"* ]]; then IFS=':' read -a route <<< "$element" cf map-route $APP_NAME ${route[1]} -n ${route[0]} else -
ryanjbaxter revised this gist
Apr 9, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,11 +60,12 @@ if $EXISTS; then IFS=',' read -a routesarray <<< "$ROUTES" for element in "${routesarray[@]}" do if [[ $element == *":"* ]] then IFS=':' read -a route <<< "$element" cf map-route $APP_NAME ${route[1]} -n ${route[0]} else cf map-route $APP_NAME $element fi done else echo "App did not pre-exist, no need to map route." -
ryanjbaxter revised this gist
Apr 9, 2015 . 1 changed file with 48 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,34 @@ #!/bin/bash # **********************************USAGE************************************** # This script will will do a blue/green deployment of an app to Cloud Foundry. # It assumes you are already logged in, if not make sure you run `cf login` # before executing this script. # # This scrip can do the following things # 1. Push the application # 2. Bind Services # 3. Set Environment Variables # 4. Map Routes # 5. Start the application # # If a version of the application already exists in the org and space being # deployed to this script will deploy the new application under the name # <appName>-new. The routes mapped to the existing application will be mapped # to the new version. Then the old version of the application will be deleted # and the new version will be renamed to <appName>. # # The scripts depends on a couple of environment variables being set. # 1. CF_APP - This environment variable is set by default in IBM DevOPs Services # 2. ENV_VARS - Environment variables to be set. The value should take the form # NAME1:value1,NAME2:value2 # 3. SERVICES - Services that should be bound to the application. The value # should take the form servicename1,servicename2 # 4. ROUTES - Routes that should be mapped to the app. The value should # take the form host1:domain1,host2:domain2,domain3 # ***************************************************************************** COMMAND="cf apps | grep -w --quiet ${CF_APP}" if eval $COMMAND; then @@ -27,7 +57,15 @@ done echo "Mapping routes in order to balance traffic between two instances" if $EXISTS; then IFS=',' read -a routesarray <<< "$ROUTES" for element in "${routesarray[@]}" do if [[ $element == *":"* ]] IFS=':' read -a route <<< "$element" cf map-route $APP_NAME ${route[1]} -n ${route[0]} else cf map-route $APP_NAME $element done else echo "App did not pre-exist, no need to map route." fi @@ -50,17 +88,17 @@ cf start $APP_NAME echo "Done starting application" #echo "Cleaning up old application" #if $EXISTS; then # cf delete -f ${CF_APP} # cf unmap-route $APP_NAME mybluemix.net -n $APP_NAME # cf rename $APP_NAME ${CF_APP} #else # echo "No cleanup needed, app did not exist" #fi #echo "Done cleaning up the old application" # view logs #cf logs "${CF_APP}" --recent -
ryanjbaxter revised this gist
Apr 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ else export APP_NAME="${CF_APP}" fi echo "Pushing application war" cf push $APP_NAME -p ${CF_APP}.war -m 512M --no-start -
ryanjbaxter revised this gist
Apr 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ else export APP_NAME="${CF_APP}" fi echo "${green}Pushing application war${no_color}" cf push $APP_NAME -p ${CF_APP}.war -m 512M --no-start -
ryanjbaxter revised this gist
Apr 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ else export APP_NAME="${CF_APP}" fi echo "${label_color}Pushing application war${no_color}" cf push $APP_NAME -p ${CF_APP}.war -m 512M --no-start -
ryanjbaxter revised this gist
Apr 7, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,9 +53,9 @@ echo "Done starting application" echo "Cleaning up old application" if $EXISTS; then cf delete -f ${CF_APP} cf unmap-route $APP_NAME mybluemix.net -n $APP_NAME cf rename $APP_NAME ${CF_APP} else echo "No cleanup needed, app did not exist" fi -
ryanjbaxter revised this gist
Apr 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ fi echo "Pushing application war" cf push $APP_NAME -p ${CF_APP}.war -m 512M --no-start echo "Done pushing application war" -
ryanjbaxter revised this gist
Apr 7, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ #!/bin/bash COMMAND="cf apps | grep -w --quiet ${CF_APP}" if eval $COMMAND; then export EXISTS=true export APP_NAME="${CF_APP}-new" else export EXISTS=false export APP_NAME="${CF_APP}" fi echo "Pushing application war" -
ryanjbaxter renamed this gist
Apr 7, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ryanjbaxter created this gist
Apr 7, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ #!/bin/bash COMMAND="cf apps | grep -w --quiet $APP_NAME_PREFIX" if eval $COMMAND; then export EXISTS=true export APP_NAME="$APP_NAME_PREFIX-new" else export EXISTS=false export APP_NAME="$APP_NAME_PREFIX" fi echo "Pushing application war" cf push $APP_NAME -p $APP_NAME_PREFIX.war -m 512M --no-start echo "Done pushing application war" echo "Setting environment variables" IFS=',' read -a envvarsarray <<< "$ENV_VARS" for element in "${envvarsarray[@]}" do IFS=':' read -a envvar <<< "$element" cf set-env $APP_NAME ${envvar[0]} ${envvar[1]} done echo "Mapping routes in order to balance traffic between two instances" if $EXISTS; then cf map-route $APP_NAME mybluemix.net -n $HOST else echo "App did not pre-exist, no need to map route." fi echo "Done mapping routes" echo "Binding services" IFS=',' read -a servicesarray <<< "$SERVICES" for element in "${servicesarray[@]}" do cf bind-service $APP_NAME $element done echo "Done mapping services" echo "Starting application" cf start $APP_NAME echo "Done starting application" echo "Cleaning up old application" if $EXISTS; then cf delete -f $APP_NAME_PREFIX cf unmap-route $APP_NAME mybluemix.net -n $APP_NAME cf rename $APP_NAME $APP_NAME_PREFIX else echo "No cleanup needed, app did not exist" fi echo "Done cleaning up the old application" # view logs #cf logs "${CF_APP}" --recent