@@ -12,6 +12,23 @@ function exit_if_error(){
1212 fi
1313}
1414
15+ function create_kibana_if_not_exists_and_bind_to_logstash(){
16+ cf app $1
17+ # Check the status of the previous command
18+ if [ $? -ne 0 ]; then
19+ status " $1 not found. Creating new Kibana app"
20+ git clone https://github.com/cloudfoundry-community/kibana-me-logs.git
21+ cd kibana-me-logs
22+ cf push $1 --no-start --random-route -b https://github.com/heroku/heroku-buildpack-go.git
23+ exit_if_error $? " Could not push $1 instance"
24+ cf bind-service $1 $2
25+ exit_if_error $? " Could not create bind $1 to $2 "
26+ cf start $1
27+ exit_if_error $? " Could not start $1 instance"
28+ cd ..
29+ fi
30+ }
31+
1532function create_service_if_not_exists(){
1633 cf service $3
1734 # Check the status of the previous command
@@ -35,8 +52,9 @@ function create_secure_service_if_not_exists(){
3552function create_services(){
3653 create_service_if_not_exists $REDIS $REDIS_PLAN " predix_seed_session_store"
3754 create_secure_service_if_not_exists $VIEWSERVICE $VIEWSERVICE_PLAN " predix_seed_view_service"
38- create_service_if_not_exists $LOGSTASH $LOGSTASH_PLAN " predix_seed_logstash"
3955 create_service_if_not_exists $NEWRELIC $NEWRELIC_PLAN " predix_seed_new_relic"
56+ create_service_if_not_exists $LOGSTASH $LOGSTASH_PLAN " predix_seed_logstash"
57+ create_kibana_if_not_exists_and_bind_to_logstash $KIBANA_APP " predix_seed_logstash"
4058}
4159
4260function push_app_to_cf(){
@@ -141,7 +159,7 @@ function cleanup(){
141159}
142160
143161function get_args(){
144- while getopts " f:s:b:d:i:t:n:" opt; do
162+ while getopts " f:s:b:d:i:t:n:k: " opt; do
145163 case $opt in
146164 h)
147165 show_help
@@ -168,6 +186,9 @@ function get_args(){
168186 n)
169187 NEW_RELIC_APP_NAME=$OPTARG
170188 ;;
189+ k)
190+ KIBANA_APP=$OPTARG
191+ ;;
171192 \? )
172193 echo " Invalid option -$OPTARG "
173194 show_help
0 commit comments