-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartUpScript.sh
68 lines (56 loc) · 2.38 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
56
57
58
59
60
61
62
63
64
65
66
67
68
export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# 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
# Agent installation
if [ -z "$APM_FORK" ]
then
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 "Installing CSEC agent from https://github.com/newrelic/csec-node-agent.git/#${CSEC_BRANCH} branch"
npm install "https://github.com/newrelic/csec-node-agent.git/#${CSEC_BRANCH}"
rm -rf node_modules/newrelic/node_modules/@newrelic/security-agent
fi
else
echo "Installing Newrelic agent from newrelic fork ${APM_FORK} branch"
npm install "https://github.com/k2io/node-newrelic-fork.git/#${APM_FORK}"
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
# command to copy newrelic.js from node_modules to application directory and configure fields in config file
sleep 3s
#sed -i "s/'My Application'/'${NEW_RELIC_APP_NAME}'/g" /syscall_node/newrelic.js
#sed -i "s/'license key here'/'${NEW_RELIC_LICENSE_KEY}'/g" /syscall_node/newrelic.js
#sed -i "/license_key:/a\ host: 'staging-collector.newrelic.com'," /syscall_node/newrelic.js
#sed -i "/allow_all_headers:/a\ security: {\n agent: {\n enabled: true \n },\n enabled: true,\n validator_service_url: 'wss://iast3-csec-se.test-poised-pear.cell.us.nr-data.net',\n }," /syscall_node/newrelic.js
# start Ldap Server
node ldapServer.js &
# start NodeJS application
node index.js