2
2
3
3
set -e
4
4
5
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
6
+
5
7
UBUNTU_YEAR=" $( lsb_release -sr | cut -d ' .' -f 1) " ;
6
8
7
9
if [[ " $UBUNTU_YEAR " != " 18" && " $UBUNTU_YEAR " != " 20" && " $UBUNTU_YEAR " != " 22" ]]; then
8
10
echo " Unsupported OS version, only support Ubuntu 22, 20 and 18"
9
11
exit 1
10
12
fi
11
13
12
- DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
13
-
14
14
bash " $DIR /scripts/logo.sh" ;
15
15
16
16
# update package index
17
17
sudo apt-get update
18
18
19
- sudo apt-get -y install wget build-essential libkrb5-dev git sqlite3 unzip bzip2 shellcheck
19
+ sudo apt-get -y install wget build-essential libkrb5-dev git sqlite3 unzip bzip2 shellcheck curl gnupg2 ca-certificates lsb-release
20
20
21
21
if [[ " $UBUNTU_YEAR " = " 22" ]]; then
22
22
sudo apt-get -y install python2 python2-dev
23
+
23
24
if [[ ! -h /usr/bin/python ]]; then
24
25
sudo ln -s /usr/bin/python2.7 /usr/bin/python
25
26
sudo ln -s /usr/bin/python2-config /usr/bin/python-config
30
31
31
32
# Install GCC && G++> 7 version
32
33
sudo apt-get -y install software-properties-common
33
- sudo apt-get -y install build-essential
34
- sudo apt-get install gcc g++ make
34
+ sudo apt-get -y install gcc g++ make
35
35
36
36
# Install dependancies required by the puppeteer
37
- sudo apt-get -y install libgbm-dev libgbm1 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
37
+ sudo apt-get -y install libgbm-dev libgbm1 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
38
38
39
39
if sudo apt-cache pkgnames | grep -q python-software-properties; then
40
40
sudo apt-get -y install python-software-properties
@@ -46,29 +46,25 @@ if ! (command -v apt-add-repository >/dev/null) then
46
46
sudo apt-get -y install software-properties-common
47
47
fi
48
48
49
- # add node.js repo
50
- # echo | apt-add-repository ppa:chris-lea/node.js
51
- wget -qO- https://deb.nodesource.com/setup_14.x | sudo -E bash -
52
-
53
- # update once more after adding new repos
54
- sudo apt-get update
55
-
56
49
# install nginx
57
- sudo apt-get -y install curl gnupg2 ca-certificates lsb-release
58
50
echo " deb http://nginx.org/packages/ubuntu $( lsb_release -cs) nginx" \
59
51
| sudo tee /etc/apt/sources.list.d/nginx.list
60
52
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
61
53
sudo apt-get update
62
54
sudo apt-get -y install nginx
63
55
64
56
# install node.js
57
+ # add node.js repo
58
+ # echo | apt-add-repository ppa:chris-lea/node.js
59
+ wget -qO- https://deb.nodesource.com/setup_14.x | sudo -E bash -
60
+ sudo apt-get update
65
61
sudo apt-get -y install nodejs || (echo " Failed to install nodejs." ; exit)
66
62
67
63
set +e
68
64
NODE_JS_CMD=$( which nodejs)
69
65
set -e
70
66
if [[ -z " $NODE_JS_CMD " ]]; then
71
- sudo ln -s " $( which node) " /usr/bin/nodejs
67
+ sudo ln -s " $( which node) " /usr/bin/nodejs
72
68
fi
73
69
74
70
# if npm is not installed, install it too
@@ -77,8 +73,7 @@ if ! (command -v npm >/dev/null) then
77
73
fi
78
74
79
75
# install supervisor
80
- if [ " $INSIDE_DOCKER " != " 1" ]
81
- then
76
+ if [ " $INSIDE_DOCKER " != " 1" ]; then
82
77
sudo apt-get -y install supervisor || (echo " Failed to install supervisor." ; exit)
83
78
cp " $DIR /config/supervisord.example.conf" " $DIR /config/supervisord.conf"
84
79
fi
@@ -96,15 +91,15 @@ npm config set prefix "$DIR/../.local/"
96
91
# install mongodb
97
92
sudo bash " $DIR /scripts/mongodb.install.sh"
98
93
99
- if [ " $INSIDE_DOCKER " == " 1" ]
100
- then
101
- bash " $DIR /commands/docker/mongodb.sh" &
102
- until mongo --eval " db.stats()" | grep " collections"
103
- do
94
+ if [ " $INSIDE_DOCKER " == " 1" ]; then
95
+ bash " $DIR /commands/docker/mongodb.sh" &
96
+
97
+ until mongo --eval " db.stats()" | grep " collections" ; do
104
98
echo
105
99
echo " waiting for MongoDB to allocate files..."
106
100
sleep 1
107
101
done
102
+
108
103
sleep 3
109
104
fi
110
105
@@ -116,8 +111,7 @@ countly save /etc/nginx/nginx.conf "$DIR/config/nginx"
116
111
sudo cp " $DIR /config/nginx.server.conf" /etc/nginx/conf.d/default.conf
117
112
sudo cp " $DIR /config/nginx.conf" /etc/nginx/nginx.conf
118
113
119
- if [ " $INSIDE_DOCKER " != " 1" ]
120
- then
114
+ if [ " $INSIDE_DOCKER " != " 1" ]; then
121
115
sudo /etc/init.d/nginx restart
122
116
fi
123
117
@@ -130,7 +124,7 @@ cp -n "$DIR/../api/config.sample.js" "$DIR/../api/config.js"
130
124
cp -n " $DIR /../frontend/express/config.sample.js" " $DIR /../frontend/express/config.js"
131
125
132
126
if [ ! -f " $DIR /../plugins/plugins.json" ]; then
133
- cp " $DIR /../plugins/plugins.default.json" " $DIR /../plugins/plugins.json"
127
+ cp " $DIR /../plugins/plugins.default.json" " $DIR /../plugins/plugins.json"
134
128
fi
135
129
136
130
if [ ! -f " /etc/timezone" ]; then
@@ -163,14 +157,12 @@ sudo countly task dist-all
163
157
sudo countly check after install
164
158
165
159
# finally start countly api and dashboard
166
- if [ " $INSIDE_DOCKER " != " 1" ]
167
- then
160
+ if [ " $INSIDE_DOCKER " != " 1" ]; then
168
161
sudo countly start
169
162
fi
170
163
171
- bash " $DIR /scripts/done.sh" ;
172
-
173
- if [ " $INSIDE_DOCKER " == " 1" ]
174
- then
164
+ if [ " $INSIDE_DOCKER " == " 1" ]; then
175
165
kill -2 " $( pgrep mongo) "
176
- fi
166
+ fi
167
+
168
+ bash " $DIR /scripts/done.sh" ;
0 commit comments