2015-12-03 14:39:04 -05:00
|
|
|
#!/bin/bash -e
|
2015-03-26 16:36:38 -04:00
|
|
|
# Original content copyright (c) 2014 dpen2000 licensed under the MIT license
|
2015-07-24 11:48:34 -04:00
|
|
|
|
2015-12-03 14:39:04 -05:00
|
|
|
# some defaults
|
2016-05-01 00:20:39 -04:00
|
|
|
NODE_VERSION="5.x" # 0.10 | 0.12 | 4.x | 5.x | 6.x
|
2015-12-03 14:39:04 -05:00
|
|
|
|
|
|
|
# inform apt that there's no user to answer interactive questions
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2015-07-24 11:48:34 -04:00
|
|
|
# Set default ulimits
|
|
|
|
cat <<- EOF > /tmp/limits.conf
|
|
|
|
* soft nofile 10000
|
|
|
|
* hard nofile 10000
|
|
|
|
EOF
|
|
|
|
sudo mv /tmp/limits.conf /etc/security/limits.conf
|
|
|
|
sudo chown root:root /etc/security/limits.conf
|
|
|
|
|
2015-12-03 14:39:04 -05:00
|
|
|
# install prerequisites
|
2016-05-01 00:20:39 -04:00
|
|
|
curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | sudo -E bash -
|
2015-12-03 14:39:04 -05:00
|
|
|
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
|
|
|
|
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
|
|
|
|
|
|
|
|
echo "updating apt sources..."
|
2016-05-01 00:20:39 -04:00
|
|
|
sudo apt-get update
|
2015-12-03 14:39:04 -05:00
|
|
|
|
|
|
|
echo "installing prerequisites..."
|
2016-05-01 00:20:39 -04:00
|
|
|
sudo apt-get -y install --no-install-recommends build-essential git g++ make curl wget python2.7 dos2unix
|
2015-12-03 14:39:04 -05:00
|
|
|
|
|
|
|
# install node.js
|
|
|
|
echo "installing node.js..."
|
2016-05-01 00:20:39 -04:00
|
|
|
sudo apt-get -y install nodejs
|
|
|
|
npm config set python `which python2.7`
|
|
|
|
|
2015-12-03 14:39:04 -05:00
|
|
|
echo "upgrading npm..."
|
|
|
|
sudo npm install -g npm@latest # upgrade npm
|
|
|
|
sudo npm install -g bower
|
2016-05-01 00:20:39 -04:00
|
|
|
sudo npm install -g brunch
|
|
|
|
sudo npm install -g geoip-lite
|
|
|
|
sudo npm install -g nodemon
|
2015-12-03 14:39:04 -05:00
|
|
|
|
|
|
|
# bind /vagrant/node_modules so that it does not leak through to the host file system
|
|
|
|
# which triggers symlink and path size issues on Windows hosts
|
|
|
|
mkdir -p /vagrant/node_modules
|
|
|
|
sudo mkdir -p /node_modules
|
2016-05-01 00:20:39 -04:00
|
|
|
sudo chown -R vagrant:vagrant /node_modules
|
2015-12-03 14:39:04 -05:00
|
|
|
sudo mount --bind /node_modules /vagrant/node_modules
|
2016-05-01 00:20:39 -04:00
|
|
|
|
|
|
|
# prepare
|
|
|
|
find /vagrant/app -type f -exec dos2unix {} \;
|
|
|
|
find /vagrant/vendor -type f -exec dos2unix {} \;
|
|
|
|
sudo chown -R vagrant:vagrant /home/vagrant
|
2015-12-03 14:39:04 -05:00
|
|
|
|
|
|
|
# install npm modules
|
|
|
|
echo "installing modules..."
|
2016-05-01 00:20:39 -04:00
|
|
|
cd /vagrant
|
2015-10-29 16:44:26 -04:00
|
|
|
npm install
|
2015-12-03 14:39:04 -05:00
|
|
|
|
|
|
|
# install mongo
|
|
|
|
echo "installing mongodb..."
|
2016-05-01 00:20:39 -04:00
|
|
|
sudo apt-get -y install --no-install-recommends mongodb-org
|
|
|
|
|
2015-12-03 14:39:04 -05:00
|
|
|
# populate mongo
|
|
|
|
echo "populating mongodb..."
|
2016-05-17 22:48:13 -04:00
|
|
|
exec /vagrant/scripts/vagrant/core/fillMongo.sh
|