Skip to content

Instantly share code, notes, and snippets.

@sainu
Created September 2, 2016 09:12
Show Gist options
  • Save sainu/22dec952f62a239edee6d80b8e214220 to your computer and use it in GitHub Desktop.
Save sainu/22dec952f62a239edee6d80b8e214220 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
config.vm.box = "ubuntu/trusty64"
# Configurate the virtual machine to use 2GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Forward the Rails server default port to the host
config.vm.network :forwarded_port, guest: 3000, host: 3000
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "nodejs"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::user"
chef.add_recipe "rbenv::vagrant"
chef.add_recipe "vim"
chef.add_recipe "mysql::server"
chef.add_recipe "mysql::client"
# Install Ruby 2.2.1 and Bundler
# Set an empty root password for MySQL to make things simple
chef.json = {
ruby_build: {
upgrade: "sync"
},
rbenv: {
user_installs: [{
user: 'vagrant',
rubies: ["2.2.1", "2.3.1"],
global: "2.3.1",
gems: {
"2.2.1" => [
{ name: "bundler" },
],
"2.3.1" => [
{ name: "bundler" },
]
}
}]
},
run_list: [
"ruby_build",
"rbenv::user"
],
mysql: {
server_root_password: ''
}
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment