opt-cc/docs/infra/3rd-party-install.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-02-16 15:34:31 +01:00
cd $(dirname $0)
#####################################################
###### 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
sudo ln -sf ~/.nvm/versions/node/$(node -v)/bin/node /usr/bin/node
# upgrade to latest npm version
sudo npm install -g npm@latest
2018-02-16 15:34:31 +01:00
if [ "${1}" == "prod" ]; then
cd ./../..
npm install
npm run deploy-static:prod
2018-02-16 15:34:31 +01:00
sudo npm install -g pm2
pm2 start pm2-start.json
2018-02-16 15:34:31 +01:00
pm2 startup systemd
fi