-
Notifications
You must be signed in to change notification settings - Fork 593
/
setup
executable file
·141 lines (128 loc) · 3.12 KB
/
setup
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# This script runs the same sequence as the CircleCI build
if [ $(uname) == "Darwin" ]; then
if which brew >/dev/null; then
echo "Brew is already installed"
else
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
fi
# install nodejs
if which node >/dev/null; then
echo "Nodejs is already installed"
else
if [ $(uname) == "Darwin" ]; then
brew install node
else
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
fi
fi
# install python
if which python3 >/dev/null; then
echo "Python3 is already installed"
else
if [ $(uname) == "Darwin" ]; then
brew install python3
else
sudo apt-get -y install python3-dev python3-pip python3-setuptools
fi
fi
# install MySQL
if which mysql >/dev/null; then
echo "MySQL is already installed"
else
if [ $(uname) == "Darwin" ]; then
brew install mysql
else
sudo apt-get -y install mysql-server
fi
fi
# start mysql
UP=$(pgrep mysql | wc -l);
if [ "$UP" -eq 0 ];
then
if [ $(uname) == "Darwin" ]; then
mysql.server start
else
service mysql start
fi
else
echo "MySQL is already started"
fi
# # install postgres
# if which postgres >/dev/null; then
# echo "Postgresql is already installed"
# else
# if [ $(uname) == "Darwin" ]; then
# brew install postgres
# brew services start postgresql
# sleep 5
# createuser -s postgres
# else
# sudo apt-get -y install postgresql postgresql-contrib
# fi
# fi
# # start postgres
# UP=$(pgrep postgres | wc -l);
# if [ "$UP" -eq 0 ];
# then
# if [ $(uname) == "Darwin" ]; then
# brew services start postgresql
# else
# service postgresql start
# fi
# else
# echo "Postgresql is already started"
# fi
# install neo4j
if which neo4j >/dev/null; then
echo "Neo4j is already installed"
else
if [ $(uname) == "Darwin" ]; then
brew install neo4j
else
wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j.list
sudo apt-get update
sudo apt-get install neo4j
fi
fi
# start neo4j
UP=$(pgrep neo4j | wc -l);
if [ "$UP" -eq 0 ];
then
if [ $(uname) == "Darwin" ]; then
neo4j start
else
service neo4j start
fi
else
echo "Neo4j is already started"
fi
# install pip modules
if python3 -m pip show six autocorrect websocket socketIO-client spacy >/dev/null; then
echo "Pip modules already installed"
else
python3 -m pip install -U six
python3 -m pip install -U autocorrect
python3 -m pip install -U websocket
python3 -m pip install -U socketIO-client
python3 -m pip install -U spacy
fi
echo "spaCy model:"
python3 -m sputnik --name spacy find || python -m spacy.en.download
# install npm modules
if [ -d ./node_modules ]; then
echo "Npm modules already installed"
else
npm install
fi
# copy keys file if not already exist
BIN_DIR=`pwd`/bin
$BIN_DIR/copy-config
# run migration
node src/db.js
node_modules/.bin/sequelize db:migrate --env development
node_modules/.bin/sequelize db:migrate --env test
node_modules/.bin/sequelize db:migrate --env production