This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path03_aaDeploy.bash
executable file
·152 lines (113 loc) · 4.16 KB
/
03_aaDeploy.bash
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
#!/bin/bash
#
# Copyright (c) 2016 - Present Jeong Han Lee
# Copyright (c) 2016 - Present European Spallation Source ERIC
#
# The program is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2 of the
# License, or any newer version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see https://www.gnu.org/licenses/gpl-2.0.txt
#
# Author : Jeong Han Lee
# email : han.lee@esss.se
# Date : Thursday, February 16 15:03:29 CET 2017
# version : 0.9.8-rc1
#
#
declare -gr SC_SCRIPT="$(realpath "$0")"
declare -gr SC_TOP="$(dirname "$SC_SCRIPT")"
. ${SC_TOP}/functions
declare -gr SUDO_CMD="sudo";
declare -g SUDO_PID="";
declare -g WARSRC_DIR=${SC_TOP};
function deploy_war_release() {
local func_name=${FUNCNAME[*]}; __ini_func ${func_name};
local target=${1};
local deploy_dir=${2};
local warsrc_dir=${3};
printf "%s %18s is deploying...\n" "-->" "new ${target} war"
pushd ${deploy_dir}/${target}/webapps;
${SUDO_CMD} rm -rf ${target}*;
${SUDO_CMD} mkdir ${target};
${SUDO_CMD} unzip -q ${warsrc_dir}/${target}.war -d ${target};
popd;
__end_func ${func_name};
}
${SUDO_CMD} -v
. ${SC_TOP}/setEnvAA.bash
checkIfArchappl
if [[ ! -f ${WARSRC_DIR}/mgmt.war ]]; then
printf "The folder ${WARSRC_DIR} does not seem to have a mgmt.war.\n"
exit 1
fi
tomcat_services=("mgmt" "engine" "etl" "retrieval")
echo "Deploying a new release from ${WARSRC_DIR} onto ${ARCHAPPL_TOP}"
echo ""
echo "Replacing old war files with new war files"
for service in ${tomcat_services[@]}; do
deploy_war_release ${service} "${ARCHAPPL_TOP}" "${WARSRC_DIR}";
done
# Post installation steps for changing look and feel etc.
site_specific_dir="${SC_TOP}/site_specific_content"
##
## Change template for web sites
if [[ -f ${site_specific_dir}/template_changes.html ]]; then
echo ""
echo "Modifying static contents for the site specific information"
${SUDO_CMD} -E java -cp ${ARCHAPPL_TOP}/mgmt/webapps/mgmt/WEB-INF/classes \
org.epics.archiverappliance.mgmt.bpl.SyncStaticContentHeadersFooters \
${site_specific_dir}/template_changes.html \
${ARCHAPPL_TOP}/mgmt/webapps/mgmt/ui
echo ""
fi
##
## Copy site specific images
if [[ -d ${site_specific_dir}/img ]]; then
echo ""
echo "Copying site specific images recursively from ${WARSRC_DIR} onto ${ARCHAPPL_TOP}";
${SUDO_CMD} cp -R ${site_specific_dir}/img/* ${ARCHAPPL_TOP}/mgmt/webapps/mgmt/ui/comm/img/ ;
echo ""
fi
##
## Copy site specific main.css file
if [[ -d ${site_specific_dir}/css ]]; then
echo ""
echo "Copying site specific CSS files from ${WARSRC_DIR} onto ${ARCHAPPL_TOP}";
for service in ${tomcat_services[@]}; do
printf "%s %26s is deploying...\n" "-->" "new main.css in ${service}"
${SUDO_CMD} cp -R ${site_specific_dir}/css/main.css ${ARCHAPPL_TOP}/${service}/webapps/${service}/ui/comm/css/ ;
done
echo ""
fi
##
## Copy site specific default_policies.py file
if [[ -f ${site_specific_dir}/default_policies.py ]]; then
echo ""
echo "Copying the default site specific polices file onto ${ARCHAPPL_TOP}";
${SUDO_CMD} cp -R ${site_specific_dir}/default_policies.py ${ARCHAPPL_POLICIES} ;
echo ""
fi
##
## Copy site specific default archappl.properties file
if [[ -f ${site_specific_dir}/default_archappl.properties ]]; then
echo ""
echo "Copying the default site specific default archappl.properties file onto ${ARCHAPPL_TOP}";
${SUDO_CMD} cp -R ${site_specific_dir}/default_archappl.properties ${ARCHAPPL_PROPERTIES_FILENAME} ;
echo ""
fi
echo "Done deploying a new release from ${WARSRC_DIR} onto ${ARCHAPPL_TOP}"
##
##
## Change owner and its group any new added files in the archappl directory
##
${SUDO_CMD} chown -R ${TOMCAT_USER}.${TOMCAT_GROUP} ${ARCHAPPL_TOP}/
${SUDO_CMD} -k;
exit