mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-17 19:12:33 -05:00
Fix up vagrant config
* Use Ubuntu 14.04 box which supports both VMWare and Virtualbox * Correctly set memory/CPU settings for vmware_fusion provider * Use nodesource repo instead of deprecated chris-lea PPA for installing node.js * Upgrade npm to latest version * Correct permissions for provisioner script (npm module install)
This commit is contained in:
parent
e3db0dea3a
commit
7048b2bc08
3 changed files with 63 additions and 29 deletions
15
Vagrantfile
vendored
15
Vagrantfile
vendored
|
@ -4,17 +4,20 @@
|
||||||
# Original content copyright (c) 2014 dpen2000 licensed under the MIT license
|
# Original content copyright (c) 2014 dpen2000 licensed under the MIT license
|
||||||
|
|
||||||
VAGRANTFILE_API_VERSION = "2"
|
VAGRANTFILE_API_VERSION = "2"
|
||||||
|
Vagrant.require_version ">= 1.5.0"
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
|
|
||||||
# A VMware compatible box is avaliable from:
|
# Ubuntu 14.04 compatible with both VirtualBox and VMWare Fusion
|
||||||
# https://github.com/spkane/vagrant-boxes/releases/download/v1.0.0/trusty64_vmware.box
|
# see https://github.com/phusion/open-vagrant-boxes#readme
|
||||||
config.vm.box = "ubuntu/trusty64"
|
config.vm.box = "phusion/ubuntu-14.04-amd64"
|
||||||
|
|
||||||
|
config.vm.hostname = "coco-dev"
|
||||||
|
|
||||||
config.vm.network "forwarded_port", guest: 3000, host: 3000
|
config.vm.network "forwarded_port", guest: 3000, host: 3000
|
||||||
config.vm.network "forwarded_port", guest: 9485, host: 9485
|
config.vm.network "forwarded_port", guest: 9485, host: 9485
|
||||||
|
|
||||||
config.vm.provision "shell", path: "scripts/vagrant/provision.sh"
|
config.vm.provision "shell", path: "scripts/vagrant/provision.sh", privileged: false
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |v|
|
config.vm.provider "virtualbox" do |v|
|
||||||
v.memory = 2048
|
v.memory = 2048
|
||||||
|
@ -22,8 +25,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.provider "vmware_fusion" do |v|
|
config.vm.provider "vmware_fusion" do |v|
|
||||||
v.memory = 2048
|
v.vmx["memsize"] = "2048"
|
||||||
v.cpus = 2
|
v.vmx["numvcpus"] = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,11 +4,14 @@ mkdir -p /vagrant/temp
|
||||||
cd /vagrant/temp
|
cd /vagrant/temp
|
||||||
rm -f dump.tar.gz
|
rm -f dump.tar.gz
|
||||||
rm -rf dump
|
rm -rf dump
|
||||||
wget http://analytics.codecombat.com:8080/dump.tar.gz
|
echo "Downloading mongo dump file..."
|
||||||
tar xzvf dump.tar.gz --no-same-owner
|
wget --no-verbose http://analytics.codecombat.com:8080/dump.tar.gz
|
||||||
mongorestore --drop
|
tar xzf dump.tar.gz --no-same-owner
|
||||||
|
echo "Restoring mongo dump file..."
|
||||||
|
mongorestore --quiet --drop
|
||||||
if [ -d /vagrant/temp/backup ]
|
if [ -d /vagrant/temp/backup ]
|
||||||
then
|
then
|
||||||
|
echo "Restoring mongo backup..."
|
||||||
cd /vagrant/temp/backup
|
cd /vagrant/temp/backup
|
||||||
mongorestore
|
mongorestore --quiet
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
# Original content copyright (c) 2014 dpen2000 licensed under the MIT license
|
# Original content copyright (c) 2014 dpen2000 licensed under the MIT license
|
||||||
|
|
||||||
|
# some defaults
|
||||||
|
DISTRO="trusty"
|
||||||
|
NODE_VERSION="0.10" # 0.10 | 0.12 | 4.x | 5.x
|
||||||
|
|
||||||
|
# inform apt that there's no user to answer interactive questions
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Set default ulimits
|
# Set default ulimits
|
||||||
cat <<- EOF > /tmp/limits.conf
|
cat <<- EOF > /tmp/limits.conf
|
||||||
* soft nofile 10000
|
* soft nofile 10000
|
||||||
|
@ -9,23 +16,44 @@ EOF
|
||||||
sudo mv /tmp/limits.conf /etc/security/limits.conf
|
sudo mv /tmp/limits.conf /etc/security/limits.conf
|
||||||
sudo chown root:root /etc/security/limits.conf
|
sudo chown root:root /etc/security/limits.conf
|
||||||
|
|
||||||
#Install required software
|
# install prerequisites
|
||||||
sudo apt-get -y update
|
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
|
||||||
sudo apt-get -y install python-software-properties git
|
echo "deb https://deb.nodesource.com/node_${NODE_VERSION} ${DISTRO} main
|
||||||
sudo add-apt-repository -y ppa:chris-lea/node.js
|
deb-src https://deb.nodesource.com/node_${NODE_VERSION} ${DISTRO} main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||||
sudo apt-get -y update
|
|
||||||
sudo apt-get -y install nodejs
|
|
||||||
sudo apt-get -y install g++ make
|
|
||||||
mkdir /vagrant/node_modules
|
|
||||||
sudo mkdir /node_modules
|
|
||||||
sudo chown vagrant:vagrant /node_modules
|
|
||||||
sudo mount -o bind /node_modules /vagrant/node_modules
|
|
||||||
cd /vagrant
|
|
||||||
npm install
|
|
||||||
sudo npm install -g geoip-lite
|
|
||||||
bower install --allow-root
|
|
||||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
|
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 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
|
||||||
sudo apt-get -y update
|
|
||||||
sudo apt-get -y install mongodb-org
|
echo "updating apt sources..."
|
||||||
bash /vagrant/scripts/vagrant/fillMongo.sh
|
sudo apt-get -qq update
|
||||||
|
|
||||||
|
echo "installing prerequisites..."
|
||||||
|
sudo apt-get -qqy install --no-install-recommends git g++ make curl wget
|
||||||
|
|
||||||
|
# install node.js
|
||||||
|
echo "installing node.js..."
|
||||||
|
sudo apt-get -qqy install nodejs
|
||||||
|
echo "upgrading npm..."
|
||||||
|
sudo npm install -g npm@latest # upgrade npm
|
||||||
|
sudo npm install -g geoip-lite
|
||||||
|
sudo npm install -g bower
|
||||||
|
|
||||||
|
# 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
|
||||||
|
sudo chown vagrant:vagrant /node_modules
|
||||||
|
sudo mount --bind /node_modules /vagrant/node_modules
|
||||||
|
cd /vagrant
|
||||||
|
|
||||||
|
# install npm modules
|
||||||
|
echo "installing modules..."
|
||||||
|
npm install
|
||||||
|
bower install
|
||||||
|
|
||||||
|
# install mongo
|
||||||
|
echo "installing mongodb..."
|
||||||
|
sudo apt-get -qqy install --no-install-recommends mongodb-org
|
||||||
|
|
||||||
|
# populate mongo
|
||||||
|
echo "populating mongodb..."
|
||||||
|
exec /vagrant/scripts/vagrant/fillMongo.sh
|
||||||
|
|
Loading…
Reference in a new issue