-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_deside_cloud.sh
More file actions
executable file
·96 lines (76 loc) · 2.88 KB
/
Copy pathinstall_deside_cloud.sh
File metadata and controls
executable file
·96 lines (76 loc) · 2.88 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
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
#!/bin/bash
#
# DESIDE CLOUD
# Scott Hall
#
# An automatic integrated design environment infrastructure builder for cloud based application. This
# script will build the AWS cloud infrastructure for a secure design environment that can be customized
# and maintained by any developer to meet their design needs.
#
# Deside Cloud takes care of the cumbersome implementation of cloud infrastructure and security and allows
# you, the developer, to focus on the application itself. Being in the cloud you will also have complete
# control over scalability and size to meet your computation and analysis needs.
#
# This script will handle the installation of the AWS infrastructure and help you to customize the application
# to your needs. Of course you can accept the defaults and change things later but the point is, is that it
# is all up to you.
# #############################################################################
# VARIABLES
# #############################################################################
# TODO: Use these variables to construct the terreform variables.tf file
terraform_var_file="SMH__terraform_vars.tfvars"
# Bastion host names
bastion_az1_host_name="DesIde-Cloud1 Bastion"
# RDS database identifier
rds_db_identifier="deside-cloud-mysql-db"
rds_db_username="deside_admin"
rds_db_password="reset_this_password"
rds_db_name="DesideCloud"
# TODO: Update sample code to reflect inputs
# #############################################################################
# BUILD APPLICATION
# #############################################################################
#echo ""
#echo "BUILD DesIde Cloud AMI's"
#echo ""
#
#cd packer
#packer build deside_cloud_ami.json
#packer build deside_cloud_ami_bastion.json
#cd ..
#
echo ""
echo "Build the infrastructure"
echo ""
cd terraform
terraform apply --var-file=$terraform_var_file
# Sleep for 60 seconds to ensure services are online and initialized
echo -n "Sleeping for 60 seconds to give AWS resources time to fully initialize "
time_cnt="0"
while [ $time_cnt -lt 60 ]
do
echo -n "."
sleep 1
time_cnt=$[$time_cnt+1]
done
echo "DONE!"
# Deploy code to front end webservers
cd ..
cd src/authserver
./deploy_to_aws.sh
# Deploy code the the analysis servers (analyserver)
cd ../..
cd src/analyserver
./deploy_to_aws.sh
# Add some content to the database
# Get the public DNS of a bastion server to do this
cd ../..
pub_dns=$(python install/get_bastion_dns.py $bastion_az1_host_name)
# Get the database endpoint
rds=$(python install/get_rds_endpoint.py $rds_db_identifier)
echo "Bastion Server Public DNS Name: $pub_dns"
echo "RDS Endpoint : $rds"
# Secure copy the python file to setup a sample database
scp install/setup_database.py ubuntu@$pub_dns:setup_database.py
ssh ubuntu@$pub_dns chmod 755 setup_database.py
ssh ubuntu@$pub_dns python3 setup_database.py $rds_db_username $rds_db_password $rds $rds_db_name