/
run.sh
executable file
·180 lines (170 loc) · 5.82 KB
/
run.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env bash
# Copyright (c) 2015 EMC Corporation
# All Rights Reserved
#
# This software contains the intellectual property of EMC Corporation
# or is licensed to EMC Corporation from third parties. Use of this
# software and the intellectual property contained therein is expressly
# limited to the terms and conditions of the License Agreement under which
# it is provided by or on behalf of EMC.
##### Boilerplate ############################################################
# The build environment is always determined by the last bootstrap.sh run
source "$HOME/.ecsinstallrc"
source ${INSTALL_ROOT}/bootstrap.conf
root=${INSTALL_ROOT}
lib=${root}/ui/libexec
cd ${root}
#
# Imports and import configs
source ${lib}/includes.sh
#
##############################################################################
if ! [ -z "$1" ] && [ "$1" == "--clean" ]; then
docker_clean
exit 0
fi
if data_container_missing; then
make_new_data_container
fi
run() {
run="${1}"
shift
local _interactive=''
if ${IS_TTY}; then
_interactive='-t'
fi
sudo docker run --rm -i ${_interactive} --privileged --net=host \
${default_mount_opts[@]} ${image_release} \
${run} ${@}
rc=$?
echo ''
return ${rc}
}
case "$(basename ${0})" in
videploy)
if ${deploy_flag}; then
vim ${deploy_val}
update_deploy
else
update_deploy
fi
;;
update_image)
cd "${root}"
"${root}/ui/update_image.sh" ${*}
cd - 2>&1 >/dev/null
;;
build_image)
cd "${root}"
"${root}/ui/build_image.sh" ${*}
cd - 2>&1 >/dev/null
;;
rebuild_image)
cd "${root}"
"${root}/ui/build_image.sh" --clean
"${root}/ui/build_image.sh"
cd - 2>&1 >/dev/null
;;
update_deploy)
if ! [ -z "${1}" ]; then
deploy_file="$(realpath ${1})" || die "deploy.yml path must be relative to ${root} or absolute"
deploy_flag=true
deploy_val="${deploy_file}"
export deploy_flag
export deploy_val
o "Updating bootstrap.conf to use deploy config from ${deploy_val}"
dump_bootstrap_config > "${root}/bootstrap.conf"
fi
if ${deploy_flag}; then
o "Updating /opt/emc/ecs-install/deploy.yml from ${deploy_val}"
if [ -f /opt/emc/ecs-install/deploy.yml ]; then
diff ${deploy_val} /opt/emc/ecs-install/deploy.yml
fi
cd "${root}"
sudo cp "${deploy_val}" /opt/emc/ecs-install/deploy.yml
o "Recreating ecs-install data container"
# update_image
remove_data_container
make_new_data_container
ecsdeploy noop
# docker_set_artifact
cd - 2>&1 >/dev/null
else
o "No deploy.yml file was provided during bootstrap. To use this feature, do the following:"
o " $ update_deploy <FILE> "
o "Where <FILE> is the absolute path to you deploy.yml file."
fi
;;
ecsdeploy|ecsconfig|ecsremove|catfacts|enter|pingnodes|inventory|testbook)
run "$(basename ${0})" ${@} || exit $?
;;
island-step1)
#run ecsdeploy load || exit $?
run ecsdeploy cache || exit $?
;;
island-step2)
#run ecsdeploy load || exit $?
run ecsdeploy access || exit $?
run ecsdeploy check || exit $?
run ecsdeploy bootstrap || exit $?
run ecsdeploy reboot || exit $?
sleep 30
run ping_until_clear
run ecsdeploy deploy || exit $?
run ecsdeploy start || exit $?
o "Please wait for 30 minutes before running next step for services to bootstrap"
;;
ova-step1)
#run ecsdeploy load || exit $?
run ecsdeploy access || exit $?
run ecsdeploy check || exit $?
run ecsdeploy bootstrap || exit $?
run ecsdeploy deploy || exit $?
run ecsdeploy start || exit $?
o "Please wait for 30 minutes before running next step for services to bootstrap"
;;
step1)
#run ecsdeploy load || exit $?
run ecsdeploy access || exit $?
run ecsdeploy check || exit $?
run ecsdeploy cache || exit $?
run ecsdeploy bootstrap || exit $?
run ecsdeploy reboot || exit $?
run ping_until_clear
run ecsdeploy deploy || exit $?
run ecsdeploy start || exit $?
o "Please wait for 30 minutes before running next step for services to bootstrap"
;;
step2|island-step3|ova-step2)
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig licensing -a || exit $?
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig sp -a || exit $?
o "Sleeping for 15 minutes for Storage Pool to be ready"
sleep 900
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig vdc -a || exit $?
run ecsconfig vdc -p || exit $?
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig rg -a || exit $?
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig management-user -a || exit $?
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig namespace -a || exit $?
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig object-user -a || exit $?
o "Pinging Management API Endpoint until ready"
run ecsconfig ping -c -x || exit $?
run ecsconfig bucket -a || exit $?
;;
*)
die "Invalid operation."
;;
esac