-
Notifications
You must be signed in to change notification settings - Fork 21
/
esg-init
executable file
·238 lines (204 loc) · 10.9 KB
/
esg-init
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
#! /bin/bash
#--------------
#User Defined / Settable (public)
#--------------
_t=${0%.*}
install_prefix=${install_prefix:-${ESGF_INSTALL_PREFIX:-"/usr/local"}}
esg_root_dir=${esg_root_dir:-${ESGF_HOME:-"/esg"}}
esg_config_dir=${esg_root_dir}/config
esg_config_type_file=${esg_config_dir}/config_type
esgf_secret_file=${esg_config_dir}/.esgf_pass
pg_secret_file=${esg_config_dir}/.esg_pg_pass
pub_secret_file=${esg_config_dir}/.esg_pg_publisher_pass
ks_secret_file=${esg_config_dir}/.esg_keystore_pass
install_manifest=${install_manifest:-"${esg_root_dir}/esgf-install-manifest"}
chosen_dist_url_vals_file=${chosen_dist_url_vals_file:-"${esg_root_dir}/chosen_dist_url_vals_file"}
install_logfile=${install_manifest}
logfile=${logfile:-"/tmp/${_t##*/}.out"}
#--------------
init() {
#--------------------------------
# Internal esgf node code versions
#--------------------------------
apache_frontend_version=${apache_frontend_version:-"1.0.14"}
apache_frontend_tag=${apache_frontend_tag:-"v1.15"}
cdat_version=${cdat_version:-"8.0"}
# cdat_tag="1.5.1.esgf-v1.7.0"
esgcet_version=${esgcet_version:-"3.5.9"}
publisher_tag=${publisher_tag:-"v3.5.9"}
esgprep_version="2.9.5"
cmor_version="3.4"
requests_version="2.20.0"
cdf2cim_versiom="0.3.2.0"
#see esgf-node-manager project:
esgf_node_manager_version=${esgf_node_manager_version:-"1.0.4"}
esgf_node_manager_db_version=${esgf_node_manager_db_version:-"0.1.6"}
#see esgf-security project:
esgf_security_version=${esgf_security_version:-"2.8.9"}
esgf_security_db_version=${esgf_security_db_version:-"0.1.6"}
#see esg-orp project:
esg_orp_version=${esg_orp_version:-"2.10.11"}
#see esgf-idp project:
esgf_idp_version=${esgf_idp_version:-"2.8.8"}
#see esg-search project:
esg_search_version=${esg_search_version:-"4.17.9"}
#see esgf-web-fe project:
#see esgf-dashboard project:
esgf_dashboard_version=${esgf_dashboard_version:-"1.5.24"}
esgf_dashboard_db_version=${esgf_dashboard_db_version:-"0.0.3"}
#see esgf-desktop project:
esgf_desktop_version=${esgf_desktop_version:-"0.0.22"}
esgf_stats_api_version=${esgf_stats_api_version:-"1.0.10"}
#--------------------------------
# External programs' versions
#--------------------------------
openssl_version=${openssl_version:="0.9.8r"} ; openssl_min_version=${openssl_min_version:="0.9.8e"} ; openssl_max_version=${openssl_max_version:="0.9.9z"}
java_version=${java_version:-"1.8.0_192"} ; java_min_version=${java_min_version:-"1.8.0_192"}
ant_version=${ant_version:-"1.9.1"} ; ant_min_version=${ant_min_version:-"1.9.1"}
postgress_version=${postgress_version:-"8.4.20"} ; postgress_min_version=${postgress_min_version:-"8.4.20"}
tomcat_version=${tomcat_version:-"8.5.34"} ; tomcat_min_version=${tomcat_min_version:-"8.5.34"}
#cmake_version=${cmake_version:="2.8.12.2"} ; cmake_min_version=${cmake_min_version:="2.8.10.2"} ; cmake_max_version=${cmake_max_version:="2.8.12.2"}
tds_version=${tds_version:-"5.0.3"} ; tds_min_version=${tds_min_version:-"5.0.3"}
sqlalchemy_version=${sqlalchemy_version:-"0.7.10"} ; sqlalchemy_min_version=${sqlalchemy_min_version:-"0.7.10"}
# Since ESGF 1.8, LAS version is declared in esg-product-server
#las_version=${las_version:-"8.1"}; las_min_version=${las_min_version:-"8.1"}
python_version=${python_version:-"2.7"}
#--------------------------------
# Script vars (~external)
#--------------------------------
openssl_install_dir=${OPENSSL_HOME:-${install_prefix}/openssl}
postgress_install_dir=${PGHOME:-/var/lib/pgsql}
postgress_bin_dir=${PGBINDIR:-/usr/bin}
postgress_lib_dir=${PGLIBDIR:-/usr/lib64/pgsql}
postgress_user=${PGUSER:-dbsuper}
local pg_secret=$(cat ${pg_secret_file} 2> /dev/null)
pg_sys_acct_passwd=${pg_sys_acct_passwd:=${pg_secret:=changeme}}
unset pg_secret #only here to hold the tertiary ephemeral value from file, unset asap
local pub_secret=$(cat ${pub_secret_file} 2> /dev/null)
publisher_db_user_passwd=${publisher_db_user_passwd:-${pub_secret}}
unset pub_secret #only here to hold the tertiary ephemeral value from file, unset asap
postgress_host=${PGHOST:-localhost}
postgress_port=${PGPORT:-5432}
#cmake_install_dir=${CMAKE_HOME:-${install_prefix}/cmake}
cdat_home=${CDAT_HOME:-${install_prefix}/conda}
java_opts=${JAVA_OPTS:-""}
java_install_dir=${JAVA_HOME:-${install_prefix}/java}
ant_install_dir=${ANT_HOME:-${install_prefix}/ant}
tomcat_install_dir=${CATALINA_HOME:-${install_prefix}/tomcat}
tomcat_conf_dir=${esg_config_dir}/tomcat
tomcat_opts=${CATALINA_OPTS}
tomcat_user=${tomcat_user:-tomcat}
tomcat_group=${tomcat_group:-$tomcat_user}
globus_location=${GLOBUS_LOCATION:-${install_prefix}/globus}
mail_smtp_host=${mail_smtp_host:-smtp.`hostname --domain`} #standard guess.
mail_admin_address=${mail_admin_address}
if [ -n "${ESGINI}" ]; then
publisher_home=${ESGINI%/*}
publisher_config=${ESGINI##*/}
fi
############################################
#### DO NOT EDIT BELOW THIS POINT!!!!! ####
############################################
export GIT_SSL_NO_VERIFY=1
export OPENSSL_HOME=${openssl_install_dir}
export PGHOME=${postgress_install_dir}
export PGBINDIR=${postgress_bin_dir}
export PGLIBDIR=${postgress_lib_dir}
export PGUSER=${postgress_user}
export PGHOST=${postgress_host}
export PGPORT=${postgress_port}
#export CMAKE_HOME=${cmake_install_dir}
export CDAT_HOME=${cdat_home}
export JAVA_HOME=${java_install_dir}
export JAVA_OPTS=${java_opts}
export ANT_HOME=${ant_install_dir}
export CATALINA_HOME=${tomcat_install_dir}
export CATALINA_BASE=${CATALINA_HOME}
export CATALINA_OPTS=${tomcat_opts}
export GLOBUS_LOCATION=${globus_location}
myPATH=$OPENSSL_HOME/bin:$CMAKE_HOME/bin:$JAVA_HOME/bin:$ANT_HOME/bin:/usr/bin:/usr/sbin:/bin:/sbin:$CDAT_HOME/bin:$CDAT_HOME/Externals/bin:$CATALINA_HOME/bin:$GLOBUS_LOCATION/bin:${install_prefix}/bin
myLD_LIBRARY_PATH=$OPENSSL_HOME/lib:$CDAT_HOME/Externals/lib:$GLOBUS_LOCATION/lib:${install_prefix}/geoip/lib:/usr/lib64:/usr/lib
export PATH=$(_path_unique $myPATH:$PATH)
export LD_LIBRARY_PATH=$(_path_unique $myLD_LIBRARY_PATH:$LD_LIBRARY_PATH)
export CFLAGS="-I${OPENSSL_HOME}/include -I/usr/include ${CFLAGS} -fPIC"
export LDFLAGS="-L${OPENSSL_HOME}/lib -L/usr/lib64 -L/usr/lib -Wl,--rpath,${OPENSSL_HOME}/lib"
#--------------
# ID Setting
#--------------
#fix: id will always return the root id no matter what flags we use if we start this via sudo
installer_user=${ESG_USER:-${SUDO_USER:-$(echo $HOME | sed 's#.*/\([^/]\+\)/\?$#\1#')}}
installer_uid=${ESG_USER_UID:-${SUDO_UID:-$(id -u $installer_user)}}
installer_gid=${ESG_USER_GID:-${SUDO_GID:-$(id -g $installer_user)}}
installer_home=${ESG_USER_HOME:-/usr/local/src/esgf}
#deprecate SUDO_?ID so we only use one variable for all this
[[ $SUDO_UID ]] && ESG_USER_UID=${SUDO_UID} && unset SUDO_UID
[[ $SUDO_GID ]] && ESG_USER_GID=${SUDO_GID} && unset SUDO_GID
verbose_print "${installer_user}:${installer_uid}:${installer_gid}:${installer_home}"
#--------------
# Script vars (internal)
#--------------
esg_backup_dir=${esg_backup_dir:-"${esg_root_dir}/backups"}
esg_config_dir=${esg_config_dir:-"${esg_root_dir}/config"}
esg_log_dir=${esg_log_dir:-"${esg_root_dir}/log"}
esg_tools_dir=${esg_tools_dir:-"${esg_root_dir}/tools"}
esg_etc_dir=${esg_etc_dir:-"${esg_root_dir}/etc"}
workdir=${workdir:-${ESGF_INSTALL_WORKDIR:-${installer_home}/workbench/esg}}
word_size=${word_size:-$(file /bin/bash | perl -ple 's/^.*ELF\s*(32|64)-bit.*$/$1/g')}
let num_cpus=1+$(cat /proc/cpuinfo | sed -n 's/^processor[ \t]*:[ \t]*\(.*\)$/\1/p' | tail -1)
date_format="+%Y_%m_%d_%H%M%S"
num_backups_to_keep=${num_backups_to_keep:-7}
compress_extensions=".tar.gz|.tar.bz2|.tgz|.bz2|.tar"
certificate_extensions="pem|crt|cert|key"
openssl_dist_url=http://www.openssl.org/source/openssl-${openssl_version}.tar.gz
java_dist_url=${esg_dist_url_root}/java/${java_version}/jdk${java_version}-${word_size}.tar.gz
ant_dist_url=http://archive.apache.org/dist/ant/binaries/apache-ant-${ant_version}-bin.tar.gz
openssl_workdir=${workdir}/openssl
esgf_dashboard_ip_workdir=${workdir}/esgf-dashboard-ip
bash_completion_url=${esg_dist_url}/thirdparty/bash-completion-20060301-1.noarch.rpm
db_database=${ESGF_DB_NAME:-${db_database:-"esgcet"}}
node_db_name=${db_database}
postgress_jar=postgresql-8.4-703.jdbc3.jar
postgress_driver=org.postgresql.Driver
postgress_protocol=jdbc:postgresql:
pg_sys_acct=${pg_sys_acct:-postgres}
pg_sys_acct_group=${pg_sys_acct_group:-$pg_sys_acct}
#cmake_workdir=${workdir}/cmake
#cmake_repo=http://www.cmake.org/cmake.git
#cdat_repo=git://github.com/UV-CDAT/uvcdat.git
#cdat_repo_https=https://github.com/UV-CDAT/uvcdat.git
publisher_repo=git://github.com/ESGF/esg-publisher.git
apache_frontend_repo=https://github.com/ESGF/apache-frontend.git
publisher_repo_https=https://github.com/ESGF/esg-publisher.git
esgcet_egg_file=esgcet-${esgcet_version}-py${python_version}.egg
esg_testdir=${workdir}/../esg_test
tomcat_dist_url=http://archive.apache.org/dist/tomcat/tomcat-${tomcat_version%%.*}/v${tomcat_version}/bin/apache-tomcat-${tomcat_version}.tar.gz
tomcat_pid_file=/var/run/tomcat-jsvc.pid
utils_url=${esg_dist_url}/utils
thredds_dist_url=ftp://ftp.unidata.ucar.edu/pub/thredds/${tds_version%.*}/${tds_version}/thredds.war
thredds_esg_dist_url=${esg_dist_url}/thredds/${tds_version%.*}/${tds_version}/thredds.war
thredds_content_dir=${thredds_content_dir:-${esg_root_dir}/content}
#NOTE: This root dir should match a root set in the thredds setup
thredds_root_dir=${esg_root_dir}/data
thredds_replica_dir=${thredds_root_dir}/replica
esgf_stats_api_dist_url=${esg_dist_url}/esgf-stats-api/esgf-stats-api.war
#NOTE: This is another RedHat/CentOS specific portion!!! it will break on another OS!
show_summary_latch=0
source_latch=0
scripts_dir=${install_prefix}/bin
esg_installarg_file=${scripts_dir}/esg-installarg
no_globus=${no_globus:-0}
force_install=${force_install:-0}
extkeytool_download_url=${esg_dist_url}/etc/idptools.tar.gz
tomcat_users_file=${tomcat_conf_dir}/tomcat-users.xml
keystore_file=${tomcat_conf_dir}/keystore-tomcat
keystore_alias=${keystore_alias:-my_esgf_node}
keystore_password=${keystore_password}
truststore_file=${tomcat_conf_dir}/esg-truststore.ts
truststore_password=${truststore_password:-changeit}
globus_global_certs_dir=/etc/grid-security/certificates
#NOTE: java keystore style DN...
default_dname="OU=ESGF.ORG, O=ESGF" #zoiks: allow this to be empty to allow prompting of user for fields!
config_file=${esg_config_dir}/esgf.properties
index_config="master slave"
}
init