-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploySimulator.sh
More file actions
executable file
·78 lines (63 loc) · 1.88 KB
/
deploySimulator.sh
File metadata and controls
executable file
·78 lines (63 loc) · 1.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
#!/usr/bin/env bash
#
# Usage: {script} {machine datapath DNS name}
# ./deploySimulator sm4u-13
#
# Deploys the tape backend simulator 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 "monit stop tape_backend_sim"
$SSH "service tomcat9 stop" || true
$SSH "service dataplanner stop" || true
$SSH "service tape_backend_sim stop" || true
echo "Deploying software..."
destination_simulator="/usr/local/bluestorm/frontend/simulator"
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
tarfile="simulator-0.0.4-SNAPSHOT.tar"
built_service="/simulator/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_simulator"
$SSH "rm -rf $destination_simulator"
$SCP -r $full_deploy_dir root@$host:$destination_simulator
echo "Starting services..."
$SSH "monit start tape_backend_sim"
$SSH "monit start dataplanner"
$SSH "monit start tomcat"
echo "Cleaning up..."
rm -rf $full_deploy_dir
echo "Done."