Skip to content

Instantly share code, notes, and snippets.

@ashleyconnor
Created August 8, 2015 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashleyconnor/ee9a8be9166ec58efba5 to your computer and use it in GitHub Desktop.
Save ashleyconnor/ee9a8be9166ec58efba5 to your computer and use it in GitHub Desktop.
Vagrantfile for Berkshelf and Chef Zero
source "https://supermarket.chef.io"
cookbook 'apt', '~> 2.7.0'
cookbook 'build-essential', '~> 2.2.3'
cookbook 'git', '~> 4.3.3'
cookbook 'heroku-toolbelt', '~> 0.1.0'
cookbook 'imagemagick', '~> 0.2.3'
cookbook 'nginx', '~> 2.7.6'
cookbook 'nodejs', '~> 2.4.0'
cookbook 'postgresql', '~> 3.4.20'
cookbook 'python', '~> 1.4.6'
cookbook 'redis', '~> 3.0.4'
cookbook 'rvm', '~> 0.9.4'
cookbook 'sqlite', '~> 1.1.0'
cookbook 'vim', '~> 1.1.2'
# -*- 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"
config.vm.synced_folder "./data/", "/home/vagrant/data"
# 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
config.ssh.forward_agent = true
config.berkshelf.enabled = true
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_zero do |chef|
chef.cookbooks_path = "cookbooks"
chef.version = "12.4.0"
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "git"
chef.add_recipe "heroku-toolbelt"
chef.add_recipe "imagemagick"
chef.add_recipe "nginx"
chef.add_recipe "nodejs"
chef.add_recipe "nodejs::npm"
chef.add_recipe 'openssl'
chef.add_recipe "postgresql::server"
chef.add_recipe "python"
chef.add_recipe "python::pip"
chef.add_recipe "sqlite"
chef.add_recipe "vim"
chef.add_recipe 'redis'
chef.add_recipe 'rvm::system'
chef.add_recipe 'rvm::vagrant'
chef.add_recipe 'rvm::system'
chef.json =
{
nginx: {
:dir => "/etc/nginx",
:log_dir => "/var/log/nginx",
:binary => "/usr/sbin/nginx",
:user => "www-data",
:init_style => "runit",
:pid => "/var/run/nginx.pid",
:worker_connections => "1024"
},
postgresql: {
:config => {
:listen_addresses => "*",
:port => "5432"
},
:pg_hba => [
{
:type => "local",
:db => "postgres",
:user => "postgres",
:addr => nil,
:method => "trust"
},
{
:type => "host",
:db => "all",
:user => "all",
:addr => "0.0.0.0/0",
:method => "md5"
},
{
:type => "host",
:db => "all",
:user => "all",
:addr => "::1/0",
:method => "md5"
}
],
:password => {
:postgres => "password"
}
},
redis: {
:bind => "127.0.0.1",
:port => "6379",
:config_path => "/etc/redis/redis.conf",
:daemonize => "yes",
:timeout => "300",
:loglevel => "notice"
},
rvm: {
default_ruby: '2.2.2'
},
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment