-
Notifications
You must be signed in to change notification settings - Fork 0
/
startUpScript.sh
55 lines (47 loc) · 1.47 KB
/
startUpScript.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
export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Node installation
if [ -z "$NODE_VERSION" ]
then
echo "Node version is not set, switching to default version 18.16.1"
nvm install 18.16.1
npm install --save
else
nvm install $NODE_VERSION
npm install --save
fi
# Start mysql
chown -R mysql:mysql /var/lib/mysql
service mysql start
echo "Sleeping 30 sec for MySql startup..."
sleep 10s
mysql -u root --execute="create database K2test"
mysql -u root K2test < database/users.sql
# Start MongoDB
/mongodb-linux-x86_64-3.2.22/bin/mongod &
echo "Sleeping 10 sec for Mongo startup..."
sleep 10s
# Config file mounting
cp $NEW_RELIC_SECURITY_CONFIG_PATH /node-multi-content-type/
# Agent installation
if [ -z "$APM_BRANCH" ]
then
echo "APM_BRANCH is not set, installing ${APM_VERSION} APM agent"
npm install newrelic@${APM_VERSION}
else
echo "https://github.com/newrelic/node-newrelic.git/#${APM_BRANCH}"
npm install "https://github.com/newrelic/node-newrelic.git/#${APM_BRANCH}"
fi
if [ -z "$CSEC_BRANCH" ]
then
echo "CSEC_BRANCH is not set"
else
rm -rf node_modules/\@newrelic/security-agent
echo "https://github.com/newrelic/csec-node-agent.git/#${CSEC_BRANCH}"
npm install "https://github.com/newrelic/csec-node-agent.git/#${CSEC_BRANCH}"
rm -rf node_modules/newrelic/node_modules/@newrelic/security-agent
fi
# start Ldap Server
node ldapServer.js &
# start NodeJS application
node $NR_OPTS index.js