Skip to content

Instantly share code, notes, and snippets.

@fatrex
Last active September 29, 2024 21:05
Show Gist options
  • Select an option

  • Save fatrex/a1fc9a6493b2f91bd396 to your computer and use it in GitHub Desktop.

Select an option

Save fatrex/a1fc9a6493b2f91bd396 to your computer and use it in GitHub Desktop.
Vagrant Rails4 + Ruby2 + Postgres
Vagrant file and Chef file for creating a virtual machine with Ruby 2.2.2, Rails 4 and Postgres
site "http://community.opscode.com/api/v1"
cookbook 'apt'
cookbook 'build-essential'
cookbook 'postgresql', '~> 3.4.20'
cookbook 'ruby_build'
cookbook 'nodejs'
cookbook 'rvm', '~> 0.9.4'
cookbook 'vim'
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.provision :chef_solo do |chef|
chef.version = "12.3"
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "nodejs"
chef.add_recipe "ruby_build"
chef.add_recipe "rvm::user"
chef.add_recipe "vim"
chef.add_recipe "postgresql::server"
chef.add_recipe "postgresql::client"
chef.json = {
rvm: {
user_installs: [{
user: 'vagrant',
rubies: ["2.2.2"],
default_ruby: "2.2.2",
gems: {
"2.2.2" => [
{ name: "bundler" },
{ name: "rails" },
]
}
}]
},
postgresql: {
password: {
postgres: "password"
}
}
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment