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 pathsetEnvAA.bash
179 lines (134 loc) · 5.84 KB
/
setEnvAA.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
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
#!/bin/bash
# Copyright (c) 2016 Jeong Han Lee
# Copyright (c) 2016 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 :
# version : 0.1.4
export THIS_SCRIPT=$(realpath "$0")
export THIS_TOP="$(dirname "$THIS_SCRIPT")"
# Hostname is not reliable to use it in the appliances.xml, so force to get the running
# IP, and use it into... need to change them by other demands
declare hostname_cmd="$(hostname)"
export _HOST_NAME="$(tr -d ' ' <<< $hostname_cmd )"
export _HOST_IP="$(ip -4 route get 8.8.8.8 | awk {'print $7'} | tr -d '\n')";
export _USER_NAME="$(whoami)"
# preAA.bash, aaBuild.bash, aaService.bash
#
export TOMCAT_HOME=/usr/share/tomcat
#
# /usr/share/tomcat/lib is the symbolic link to /usr/share/java/tomcat
#
export TOMCAT_LIB=/usr/share/tomcat/lib
# We assume that we inherit the EPICS environment variables
# This includes setting up the LD_LIBRARY_PATH to include the JCA .so file.
# EPICS BASE is installed in the local directory
export EPICS_BASE_VER="R3.15.5";
export EPICS_BASE=${HOME}/epics/${EPICS_BASE_VER}
export EPICS_HOST_ARCH=linux-x86_64
# LD_LIBRARY_PATH should have the EPICS
export LD_LIBRARY_PATH=${EPICS_BASE}/lib/${EPICS_HOST_ARCH}:${LD_LIBRARY_PATH}
export PATH=${EPICS_BASE}/bin/${EPICS_HOST_ARCH}:${PATH}
export EPICS_CA_ADDR_LIST="127.0.0.1 ${_HOST_IP}";
export EPICS_CA_AUTO_ADDR_LIST=yes;
export EPICS_CA_SERVER_PORT=5064
export EPICS_CA_REPEATER_PORT=5065
if [ -f ${HOME}/.bashrc_local ]; then
# Overwrite EPICS_CA_ADDR_LIST and others...
#
. ${HOME}/.bashrc_local
fi
# Tomcat lib
export LD_LIBRARY_PATH=${TOMCAT_LIB}:${LD_LIBRARY_PATH}
export AA_GIT_URL="https://github.com/slacmshankar";
export AA_GIT_NAME="epicsarchiverap";
export AA_GIT_DIR=${THIS_TOP}/${AA_GIT_NAME};
# aaSetup, aaService
export AA_TARGET_TOP=/opt
export ARCHAPPL_TOP=${AA_TARGET_TOP}/archappl
export LD_LIBRARY_PATH=${ARCHAPPL_TOP}/engine/webapps/engine/WEB-INF/lib/native/${EPICS_HOST_ARCH}:${ARCHAPPL_TOP}/engine/webapps/engine/WEB-INF/lib:${LD_LIBRARY_PATH}
# Tomcat user
TOMCAT_USER="tomcat"
TOMCAT_GROUP=${TOMCAT_USER}
TOMCAT_USER_HOME=${ARCHAPPL_TOP}/temp
# # Use an in memory persistence layer
# export ARCHAPPL_PERSISTENCE_LAYER=org.epics.archiverappliance.config.persistence.InMemoryPersistence
# # Tell the appliance that we are deploying all the components in one VM.
# # This reduces the thread count and other parameters in an effort to optimize memory.
#export ARCHAPPL_ALL_APPS_ON_ONE_JVM="true"
#
# This approach is only valid for the single appliance installation.
# If one wants to install multiple appliances, appliances.xml should
# has the different structures.
#
export AACHAPPL_SINGLE_IDENTITY="appliance0"
export APPLIANCES_XML="appliances.xml";
# The following variables are defined in archappl.
# Do not change other names
export ARCHAPPL_APPLIANCES=${ARCHAPPL_TOP}/${APPLIANCES_XML};
export ARCHAPPL_MYIDENTITY=${AACHAPPL_SINGLE_IDENTITY};
export SITE_POLICIES_FILE="ess_policies.py";
export ARCHAPPL_POLICIES=${ARCHAPPL_TOP}/${SITE_POLICIES_FILE}
export SITE_PROPERTIES_FILE="archappl.properties";
export ARCHAPPL_PROPERTIES_FILENAME=${ARCHAPPL_TOP}/${SITE_PROPERTIES_FILE}
# Archiever Appliance User and Password for DB
# One should change the the default AA user password properly.
export DB_USER_NAME="archappl";
export DB_USER_PWD="archappl";
export DB_NAME="archappl";
export DB_JAVACLIENT_VER="1.5.4";
export DB_CLASSNAME="org.mariadb.jdbc.Driver"
export DB_AA_URL="mariadb"
export JAR_CLIENT_NAME="mariadb-java-client";
export MARIADB_CONNECTORJ_JAR="${JAR_CLIENT_NAME}-${DB_JAVACLIENT_VER}.jar";
# For MySQL,
#export DB_CLASSNAME="com.mysql.jdbc.Driver"
#export DB_AA_URL="mysql"
#
# Set Path for apache-commons-daemon.jar, because I use the CentOS packages
# apache-commons-daemon.x86_64 and apache-commons-daemon-jsvc.x86_64
# Somehow jsvc doesn't know where apache-commons-daemon.jar. So the clear PATH
# should be defined.
#
export CLASS_PATH=/usr/share/java
#
# The original options are
#
# export JAVA_OPTS="-XX:MaxPermSize=128M -XX:+UseG1GC -Xmx4G -Xms4G -ea"
#
# -XX:MaxPermSize=size This option was deprecated in JDK 8,
# and superseded by the -XX:MaxMetaspaceSize option.
#
# The physical memory : 64G, so I use 8G instead of 4G, since we don't have any other application on the server.
# Set MaxMetaspaceSize : 256M, so it reduces the GC execution to compare with the original option.
#
export JAVA_HEAPSIZE="512M"
export JAVA_MAXMETASPACE="256M"
export JAVA_OPTS="-XX:MaxMetaspaceSize=${JAVA_MAXMETASPACE} -XX:+UseG1GC -Xms${JAVA_HEAPSIZE} -Xmx${JAVA_HEAPSIZE} -ea"
# It might be better to assign the proper directory, while the installating CentOS.
# Anyway, /home has the most of space, so I created
# Make tmpfs for the short term storage by editing /etc/fstab file.
# For 10G file size add this line:
# tmpfs /srv/sts tmpfs defaults,size=10g 0 0
# preAA.bash
# aaService.bash
declare ARCHAPPL_STORAGE_TOP=/home/arch
#
# Set the location of short term and long term stores; this is necessary only if your policy demands it
export ARCHAPPL_SHORT_TERM_FOLDER=${ARCHAPPL_STORAGE_TOP}/sts/ArchiverStore
export ARCHAPPL_MEDIUM_TERM_FOLDER=${ARCHAPPL_STORAGE_TOP}/mts/ArchiverStore
export ARCHAPPL_LONG_TERM_FOLDER=${ARCHAPPL_STORAGE_TOP}/lts/ArchiverStore