Skip to content

Instantly share code, notes, and snippets.

@dmarquezbh
Last active August 29, 2015 14:07
Show Gist options
  • Save dmarquezbh/c9af0c026db17a442780 to your computer and use it in GitHub Desktop.
Save dmarquezbh/c9af0c026db17a442780 to your computer and use it in GitHub Desktop.
Vagrantfile for the best dev box ever made!
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
config.vm.network "public_network", bridge: 'wlan0'
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
$swap = <<SCRIPT
# Exit on any error (non-zero return code)
set -e
# Create swapfile of 2GB with block size 1MB
/bin/dd if=/dev/zero of=/swapfile bs=1024 count=2097152
# Create swapfile of 1GB with block size 1MB
#/bin/dd if=/dev/zero of=/swapfile bs=1024 count=1048576
# Set up the swap file
/sbin/mkswap /swapfile
# Enable swap file immediately
/sbin/swapon /swapfile
# Enable swap file on every boot
/bin/echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
SCRIPT
$bootstrap = <<SCRIPT
sudo apt-get -qq update
sudo apt-get -qqy install curl vim git wget
test -f ~/.vimrc && exit
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
echo "execute pathogen#infect()
syntax on
filetype plugin indent on
Helptags
set autoindent
set smartindent
set expandtab
set shiftwidth=2
set softtabstop=2
set nu
set background=dark
" > ~/.vimrc
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-rails.git
git clone git://github.com/tpope/vim-bundler.git
git clone git://github.com/vim-scripts/dbext.vim.git
SCRIPT
$heroku = <<SCRIPT
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
SCRIPT
$nodejs = <<SCRIPT
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -qqy nodejs libfontconfig
sudo npm install --silent -g phantomjs
SCRIPT
$docker = <<SCRIPT
curl -sSL https://get.docker.io/ubuntu/ | sudo sh
SCRIPT
$rails = <<SCRIPT
echo "gem: --no-document" > ~/.gemrc
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm use --install 2.1 --default
gem install rails cucumber rspec em-proxy --no-document
SCRIPT
$aspnetvnext = <<SCRIPT
sudo apt-get -y install curl unzip git-core build-essential autoconf libtool gettext libgdiplus libgtk2.0-0 xsltproc
cd /tmp
git clone --depth=1 https://github.com/mono/mono
cd mono
./autogen.sh --prefix=/usr --with-mcs-docs=no
make get-monolite-latest
make
sudo make install
sudo rm -r /tmp/mono
cd /home/vagrant
yes | certmgr -ssl -m https://go.microsoft.com https://myget.org https://nuget.org
mozroots --import --sync --quiet
curl -s https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh
bash -c "source /home/vagrant/.kre/kvm/kvm.sh && kvm upgrade; echo KvmUpgradeExitCode=$?"
ln -s /home/vagrant/.kre/packages/`bash -c "source /home/vagrant/.kre/kvm/kvm.sh && kvm alias default"` /home/vagrant/.kre/packages/default
export PATH=$PATH:/home/vagrant/.kre/packages/default/bin
rm -rf /vagrant/work/helloworldvnext
mkdir -p /vagrant/work
git clone https://github.com/davidfowl/HelloWorldVNext /vagrant/work/helloworldvnext
cd /vagrant/work/helloworldvnext
kpm restore
SCRIPT
config.vm.provision "shell", inline: $swap
config.vm.provision "shell", inline: $bootstrap, privileged: false
config.vm.provision "shell", inline: $heroku
config.vm.provision "shell", inline: $nodejs, privileged: false
config.vm.provision "shell", inline: $docker, privileged: false
config.vm.provision "shell", inline: $rails, privileged: false
config.vm.provision "shell", inline: $aspnetvnext, privileged: false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment