-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·71 lines (62 loc) · 2.85 KB
/
install.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
#!/bin/bash
applicationSecret=$1
applicationId=$2
tenantId=$3
azureSovereignCloud=$4
cycleDownloadURL=$5
cyclecloudVersion=$6
username=$7
cycleFqdn=$8
storageAccountLocation=$9
password=${10}
sshKey=${11}
clusterName=${12}
flockFrom=${13}
poolPassword=${14}
region=${15}
subnetId=${16}
masterMachineType=${17}
executeMachineType=${18}
cyclecloudExec="/usr/local/bin/cyclecloud"
htCondorDownloadFolder="/root/htcondor-flocking"
cycleProjectsFolder="/opt/cycle_server/work/staging/projects/htcondor-flocking"
blobsDownloadLink="https://github.com/Azure/cyclecloud-htcondor/releases/download/1.0.1"
htcondorFetchLocation="https://github.com/beameio/cyclecloud-htcondor"
echo "Installing CycleCloud"
python cyclecloud_install.py --cyclecloudVersion "$cyclecloudVersion" --downloadURL "$cycleDownloadURL" --azureSovereignCloud "$azureSovereignCloud" --tenantId "$tenantId" --applicationId "$applicationId" --applicationSecret "$applicationSecret" --username "$username" --hostname "$cycleFqdn" --acceptTerms --password "${password}" --storageAccount "$storageAccountLocation"
# wait for the machine type db to be filled
sleep 60
echo "Fetching htcondor template"
$cyclecloudExec project fetch $htcondorFetchLocation $htCondorDownloadFolder
htcondorTemplateName=$(cat $htCondorDownloadFolder/project.ini | grep "name =" | cut -d "=" -f 2 | xargs)
htcondorTemplateVersion=$(cat $htCondorDownloadFolder/project.ini | grep "version =" | cut -d "=" -f 2 | xargs)
htcondorFiles=$(cat $htCondorDownloadFolder/project.ini | grep "Files=" | cut -d "=" -f 2 | xargs)
echo "Downloading blobs"
mkdir -p $htCondorDownloadFolder/blobs
files=($(echo $htcondorFiles | tr "," "\n"))
for i in "${files[@]}"
do
(cd $htCondorDownloadFolder/blobs && wget $blobsDownloadLink/$i)
done
(cd $htCondorDownloadFolder && $cyclecloudExec project build && $cyclecloudExec project upload azure-storage)
mkdir -p $cycleProjectsFolder
mkdir -p $cycleProjectsFolder/$htcondorTemplateVersion
cp -rv $htCondorDownloadFolder/build/$htcondorTemplateName/* $cycleProjectsFolder/$htcondorTemplateVersion
cp -rv $htCondorDownloadFolder/blobs $cycleProjectsFolder
echo "Importing htcondor template '$htcondorTemplateName'"
$cyclecloudExec import_template -f "$htCondorDownloadFolder/templates/htcondor.txt"
echo "Creating cluster '$clusterName' from template '$htcondorTemplateName'"
echo "{
\"configuration_htcondor_flock_from\": \"$flockFrom\",
\"configuration_htcondor_pool_password\": \"$poolPassword\",
\"Owner\": \"$username\",
\"Password\": \"$password\",
\"Region\": \"$region\",
\"SubnetId\": \"$subnetId\",
\"Credentials\": \"azure\",
\"MasterMachineType\": \"$masterMachineType\",
\"ExecuteMachineType\": \"$executeMachineType\"
}" >> params.json
$cyclecloudExec create_cluster $htcondorTemplateName $clusterName -p params.json
echo "Starting cluster '$clusterName'"
$cyclecloudExec start_cluster $clusterName