-
Notifications
You must be signed in to change notification settings - Fork 9
/
environ.sh
57 lines (48 loc) · 1.86 KB
/
environ.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
#!/usr/bin/env bash
# error handling
printError() { echo -e "\e[1;31m[ERROR]: $* \e[0m" >&2; }
printWarning() { echo -e "\e[1;35m[WARNING]: $* \e[0m" >&2; }
# get the working directory
[ -z "${BASH_SOURCE[0]}" ] && thisEnv=$0 || thisEnv=${BASH_SOURCE[0]}
export TIMELINESRC=$(realpath $(dirname $thisEnv)/..)
# RCDB
[ -z "${RCDB_CONNECTION-}" ] && RCDB_CONNECTION=mysql://[email protected]/rcdb
export RCDB_CONNECTION
# check coatjava environment
if [ -z "${COATJAVA-}" ]; then
# if on a CI runner, use CI coatjava build artifacts; otherwise print error
coatjava_ci=$TIMELINESRC/coatjava
[ -d $coatjava_ci ] &&
export COATJAVA=$coatjava_ci ||
printError "cannot find coatjava; please make sure environment variable COATJAVA is set to your coatjava installation"
fi
# ensure coatjava executables are found
[ -n "${COATJAVA-}" ] && export PATH="$COATJAVA/bin${PATH:+:${PATH}}"
# class paths
java_classpath=(
"$COATJAVA/lib/clas/*"
"$COATJAVA/lib/utils/*"
"$TIMELINESRC/monitoring/target/*"
)
groovy_classpath=(
"$TIMELINESRC/detectors/target/*"
"$(dirname $(dirname $(which groovy)))/lib/*"
)
# java and groovy options
timeline_java_opts=(
-DCLAS12DIR=$COATJAVA/
-Djava.util.logging.config.file=$COATJAVA/etc/logging/debug.properties
-Xmx1024m
-XX:+UseSerialGC
)
timeline_groovy_opts=(
-Djava.awt.headless=true
)
# run java with more resources, to mitigate large memory residence for long run periods
timeline_java_opts_highmem=$(echo ${timeline_java_opts[*]} | sed 's;Xmx.*m;Xmx2048m;')
# exports
export CLASSPATH="$(echo "${java_classpath[*]}" | sed 's; ;:;g')${CLASSPATH:+:${CLASSPATH}}"
export JYPATH="$(echo "${groovy_classpath[*]}" | sed 's; ;:;g')${JYPATH:+:${JYPATH}}"
export TIMELINE_JAVA_OPTS="${timeline_java_opts[*]}"
export TIMELINE_GROOVY_OPTS="${timeline_groovy_opts[*]}"
export TIMELINE_JAVA_OPTS_HIGHMEM=$timeline_java_opts_highmem