forked from Seagate/cortx-s3server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installhelper.sh
executable file
·341 lines (276 loc) · 15.6 KB
/
installhelper.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
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
#
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For any questions about this software or licensing,
# please email [email protected] or [email protected].
#
#!/bin/sh
# Helper script for S3/Auth install.
# - Creates necessary directories for installation, logging etc.
# - Copies bin/libs/conf/service files etc.
# - argument 1: directory prefix - where to create install dirs.
set -e
usage()
{
echo "Invalid arguments."
echo "Usage: ./installhelper.sh <DIR_PREFIX> [--release]"
exit 1
}
if [ $# -eq 1 ] ; then
IS_RELEASE=
elif [ $# -eq 2 ] ; then
if [ "$2" != "--release" ] ; then
usage
else
IS_RELEASE=1
fi
else
usage
fi
INSTALL_PREFIX=$1
AUTH_INSTALL_LOCATION=$INSTALL_PREFIX/opt/seagate/cortx/auth
S3_INSTALL_LOCATION=$INSTALL_PREFIX/opt/seagate/cortx/s3
S3_CONFIG_FILE_LOCATION=$INSTALL_PREFIX/opt/seagate/cortx/s3/conf
S3_LOG_ROTATE_FILE_LOCATION=$INSTALL_PREFIX/etc/cron.hourly
SERVICE_FILE_LOCATION=$INSTALL_PREFIX/lib/systemd/system
LOG_DIR_LOCATION=$INSTALL_PREFIX/var/log/seagate
NODEJS_DIR_LOCATION=$INSTALL_PREFIX/opt/seagate/cortx/s3/nodejs
RSYSLOG_CFG_DIR_LOCATION=$INSTALL_PREFIX/etc/rsyslog.d
LOGROTATE_CFG_DIR_LOCATION=$INSTALL_PREFIX/etc/logrotate.d/
KEEPALIVED_CFG_DIR_LOCATION=$INSTALL_PREFIX/etc/keepalived
S3_MINI_PROV_CFG_LOCATION=$INSTALL_PREFIX/opt/seagate/cortx/s3/mini-prov
rm -rf $AUTH_INSTALL_LOCATION
rm -rf $S3_INSTALL_LOCATION
mkdir -p $AUTH_INSTALL_LOCATION
mkdir -p $AUTH_INSTALL_LOCATION/resources
mkdir -p $AUTH_INSTALL_LOCATION/scripts
mkdir -p $AUTH_INSTALL_LOCATION/scripts/swupdate
mkdir -p $S3_INSTALL_LOCATION/addb-plugin
mkdir -p $S3_INSTALL_LOCATION/bin
mkdir -p $S3_INSTALL_LOCATION/libevent
mkdir -p $S3_INSTALL_LOCATION/resources
mkdir -p $S3_INSTALL_LOCATION/scripts
mkdir -p $S3_INSTALL_LOCATION/install/ldap/rsyslog.d
mkdir -p $S3_INSTALL_LOCATION/install/ldap/replication
mkdir -p $S3_INSTALL_LOCATION/install/ldap/replication/cleanup
mkdir -p $S3_INSTALL_LOCATION/install/haproxy
mkdir -p $S3_INSTALL_LOCATION/install/logrotate
mkdir -p $S3_INSTALL_LOCATION/docs
mkdir -p $S3_INSTALL_LOCATION/s3backgrounddelete
mkdir -p $S3_INSTALL_LOCATION/conf
mkdir -p $S3_INSTALL_LOCATION/bin
mkdir -p $S3_INSTALL_LOCATION/reset
mkdir -p $S3_CONFIG_FILE_LOCATION
mkdir -p $S3_LOG_ROTATE_FILE_LOCATION
mkdir -p $KEEPALIVED_CFG_DIR_LOCATION
mkdir -p $SERVICE_FILE_LOCATION
mkdir -p $LOG_DIR_LOCATION/s3
mkdir -p $LOG_DIR_LOCATION/auth
mkdir -p $LOG_DIR_LOCATION/auth/server
mkdir -p $LOG_DIR_LOCATION/auth/tools
mkdir -p $NODEJS_DIR_LOCATION
mkdir -p $RSYSLOG_CFG_DIR_LOCATION
mkdir -p $LOGROTATE_CFG_DIR_LOCATION
mkdir -p $S3_MINI_PROV_CFG_LOCATION
# Copy the haproxy dependencies
cp -R scripts/haproxy/* $S3_INSTALL_LOCATION/install/haproxy
# Copy the logrotate dependencies
cp -R scripts/s3-logrotate/* $S3_INSTALL_LOCATION/install/logrotate
# Copy the provisioning config
cp scripts/provisioning/setup.yaml $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/support.yaml $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.post_install.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.post_install.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.prepare.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.prepare.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.init.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.init.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.test.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.test.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.config.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.config.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.config.tmpl.3-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.config.tmpl.3-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.reset.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.reset.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.cleanup.tmpl.1-node $S3_INSTALL_LOCATION/conf
cp scripts/provisioning/templates/s3.cleanup.tmpl.1-node.sample $S3_INSTALL_LOCATION/conf
# Copy the provisioning python scripts
cp scripts/provisioning/s3_setup $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/s3_start $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/postinstallcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/configcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/initcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/cleanupcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/testcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/resetcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/preparecmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/preupgradecmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/postupgradecmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/upgradecmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/setupcmd.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/s3_haproxy_config.py $S3_INSTALL_LOCATION/bin
cp scripts/provisioning/starthaproxy.sh $S3_INSTALL_LOCATION/bin
cp scripts/ldap/ldapaccountaction.py $S3_INSTALL_LOCATION/bin
cp -f scripts/swupdate/merge.py $S3_INSTALL_LOCATION/bin
cp -f scripts/swupdate/merge_pre_post.py $S3_INSTALL_LOCATION/bin
cp -f scripts/env/common/third-party-rpms.txt $S3_INSTALL_LOCATION/bin
# Copy the mini-provisioner config files
cp scripts/provisioning/s3setup_prereqs.json $S3_MINI_PROV_CFG_LOCATION/
cp scripts/provisioning/s3_prov_config.yaml $S3_MINI_PROV_CFG_LOCATION/
# Copy the S3 reset scripts
cp scripts/reset/* $S3_INSTALL_LOCATION/reset
# Copy the s3 dependencies
cp -R third_party/libevent/s3_dist/lib/* $S3_INSTALL_LOCATION/libevent/
# Copy the s3 server
cp bazel-bin/s3server $S3_INSTALL_LOCATION/bin/
# Copy motrkvscli tool
cp bazel-bin/motrkvscli $S3_INSTALL_LOCATION/bin/
# Copy addb plugin
cp bazel-bin/libs3addbplugin.so $S3_INSTALL_LOCATION/addb-plugin/
# Copy the resources
cp resources/s3_error_messages.json $S3_INSTALL_LOCATION/resources/s3_error_messages.json
cp resources/s3_audit_log_schema.json $S3_INSTALL_LOCATION/resources/s3_audit_log_schema.json
# Copy the S3 Config option file
if [ -z "${IS_RELEASE}" ] ; then
cp s3config.yaml.sample $S3_CONFIG_FILE_LOCATION
else
cp s3config.release.yaml.sample ${S3_CONFIG_FILE_LOCATION}/s3config.yaml.sample
fi
cp s3config_unsafe_attributes.yaml $S3_CONFIG_FILE_LOCATION
# Copy the S3 Audit Log Config file
cp s3server_audit_log.properties $S3_CONFIG_FILE_LOCATION
# Copy the S3 Motr layout mapping file for different object sizes
cp s3_obj_layout_mapping.yaml $S3_CONFIG_FILE_LOCATION
# Copy the S3 Stats allowlist file
cp s3stats-allowlist.yaml $S3_CONFIG_FILE_LOCATION
# Copy the s3 server startup script for multiple instance
cp ./system/s3startsystem.sh $S3_INSTALL_LOCATION/
# Copy the s3 io stack services startup script for multiple instance
cp ./system/start-s3-iopath-services.sh $S3_INSTALL_LOCATION/
# Copy the s3 io stack services stop script for multiple instance
cp ./system/stop-s3-iopath-services.sh $S3_INSTALL_LOCATION/
# Copy the s3 server daemon shutdown script for multiple instance via systemctl
cp ./system/s3stopsystem.sh $S3_INSTALL_LOCATION/
# Copy the s3 service file for systemctl multiple instance support.
cp ./system/[email protected] $SERVICE_FILE_LOCATION
# Copy s3server support bundle script
cp -f scripts/s3-support-bundles/s3_bundle_generate.sh $S3_INSTALL_LOCATION/scripts/
# Copy s3 background producer startup script at installed location
cp -f starts3backgroundproducer.sh $S3_INSTALL_LOCATION/s3backgrounddelete/
# Copy s3 background consumer startup script at installed location
cp -f starts3backgroundconsumer.sh $S3_INSTALL_LOCATION/s3backgrounddelete/
# Copy the s3 background producer binary file into rpm location.
cp s3backgrounddelete/s3backgrounddelete/s3backgroundproducer $S3_INSTALL_LOCATION/s3backgrounddelete/
# Copy the s3 background consumer binary file into rpm location.
cp s3backgrounddelete/s3backgrounddelete/s3backgroundconsumer $S3_INSTALL_LOCATION/s3backgrounddelete/
# Copy the s3 background configuration file.
cp s3backgrounddelete/s3backgrounddelete/config/s3_background_delete_config.yaml.sample $S3_INSTALL_LOCATION/s3backgrounddelete/config.yaml.sample
cp s3backgrounddelete/s3backgrounddelete/config/s3backgrounddelete_unsafe_attributes.yaml $S3_INSTALL_LOCATION/s3backgrounddelete/
# Copy the s3 cluster configuration file.
cp s3backgrounddelete/s3backgrounddelete/config/s3_cluster.yaml.sample $S3_INSTALL_LOCATION/s3backgrounddelete/
cp s3backgrounddelete/s3backgrounddelete/config/s3_cluster_unsafe_attributes.yaml $S3_INSTALL_LOCATION/s3backgrounddelete/
# Copy the s3 background producer file for systemctl support.
cp s3backgrounddelete/s3backgroundproducer.service $SERVICE_FILE_LOCATION
# Copy the s3 background consumer file for systemctl support.
cp s3backgrounddelete/s3backgroundconsumer.service $SERVICE_FILE_LOCATION
# Copy the s3backgroundproducer service file for dynamic producer_name support.
cp s3backgrounddelete/[email protected] $SERVICE_FILE_LOCATION
# Copy Auth server jar to install location
cp -f auth/server/target/AuthServer-1.0-0.jar $AUTH_INSTALL_LOCATION/
# Copy Auth Password Encrypt Tool
cp -f auth/encryptcli/target/AuthPassEncryptCLI-1.0-0.jar $AUTH_INSTALL_LOCATION/
#Copy Auth Server resources to install location
cp -ru auth/resources/static $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/authserver-log4j2.xml $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/authencryptcli-log4j2.xml $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/authserver.properties.sample $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/authserver_unsafe_attributes.properties $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/keystore.properties.sample $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/keystore_unsafe_attributes.properties $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/defaultAclTemplate.xml $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/AmazonS3.xsd $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/AmazonS3_V2.xsd $AUTH_INSTALL_LOCATION/resources/
cp -f auth/resources/s3authserver.jks $AUTH_INSTALL_LOCATION/resources/
cp -f scripts/s3authserver.jks_template $AUTH_INSTALL_LOCATION/scripts/
cp -f scripts/create_auth_jks_password.sh $AUTH_INSTALL_LOCATION/scripts/
# Copy LDAP replication to install location
# remove this once changes are done in provisioning
cp -f scripts/ldap/syncprov_mod.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/syncprov.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/replicate.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/resultssizelimit.ldif $S3_INSTALL_LOCATION/install/ldap/
# Copy LDAP replication to install location
cp -f scripts/ldap/replication/syncprov_mod.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/syncprov.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/config.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/data.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/olcserverid.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/syncprov_config.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/deltaReplication.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/setupReplicationScript.sh $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/serverIdTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/configTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
cp -f scripts/ldap/replication/dataTemplate.ldif $S3_INSTALL_LOCATION/install/ldap/replication/
# Copy LDAP replication cleanup to install location
cp -f scripts/ldap/replication/cleanup/config.ldif $S3_INSTALL_LOCATION/install/ldap/replication/cleanup/
cp -f scripts/ldap/replication/cleanup/data.ldif $S3_INSTALL_LOCATION/install/ldap/replication/cleanup/
cp -f scripts/ldap/replication/cleanup/olcmirromode_config.ldif $S3_INSTALL_LOCATION/install/ldap/replication/cleanup/
cp -f scripts/ldap/replication/cleanup/olcmirromode_data.ldif $S3_INSTALL_LOCATION/install/ldap/replication/cleanup/
cp -f scripts/ldap/replication/cleanup/olcserverid.ldif $S3_INSTALL_LOCATION/install/ldap/replication/cleanup/
# Copy check replication script to install location
cp -f scripts/ldap/check_ldap_replication.sh $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/create_replication_account.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/test_data.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/run_check_ldap_replication_in_loop.sh $S3_INSTALL_LOCATION/install/ldap/
# Copy slapd log config to install location
cp -f scripts/ldap/slapdlog.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/rsyslog.d/slapdlog.conf $S3_INSTALL_LOCATION/install/ldap/rsyslog.d/
# Copy s3 slapd index file to install location
cp -f scripts/ldap/s3slapdindex.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/cfg_ldap.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/cn=s3user.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/iam-admin-access.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/s3-iam-admin-access.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/iam-admin.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/iam-constraints.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/ldap-init.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/s3-ldap-init.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/olcDatabase={2}mdb.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/ppolicy-default.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/ppolicymodule.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/ppolicyoverlay.ldif $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/setup_ldap.sh $S3_INSTALL_LOCATION/install/ldap/
cp -f scripts/ldap/s3_setup_ldap.sh $S3_INSTALL_LOCATION/install/ldap/
# Copy the auth server startup script.
cp startauth.sh $AUTH_INSTALL_LOCATION/
# Copy auth server Helper scripts
cp -f scripts/enc_ldap_passwd_in_cfg.sh $AUTH_INSTALL_LOCATION/scripts/
cp -f scripts/change_ldap_passwd.ldif $AUTH_INSTALL_LOCATION/scripts/
# Copy openldap_backup readme
cp -f scripts/ldap/openldap_backup_readme $S3_INSTALL_LOCATION/docs/
# Copy s3_log_rotation guide
cp -f s3_log_rotation_guide.txt $S3_INSTALL_LOCATION/docs/
# Copy the auth service file for systemctl support.
cp auth/server/s3authserver.service $SERVICE_FILE_LOCATION
# Copy nodejs binary
#cp third_party/nodejs/s3_dist/bin/node $NODEJS_DIR_LOCATION/
# Copy rsyslog config
cp ./scripts/rsyslog-tcp-audit.conf $RSYSLOG_CFG_DIR_LOCATION
# Copy elasticsearch config
cp ./scripts/elasticsearch/elasticsearch.conf $RSYSLOG_CFG_DIR_LOCATION
# Copy the keepalived config
cp ./scripts/keepalived/keepalived.conf.main $KEEPALIVED_CFG_DIR_LOCATION
exit 0