-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployFrontEndServerAndDataPlanner.sh
More file actions
executable file
·90 lines (72 loc) · 2.27 KB
/
deployFrontEndServerAndDataPlanner.sh
File metadata and controls
executable file
·90 lines (72 loc) · 2.27 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
#!/usr/bin/env bash
#
# Usage: {script} {machine datapath DNS name}
# ./deployFrontEndServerAndDataPlanner sm4u-13
#
# Deploys the front end S3 server and data planner to the machine specified.
# The machine specified must have scp installed on it.
host=$1
case "$host" in
''|'-h')
echo "Usage: $0 <host>"
exit 1
;;
esac
ipaddr=$(echo $1 | awk '$1 ~ /^([0-9]{1,3}\.){1,3}[0-9]+$/ {print $1}')
if [ -z "$ipaddr" ]; then
case "$host" in
*.eng.sldomain.com)
;;
*-mgmt)
host="${host}.eng.sldomain.com"
;;
*)
host="${host}-mgmt.eng.sldomain.com"
;;
esac
fi
SSH_BASE="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
SSH="$SSH_BASE -l root $host"
SCP="scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r"
echo "Stopping services..."
set -e
$SSH "monit stop tomcat"
$SSH "monit stop dataplanner"
$SSH "service tomcat9 stop" || true
$SSH "service dataplanner stop" || true
echo "Deploying software..."
destination_webapps="/var/run/tomcat/webapps"
destination_planner="/usr/local/bluestorm/frontend/dataplanner"
cwdf="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cwdd="/cygdrive/c/"
cwd=${cwdf/C:\\/$cwdd}
echo "Current working directory: $cwd"
$SSH "zfs set readonly=off system/root0"
deploy_dir="/deploy_temp/"
full_deploy_dir=$cwd$deploy_dir
rm -rf $full_deploy_dir
mkdir $full_deploy_dir
dest="ROOT.war"
full_dest=$full_deploy_dir$dest
built_service="/server/build/libs/server-0.0.4-SNAPSHOT.war"
full_built_service=$cwd$built_service
cp $full_built_service $full_dest
echo "scp $full_deploy_dir to root@$host:$destination_webapps"
$SSH "rm -rf $destination_webapps"
$SCP $full_deploy_dir root@$host:$destination_webapps
$SSH "chmod 777 $destination_webapps/* $destination_webapps"
rm -rf $full_deploy_dir
mkdir $full_deploy_dir
tarfile="DataPlanner-0.0.4-SNAPSHOT.tar"
built_service="/DataPlanner/build/distributions/$tarfile"
full_built_service=$cwd$built_service
tar -xvf $full_built_service -C $full_deploy_dir --strip-components=1
echo "scp -r $full_deploy_dir to root@$host:$destination_planner"
$SSH "rm -rf $destination_planner"
$SCP -r $full_deploy_dir root@$host:$destination_planner
echo "Starting services..."
$SSH "monit start tomcat"
$SSH "monit start dataplanner"
echo "Cleaning up..."
rm -rf $full_deploy_dir
echo "Done."