2018-02-11 12:26:53 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-16 15:34:31 +01:00
|
|
|
cd $(dirname $0)
|
|
|
|
|
2018-02-11 12:26:53 +01:00
|
|
|
#####################################################
|
|
|
|
###### INSTALL ALL REQUIRED 3RD-PARTY SOFTWARE ######
|
|
|
|
#####################################################
|
|
|
|
# MONGO DB COMMUNITY
|
|
|
|
# NPM
|
|
|
|
# NODE
|
|
|
|
|
|
|
|
|
|
|
|
# mongodb key & repo
|
|
|
|
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
|
|
|
|
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | \
|
|
|
|
sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
|
|
|
|
|
|
|
|
# install from apt
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y mongodb-org npm
|
|
|
|
|
|
|
|
# enable mongod for autostart
|
|
|
|
sudo systemctl enable mongod.service
|
|
|
|
|
|
|
|
# install latest node version
|
|
|
|
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
|
|
|
|
source ~/.nvm/nvm.sh
|
|
|
|
nvm install stable
|
2018-02-24 14:06:07 +01:00
|
|
|
sudo ln -sf ~/.nvm/versions/node/$(node -v)/bin/node /usr/bin/node
|
2018-02-11 12:26:53 +01:00
|
|
|
|
|
|
|
# upgrade to latest npm version
|
|
|
|
sudo npm install -g npm@latest
|
|
|
|
|
2018-02-16 15:34:31 +01:00
|
|
|
if [ "${1}" == "prod" ]; then
|
2018-02-24 14:06:07 +01:00
|
|
|
cd ./../..
|
|
|
|
npm install
|
|
|
|
npm run deploy-static:prod
|
2018-02-16 15:34:31 +01:00
|
|
|
sudo npm install -g pm2
|
2018-02-24 14:06:07 +01:00
|
|
|
pm2 start pm2-start.json
|
2018-02-16 15:34:31 +01:00
|
|
|
pm2 startup systemd
|
|
|
|
fi
|