This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
install
executable file
·245 lines (206 loc) · 7.64 KB
/
install
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/bin/bash
FORCE_FRESH_INSTALL="yes"
START_DIR=`pwd`
NIMBUS_SRC_REL="`dirname $0`"
NIMBUS_SRC=`cd $NIMBUS_SRC_REL; pwd`
if [ "X$1" = "X" ]; then
echo ""
echo "Usage: $0 destination_dir"
echo " You must specify the destination directory."
echo ""
exit 1
fi
NIMBUS_REL_BASE_HOME="`dirname $1`"
NIMBUS_BASE_HOME=`cd $NIMBUS_REL_BASE_HOME; pwd`
if [ ! -e $NIMBUS_REL_BASE_HOME ]; then
echo "The parent directory for the installation path $1 must exist"
exit 1
fi
NIMBUS_INST_DIR=`basename $1`
NIMBUS_HOME="$NIMBUS_BASE_HOME/$NIMBUS_INST_DIR"
echo "NIMBUS_HOME $NIMBUS_HOME"
if [ "X$NIMBUS_ALLOW_ROOT_INSTALL" != "Xyes" ] && [ $EUID -eq 0 ]; then
echo ""
echo "It is not recommended to install or run Nimbus as root."
echo "If you insist, set the NIMBUS_ALLOW_ROOT_INSTALL environment variable to \"yes\""
echo ""
exit 1
fi
if [ -d $NIMBUS_HOME ] && [ "$(ls -A $NIMBUS_HOME)" ]; then
if [ $FORCE_FRESH_INSTALL = "yes" ]; then
echo ""
echo "The destination directory '$NIMBUS_HOME' exists and is not empty."
echo "It is not recommended to reinstall Nimbus into an existing install."
echo ""
echo "If you are making changes to the service code, you can build and install those directly:"
echo " export GLOBUS_LOCATION=$NIMBUS_HOME/services"
echo " scripts/jars-build-and-install.sh"
echo ""
echo "If you know what you are doing and want to reinstall, edit this script:"
echo " $0"
echo "and change FORCE_FRESH_INSTALL to \"no\""
echo ""
exit 1
fi
fi
if [ "X$PYTHON" = "X" ]; then
PYTHON_EXE=`which python`
else
PYTHON_EXE="$PYTHON"
fi
# returns 0 if Python 2.5+
$PYTHON_EXE -c "import sys; sys.exit(sys.version_info < (2,5))"
if [ $? -ne 0 ]; then
echo "ERROR: The central Nimbus node must have Python version 2.5 or later (VMM nodes can have 2.4+)."
exit 1
fi
if [ ! -d $NIMBUS_HOME ]; then
mkdir $NIMBUS_HOME
fi
# If the dir exists but is not writable, this will also trip that situation early/gracefully.
touch $NIMBUS_HOME/install.log
if [ $? -ne 0 ]; then
echo "ERROR: cannot write install log file: $NIMBUS_HOME/install.log"
exit 1
fi
# The install log contains the initial cumulus admin secrets
chmod 600 $NIMBUS_HOME/install.log
if [ $? -ne 0 ]; then
echo "ERROR: cannot chmod install log file: $NIMBUS_HOME/install.log"
exit 1
fi
echo ""
echo "-----------------------------------------------------------------" | tee -a $NIMBUS_HOME/install.log
echo "Making the Python virtual environment" | tee -a $NIMBUS_HOME/install.log
echo "-----------------------------------------------------------------" | tee -a $NIMBUS_HOME/install.log
echo ""
pyve_path=$NIMBUS_HOME/ve
echo "Installing from $NIMBUS_SRC"
$PYTHON_EXE $NIMBUS_SRC/cumulus/virtualenv.py --no-site-packages -p $PYTHON_EXE $pyve_path | tee -a $NIMBUS_HOME/install.log
if [ $PIPESTATUS -ne 0 ]; then
echo "ERROR: python virtualenv installation failed."
exit 1
fi
$NIMBUS_SRC/libexec/create-nimbus-home $NIMBUS_HOME 2>&1 | tee -a $NIMBUS_HOME/install.log
# need PIPESTATUS because tee is not the exit code this needs to check
if [ $PIPESTATUS -ne 0 ]; then
echo ""
exit 1
fi
CUMULUS_ENV="$NIMBUS_HOME/cumulus/env.sh"
if [ ! -f $CUMULUS_ENV ]; then
echo "Expected file to be created: $CUMULUS_ENV"
exit 1
fi
export NIMBUS_HOME
source $pyve_path/bin/activate
export LANTORRENT_HOME=$NIMBUS_HOME/lantorrent
$NIMBUS_SRC/lantorrent/install.sh $LANTORRENT_HOME | tee -a $NIMBUS_HOME/install.log
rc=$PIPESTATUS
if [ $rc -ne 0 ]; then
echo "lantorrent install failed"
exit $rc
fi
echo ""
echo "-----------------------------------------------------------------"
echo " Configuring installed services"
echo "-----------------------------------------------------------------"
CONFIG_SCRIPT="$NIMBUS_HOME/bin/nimbus-configure"
if [ ! -f $CONFIG_SCRIPT ]; then
echo "Configuration script could not be found: $CONFIG_SCRIPT"
exit 1
fi
vmm_cmd="Programmer. Error."
EXTRA_CONFIG_SCRIPT_ARGS=""
if [ "X" != "X$PREVIOUS_NIMBUS_HOME_VALIDATED" ]; then
echo ""
echo "Beginning the configuration with values from the old Nimbus installation: $PREVIOUS_NIMBUS_HOME_VALIDATED"
echo ""
oldnimbusconf=$PREVIOUS_NIMBUS_HOME_VALIDATED/nimbus-setup.conf
if [ ! -f $oldnimbusconf ]; then
echo "The old Nimbus installation does not have a configuration file, expecting to find: $oldnimbusconf"
exit 1
fi
cp $oldnimbusconf $NIMBUS_HOME/nimbus-setup.conf
if [ $? -ne 0 ]; then
echo "Could not copy the old configuration file: cp $oldnimbusconf $NIMBUS_HOME/nimbus-setup.conf"
exit 1
fi
EXTRA_CONFIG_SCRIPT_ARGS="--conf $NIMBUS_HOME/nimbus-setup.conf"
# We know that a fresh installation will have missing things specified in
# that conf file. Any relative path configuratoin in that previous conf
# file will be copied over here. Any absolute path will be noted but not
# touched.
$CONFIG_SCRIPT $EXTRA_CONFIG_SCRIPT_ARGS --import-prev
if [ $? -ne 0 ]; then
echo ""
echo "Could not import something specified in the old configuration file: $oldnimbusconf"
exit 1
fi
old_vmmdir="$PREVIOUS_NIMBUS_HOME_VALIDATED/services/etc/nimbus/workspace-service/vmm-pools"
vmm_cmd="$CONFIG_SCRIPT $EXTRA_CONFIG_SCRIPT_ARGS --import-2.5-vmms $old_vmmdir"
fi
$CONFIG_SCRIPT $EXTRA_CONFIG_SCRIPT_ARGS
if [ $? -ne 0 ]; then
echo "Nimbus configuration script failed! You may try running it manually:"
echo " $CONFIG_SCRIPT"
echo "You can also run the script with debugging output:"
echo " $CONFIG_SCRIPT --debug"
exit 1
fi
$NIMBUS_SRC/libexec/configure-cumulus.sh "${@}" 2>&1 | tee -a $NIMBUS_HOME/install.log
# need PIPESTATUS because tee is not the exit code of interest
rc=$PIPESTATUS
if [ $rc -ne 0 ]; then
exit $rc
fi
if [ "X" != "X$PREVIOUS_NIMBUS_HOME_VALIDATED" ]; then
echo ""
$CONFIG_SCRIPT $EXTRA_CONFIG_SCRIPT_ARGS --import-cumulusdb
if [ $? -ne 0 ]; then
echo ""
echo "Could not import Cumulus DB from the old configuration file: $oldnimbusconf"
exit 1
fi
fi
echo ""
GUIDEURL=`$NIMBUS_HOME/bin/nimbus-version --guide`
if [ $? -ne 0 ]; then
GUIDEURL="Development mode: no guide url"
fi
echo ""
echo "-----------------------------------------------------------------"
echo " Nimbus installation succeeded!"
echo "-----------------------------------------------------------------"
echo ""
echo "Additional configuration may be necessary, refer to this URL for information:"
echo ""
echo " $GUIDEURL"
echo ""
echo "You can start/stop Nimbus services with the nimbusctl command. e.g:"
echo ""
echo " $NIMBUS_HOME/bin/nimbusctl start"
echo ""
if [ "X" != "X$PREVIOUS_NIMBUS_HOME_VALIDATED" ]; then
old_etc_dir=$PREVIOUS_NIMBUS_HOME_VALIDATED/services/etc/nimbus
new_etc_dir=$NIMBUS_HOME/services/etc/nimbus
echo "-----------------------------------------------------------------"
echo " ** Upgrade work still needed **"
echo "-----------------------------------------------------------------"
echo ""
echo "While key settings have been transferred from your old install,"
echo "you still need to do a manual confirmation and transfer of"
echo "customizations."
echo ""
echo "Run the following command to look for customizations:"
echo ""
echo " diff -u -r $old_etc_dir $new_etc_dir"
echo ""
echo "After using nimbusctl to start the services, use the following"
echo "command to import VMM configurations. This can only be done "
echo "with a running service:"
echo ""
echo " $vmm_cmd"
echo ""
fi
exit 0