-
Notifications
You must be signed in to change notification settings - Fork 9
/
deploy-cloudgov.sh
executable file
·59 lines (53 loc) · 1.65 KB
/
deploy-cloudgov.sh
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
#!/bin/sh
#
# This script will attempt to create the services required
# and then launch everything.
#
# function to check if a service exists
service_exists()
{
cf service "$1" >/dev/null 2>&1
}
if [ "$1" = "setup" ] ; then echo
# create services (if needed)
if service_exists "scanner-storage" ; then
echo scanner-storage already created
else
if [ "$2" = "prod" ] ; then
cf create-service s3 basic-public scanner-storage
else
cf create-service s3 basic-public-sandbox scanner-storage
fi
fi
if service_exists "scanner-ui-deployer" ; then
echo scanner-ui-deployer already created
else
cf create-service cloud-gov-service-account space-deployer scanner-ui
cf create-service-key scanner-ui deployer
echo "to get the CF_USERNAME and CF_PASSWORD, execute 'cf service-key scanner-ui deployer'"
fi
if service_exists "scanner-es" ; then
echo scanner-es already created
else
cf create-service elasticsearch56 medium-ha scanner-es
echo sleeping until ES is awake
for i in 1 2 3 ; do
sleep 60
echo $i minutes...
done
fi
fi
# launch the app
if [ "$1" = "zdt" ] ; then
# Do a zero downtime deploy. This requires enough memory for
# two scanner-ui apps to exist in the org/space at one time.
cf v3-zdt-push scanner-ui -b https://github.com/cloudfoundry/apt-buildpack -b nodejs_buildpack -b python_buildpack || exit 1
else
cf push scanner-ui -b https://github.com/cloudfoundry/apt-buildpack -b nodejs_buildpack -b python_buildpack || exit 1
fi
# tell people where to go
ROUTE="$(cf apps | grep scanner-ui | awk '{print $6}')"
echo
echo
echo "to log into the site, you will want to go to https://${ROUTE}/"
echo 'Have fun!'