A Virtual Machine for every language
Switch branches/tags
Nothing to show
Clone or download
ergl Merge pull request #15 from ergl/ocaml
Add OCaml support
Latest commit e7172e4 Aug 26, 2015

README.md

Vagrantfiles

Just a cheeky repository with some base Vagrantfiles I use in a number of projects. Each setup is based on a vanilla installation of Ubuntu 14.04 LTS (Trusty Tahr) from Vagrant Cloud.

How do I use it?

To download a vagrant box for your project, just run the following. Remember to replace $LANG with an available language from the list below.

curl -O https://raw.githubusercontent.com/adlawson/vagrantfiles/master/$LANG/Vagrantfile
vagrant up
vagrant ssh
cd /srv

Available languages

Language Tooling Version Extras
brainfuck bf 20041219ubuntu5
clojure Leiningen stable Java 8
csharp Mono stable
elixir Mix latest from erlang-solutions.com
erlang Rebar latest from erlang-solutions.com
golang Godep 1.4.2 from golang.org
haskell 2010
hhvm Composer latest from ppa:mapnik/boost
iojs NPM 1.2.0 from iojs.org
julia latest from ppa:staticfloat/juliareleases
lua 5.2.*
nodejs NPM latest from ppa:chris-lea/node.js
ocaml latest from ppa:asvm/ppa OPAM
perl 5.*
php Composer 5.6.* from ppa:ondrej/php5-5.6 Xdebug
python Pip 3.4.* and 2.7.* (python3 and python)
racket 5.93
ruby Gem 2.2.0 RVM
rust Cargo stable
scala SBT 2.11.5 Java 8
scheme latest mit-scheme

Template

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

    hostname = "<your language name here>.box"
    locale = "en_GB.UTF.8"

    # Box
    config.vm.box = "ubuntu/trusty64"

    # Shared folders
    config.vm.synced_folder ".", "/srv"

    # Setup
    config.vm.provision :shell, :inline => "touch .hushlogin"
    config.vm.provision :shell, :inline => "hostnamectl set-hostname #{hostname} && locale-gen #{locale}"
    config.vm.provision :shell, :inline => "apt-get update --fix-missing"
    config.vm.provision :shell, :inline => "apt-get install -q -y g++ make git curl vim"

    # Lang
    # Provide additional packages/setup/etc
    ...
end

Configuration

Static IP

To add support for a static IP address to your box, add the following to the Vagrantfile after download:

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

NFS

If you prefer NFS to the default network filesystem provided by your VM, replace the # Shared folders lines in the Vagrantfile with the following. You will need a Static IP for this to work correctly.

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

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

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://opensource.org/licenses/mit.