diff --git a/demo_deploy.sh b/demo_deploy.sh index 1cb54d5..5a9b5f7 100755 --- a/demo_deploy.sh +++ b/demo_deploy.sh @@ -25,16 +25,24 @@ echo Home: $PLATFORM_HOME DEMO_HOME=${DEMO_HOME:-$PLATFORM_HOME/customers-stores} # TODO: clone and build +function find_jar() { + if [ -d $1 ]; then + ls $1/*.jar | egrep -v 'javadoc|sources' + else + echo $1/app.jar + fi +} + function deploy_app() { APP=$PREFIX$1 NAME=$1 [ "$1" == "stores" ] && NAME=store - JARPATH=$DEMO_HOME/rest-microservices-$NAME/target/*.jar + JARPATH=$(find_jar "$DEMO_HOME/rest-microservices-$NAME/target") [ "$1" == "customersui" ] && JARPATH=$DEMO_HOME/customers-stores-ui/app.jar - [ "$1" == "hystrix-dashboard" -o "$1" == "turbine" ] && JARPATH=$PLATFORM_HOME/$NAME/target/*.jar + [ "$1" == "hystrix-dashboard" -o "$1" == "turbine" ] && JARPATH=$(find_jar "$PLATFORM_HOME/$NAME/target") - if [ ! -f $JARPATH ]; then + if ! [ -f "$JARPATH" ]; then echo "No jar for deployment of $1 at: $JARPATH" exit 0 fi diff --git a/services_deploy.sh b/services_deploy.sh index b11067c..16d9b84 100755 --- a/services_deploy.sh +++ b/services_deploy.sh @@ -1,4 +1,5 @@ #!/bin/bash + set -e DOMAIN=${DOMAIN:-run.pivotal.io} @@ -27,12 +28,21 @@ CONFIG_HOME=${CONFIG_HOME:-$PLATFORM_HOME/configserver} EUREKA_HOME=${EUREKA_HOME:-$PLATFORM_HOME/eureka} +function find_jar() { + if [ -d $1 ]; then + ls $1/*.jar | egrep -v 'javadoc|sources' + else + echo $1/app.jar + fi +} + function deploy() { APP=$PREFIX$1 APP_HOME=$2 - cf push $APP -m 512m -p $APP_HOME/target/*.jar --no-start + JARPATH=$(find_jar "$APP_HOME/target") + cf push $APP -m 512m -p "$JARPATH" --no-start cf env $APP | grep SPRING_PROFILES_ACTIVE || cf set-env $APP SPRING_PROFILES_ACTIVE cloud cf env $APP | grep ENCRYPT_KEY || cf set-env $APP ENCRYPT_KEY deadbeef if [ "$PREFIX" != "" ]; then