-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeploy_pws.sh
More file actions
executable file
·67 lines (50 loc) · 1.67 KB
/
deploy_pws.sh
File metadata and controls
executable file
·67 lines (50 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# Deploys and installs the Amazon S3 broker on Cloud Foundry
# Requires a valid AWS access key with IAM and S3 privileges
root=$(cd `dirname $0` && pwd);
service_broker=s3-service-broker
rm -rf ~/.m2/repository/cnj/service-brokers/
# mvn -DskipTests=true clean install
function reset(){
cf purge-service-instance -f s3-service
cf d -f s3-sample-app
cf d -f s3-service-broker
cf ds -f s3-service
cf ds -f s3-service-broker-db
cf purge-service-instance -f ${service_broker}
cf delete-service-broker -f amazon-s3
cf delete-orphaned-routes -f
cf purge-service-offering amazon-s3 -f
}
function app_domain(){
D=`cf apps | grep $1 | tr -s ' ' | cut -d' ' -f 6 | cut -d, -f1`
echo $D
}
function deploy_service_broker_app(){
cd ${root}/s3-service-broker
cf marketplace | grep cleardb && cf create-service cleardb spark ${service_broker}-db
cf marketplace | grep p-mysql && cf create-service p-mysql 512mb ${service_broker}-db
cf push --no-start
cf set-env $service_broker AWS_ACCESS_KEY_ID ${AWS_ACCESS_KEY_ID}
cf set-env $service_broker AWS_SECRET_ACCESS_KEY ${AWS_SECRET_ACCESS_KEY}
cf start $service_broker
}
function configure_service_broker(){
uri=`app_domain ${service_broker}`
uri=http://${uri}
cf create-service-broker amazon-s3 admin admin $uri --space-scoped
cf enable-service-access $service_broker -p basic
}
function deploy_sample_app(){
cd ${root}/s3-sample
cf create-service $service_broker basic s3-service
cf push
}
function update_broker(){
cd ${root}/${service_broker}
cf push
}
reset
# deploy_service_broker_app
# configure_service_broker
# deploy_sample_app