-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathinstall.sh
executable file
·127 lines (96 loc) · 3.31 KB
/
install.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
#!/bin/bash
JDK_VERSION="zulu11.62.17-ca-jdk11.0.18-linux_x64"
JETTY_VERSION="10.0.13" # NOTE: jetty version should be kept in sync with values in render/render-ws/pom.xml and render/Dockerfile
JETTY_DIST="jetty-home-${JETTY_VERSION}"
# URL for JDK
# You can find latest Linux x64 download links at:
# https://www.azul.com/downloads/?version=java-8-lts&os=linux&architecture=x86-64-bit&package=jdk&show-old-builds=true
JDK_URL="https://cdn.azul.com/zulu/bin/${JDK_VERSION}.tar.gz"
# URLs for Jetty 10, SLF4J 1.7, Logback 1.1, and Swagger 2.1
MAVEN_CENTRAL_URL="https://repo1.maven.org"
JETTY_URL="${MAVEN_CENTRAL_URL}/maven2/org/eclipse/jetty/jetty-home/${JETTY_VERSION}/${JETTY_DIST}.tar.gz"
ABSOLUTE_SCRIPT=`readlink -m $0`
SCRIPTS_DIR=`dirname ${ABSOLUTE_SCRIPT}`
REPO_DIR=`readlink -m ${SCRIPTS_DIR}/../../../..`
INSTALL_DIR=`readlink -m ${REPO_DIR}/deploy`
if (( $# > 0 )); then
INSTALL_DIR=`readlink -m ${1}`
fi
function exitIfDirectoryHasSpaces {
CONTEXT="$1"
DIR_TO_CHECK="$2"
if (( `echo "${DIR_TO_CHECK}" | wc -w` > 1 )); then
echo """
The ${CONTEXT} directory
${DIR_TO_CHECK}
contains one or more spaces which will break assumptions in this fragile script.
To run this script, please move the ${CONTEXT} directory into a path without spaces.
"""
exit 1
fi
}
exitIfDirectoryHasSpaces "base render clone" "${REPO_DIR}"
exitIfDirectoryHasSpaces "install" "${INSTALL_DIR}"
echo """
setup install area ${INSTALL_DIR} ...
"""
mkdir -p ${INSTALL_DIR}
cd ${INSTALL_DIR}
echo """
download JDK and Jetty ...
"""
curl "${JDK_URL}" | tar xz
curl ${JETTY_URL} | tar xz
echo """
configure Jetty ...
"""
export JETTY_BASE="${INSTALL_DIR}/jetty_base"
mkdir -p ${JETTY_BASE}
cd ${JETTY_BASE}
mkdir -p etc lib/ext lib/logging modules resources webapps work
cp ${SCRIPTS_DIR}/jetty/etc/* etc
cp ${SCRIPTS_DIR}/jetty/modules/* modules
cp ${SCRIPTS_DIR}/jetty/resources/* resources
cp ${SCRIPTS_DIR}/jetty/webapps/*.xml webapps
cp -r ${SCRIPTS_DIR}/jetty/start.d .
# remove setuid module since non-container installs may not be running as root
rm start.d/setuid.ini
# hack to fix logback access issue 1052
cp ${SCRIPTS_DIR}/jetty/lib/ext/*.jar lib/ext
echo """
download and install SLF4J, Logback, and Swagger UI ...
"""
${SCRIPTS_DIR}/jetty/configure_web_server.sh
# setup start script
JETTY_HOME="${INSTALL_DIR}/${JETTY_DIST}"
JAVA_HOME="${INSTALL_DIR}/${JDK_VERSION}"
JETTY_WRAPPER_SCRIPT="${JETTY_BASE}/jetty_wrapper.sh"
sed "
s~/opt/local/jetty_home~${JETTY_HOME}~
s~/opt/local/jetty_base~${JETTY_BASE}~
s~/misc/sc/jdks/zulu11~${JAVA_HOME}~
" ${SCRIPTS_DIR}/jetty/jetty_wrapper.sh > ${JETTY_WRAPPER_SCRIPT}
chmod 755 ${JETTY_WRAPPER_SCRIPT}
echo """
setup example data ...
"""
# setup example data with install path
CLIENT_RESOURCES_DIR="${REPO_DIR}/render-ws-java-client/src/main/resources"
EXAMPLE_1_SOURCE_DIR="${CLIENT_RESOURCES_DIR}/example_1"
EXAMPLE_1_INSTALL_DIR="${REPO_DIR}/examples/example_1"
if [ -d ${EXAMPLE_1_SOURCE_DIR} ]; then
mkdir -p ${EXAMPLE_1_INSTALL_DIR}
cd ${EXAMPLE_1_SOURCE_DIR}
for JSON_FILE in *.json; do
sed '
s@/tmp@'"${CLIENT_RESOURCES_DIR}"'@
' ${JSON_FILE} > ${EXAMPLE_1_INSTALL_DIR}/${JSON_FILE}
done
else
echo "no example source data found"
fi
echo """
Completed installation in ${INSTALL_DIR}:
$(ls -alh "${INSTALL_DIR}")
Jetty wrapper script is ${JETTY_WRAPPER_SCRIPT}
"""