-
Notifications
You must be signed in to change notification settings - Fork 4
/
myhero-install-queue.sh
executable file
·103 lines (86 loc) · 3.96 KB
/
myhero-install-queue.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/bash
[ -z "$MANTL_CONTROL" ] && echo "Please run 'source myhero_setup' to set Environment Variables" && exit 1;
[ -z "$MANTL_USER" ] && echo "Please run 'source myhero_setup' to set Environment Variables" && exit 1;
[ -z "$MANTL_PASSWORD" ] && echo "Please run 'source myhero_setup' to set Environment Variables" && exit 1;
[ -z "$MANTL_DOMAIN" ] && echo "Please run 'source myhero_setup' to set Environment Variables" && exit 1;
[ -z "$DEPLOYMENT_NAME" ] && echo "Please run 'source myhero_setup' to set Environment Variables" && exit 1;
echo " "
echo "***************************************************"
echo Checking if MyHero has already been deployed with deployment name \"$DEPLOYMENT_NAME\"
python mantl_utils.py applicationexists $DEPLOYMENT_NAME/web
if [ $? -eq 1 ]
then
echo " Deployment name available, continuing."
else
echo " Deployment name already used."
echo " Rerun 'source myhero_setup' and choose a new deployment name."
exit 1
fi
# Create Copy of JSON Definitions for Deployment
echo "Creating Service Definitions "
cp sample-myhero-app.json $DEPLOYMENT_NAME-app.json
sed -i "" -e "s/DEPLOYMENTNAME/$DEPLOYMENT_NAME/g" $DEPLOYMENT_NAME-app.json
sed -i "" -e "s/MANTLDOMAIN/$MANTL_DOMAIN/g" $DEPLOYMENT_NAME-app.json
sed -i "" -e "s/direct/queue/g" $DEPLOYMENT_NAME-app.json
cp sample-myhero-data.json $DEPLOYMENT_NAME-data.json
sed -i "" -e "s/DEPLOYMENTNAME/$DEPLOYMENT_NAME/g" $DEPLOYMENT_NAME-data.json
sed -i "" -e "s/MANTLDOMAIN/$MANTL_DOMAIN/g" $DEPLOYMENT_NAME-data.json
cp sample-myhero-web.json $DEPLOYMENT_NAME-web.json
sed -i "" -e "s/DEPLOYMENTNAME/$DEPLOYMENT_NAME/g" $DEPLOYMENT_NAME-web.json
sed -i "" -e "s/MANTLDOMAIN/$MANTL_DOMAIN/g" $DEPLOYMENT_NAME-web.json
cp sample-myhero-ernst.json $DEPLOYMENT_NAME-ernst.json
sed -i "" -e "s/DEPLOYMENTNAME/$DEPLOYMENT_NAME/g" $DEPLOYMENT_NAME-ernst.json
sed -i "" -e "s/MANTLDOMAIN/$MANTL_DOMAIN/g" $DEPLOYMENT_NAME-ernst.json
cp sample-myhero-mosca.json $DEPLOYMENT_NAME-mosca.json
sed -i "" -e "s/DEPLOYMENTNAME/$DEPLOYMENT_NAME/g" $DEPLOYMENT_NAME-mosca.json
sed -i "" -e "s/MANTLDOMAIN/$MANTL_DOMAIN/g" $DEPLOYMENT_NAME-mosca.json
echo " "
echo "***************************************************"
echo Deploying Data Service
echo "** Marathon Application Definition ** "
curl -k -X POST -u $MANTL_USER:$MANTL_PASSWORD https://$MANTL_CONTROL:8080/v2/apps \
-H "Content-type: application/json" \
-d @$DEPLOYMENT_NAME-data.json \
| python -m json.tool
echo "***************************************************"
echo
echo Deploying Mosca
echo "** Marathon Application Definition ** "
curl -k -X POST -u $MANTL_USER:$MANTL_PASSWORD https://$MANTL_CONTROL:8080/v2/apps \
-H "Content-type: application/json" \
-d @$DEPLOYMENT_NAME-mosca.json \
| python -m json.tool
echo "***************************************************"
echo
echo Deploying Ernst Service
echo "** Marathon Application Definition ** "
curl -k -X POST -u $MANTL_USER:$MANTL_PASSWORD https://$MANTL_CONTROL:8080/v2/apps \
-H "Content-type: application/json" \
-d @$DEPLOYMENT_NAME-ernst.json \
| python -m json.tool
echo "***************************************************"
echo
echo Deploying Application Service
echo "** Marathon Application Definition ** "
curl -k -X POST -u $MANTL_USER:$MANTL_PASSWORD https://$MANTL_CONTROL:8080/v2/apps \
-H "Content-type: application/json" \
-d @$DEPLOYMENT_NAME-app.json \
| python -m json.tool
echo "***************************************************"
echo
echo Deploying Web Service
echo "** Marathon Application Definition ** "
curl -k -X POST -u $MANTL_USER:$MANTL_PASSWORD https://$MANTL_CONTROL:8080/v2/apps \
-H "Content-type: application/json" \
-d @$DEPLOYMENT_NAME-web.json \
| python -m json.tool
echo "***************************************************"
echo
echo Deployed
echo " "
echo "Wait 5-10 minutes for the service to deploy "
echo "and then open the following page in your browser to view the application."
echo " "
echo " http://$DEPLOYMENT_NAME-web.$MANTL_DOMAIN "
echo " "
echo " "