-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.mysql.sh
executable file
·32 lines (26 loc) · 1.13 KB
/
deploy.mysql.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
#!/usr/bin/env bash
# Script assumes MySQL (https://network.pivotal.io/products/pivotal-mysql/) is available as service in cf marketplace
# Feel free to swap out the service for other MySQL providers, like:
# * Meta Azure Service Broker - https://github.com/Azure/meta-azure-service-broker/blob/master/docs/azure-mysql-db.md
# * AWS Service Broker - http://docs.pivotal.io/aws-services/creating.html#rds
set -e
export APP_NAME=cf-archivist
cf push --no-start
if ! cf service $APP_NAME-secrets > /dev/null; then
cf create-service credhub default $APP_NAME-secrets -c config/secrets.json
while [[ $(cf service $APP_NAME-secrets) != *"succeeded"* ]]; do
echo "$APP_NAME-secrets is not ready yet..."
sleep 5
done
fi
cf bind-service $APP_NAME $APP_NAME-secrets
if ! cf service $APP_NAME-backend > /dev/null; then
cf create-service p.mysql db-small $APP_NAME-backend
while [[ $(cf service $APP_NAME-backend) != *"succeeded"* ]]; do
echo "$APP_NAME-backend is not ready yet..."
sleep 5
done
fi
cf bind-service $APP_NAME $APP_NAME-backend
cf bind-service $APP_NAME hooverRegistry
cf start $APP_NAME