/vagrantfiles

Basic Vagrantfiles. Nothing fancy.

Primary LanguageRubyMIT LicenseMIT

Vagrantfiles

Just a cheeky repository with some base Vagrantfiles I use in a number of projects. Each setup is based on an almost vanilla install of Ubuntu 12.04 LTS x64 (Precise Pagolin) from Vagrantbox.es.

curl -O https://raw.github.com/adlawson/vagrantfiles/master/{LANG}/Vagrantfile

Vagrant will mount your directory to /srv via your provider's shared folder feature. Alternatively, you can use NFS by replacing the synced_folder line with this:

# Shared folders
config.vm.synced_folder ".", "/srv", :nfs => true

# Network
config.vm.network :private_network, ip: "33.33.33.101"

Other dependencies installed by default on every instance are:

  • cURL
  • Python Software Properties
  • Make
  • G++
  • Git
  • Cowsay (important)

Performance

It may be important to you to limit the performance hit to your local machine, or ensure enough memory is available to your provider. For example, the configuration below will limit the VM to using no more than 50% of your CPU and allocate up to 2GB of memory. Note: This example uses VirtualBox, but if you use a different provider such as VMWare, then this will be ignored safely.

  config.vm.provider :virtualbox do |v|
    v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
    v.customize ["modifyvm", :id, "--memory", 2048]
  end

Usage

Typically you won't want to download all configuration files, so rather than cloning this project with git, a simple cURL download will do.

$ # Download the file for the language you want to use (nodejs in this example)
$ curl -O https://raw.github.com/adlawson/vagrantfiles/master/nodejs/Vagrantfile

$ # Create and SSH into the VM
$ vagrant up
$ vagrant ssh
...
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

$ # Move into the mounted project directory
$ cd /srv

License

The content of this library is released under the MIT License by Andrew Lawson.
You can find a copy of this license in LICENSE or at http://www.opensource.org/licenses/mit.