2013-02-07 01:13:24 -05:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
2013-02-25 12:34:50 -05:00
|
|
|
# See https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md
|
2013-02-05 14:16:51 -05:00
|
|
|
#
|
2013-03-18 02:45:51 -04:00
|
|
|
Vagrant.configure("2") do |config|
|
2014-07-20 14:53:35 -04:00
|
|
|
config.vm.box = 'discourse-0.9.9.13'
|
2014-07-22 15:30:14 -04:00
|
|
|
config.vm.box_url = "https://d3fvb7b7auiut8.cloudfront.net/discourse-0.9.9.13.box"
|
2013-02-07 01:13:24 -05:00
|
|
|
|
|
|
|
# Make this VM reachable on the host network as well, so that other
|
|
|
|
# VM's running other browsers can access our dev server.
|
2013-03-18 02:45:51 -04:00
|
|
|
config.vm.network :private_network, ip: "192.168.10.200"
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-07 01:13:24 -05:00
|
|
|
# Make it so that network access from the vagrant guest is able to
|
|
|
|
# use SSH private keys that are present on the host without copying
|
|
|
|
# them into the VM.
|
|
|
|
config.ssh.forward_agent = true
|
|
|
|
|
2013-03-18 02:45:51 -04:00
|
|
|
config.vm.provider :virtualbox do |v|
|
2013-04-14 21:46:36 -04:00
|
|
|
# This setting gives the VM 1024MB of RAM instead of the default 384.
|
2013-04-10 16:57:34 -04:00
|
|
|
v.customize ["modifyvm", :id, "--memory", [ENV['DISCOURSE_VM_MEM'].to_i, 1024].max]
|
2013-02-07 01:13:24 -05:00
|
|
|
|
2014-07-22 19:44:14 -04:00
|
|
|
# Who has a single core cpu these days anyways?
|
|
|
|
cpu_count = 2
|
|
|
|
|
|
|
|
# Determine the available cores in host system.
|
|
|
|
# This mostly helps on linux, but it couldn't hurt on MacOSX.
|
|
|
|
if RUBY_PLATFORM =~ /linux/
|
|
|
|
cpu_count = `nproc`.to_i
|
|
|
|
elsif RUBY_PLATFORM =~ /darwin/
|
|
|
|
cpu_count = `sysctl -n hw.ncpu`.to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
# Assign additional cores to the guest OS.
|
|
|
|
v.customize ["modifyvm", :id, "--cpus", cpu_count]
|
|
|
|
v.customize ["modifyvm", :id, "--ioapic", "on"]
|
|
|
|
|
2013-03-18 02:45:51 -04:00
|
|
|
# This setting makes it so that network access from inside the vagrant guest
|
|
|
|
# is able to resolve DNS using the hosts VPN connection.
|
|
|
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
|
|
|
end
|
2013-02-07 01:13:24 -05:00
|
|
|
|
2013-03-18 02:45:51 -04:00
|
|
|
config.vm.network :forwarded_port, guest: 3000, host: 4000
|
|
|
|
config.vm.network :forwarded_port, guest: 1080, host: 4080 # Mailcatcher
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-26 17:12:31 -05:00
|
|
|
nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
|
2013-04-05 10:42:05 -04:00
|
|
|
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => nfs_setting
|
2013-02-07 14:09:57 -05:00
|
|
|
|
2013-07-30 22:30:40 -04:00
|
|
|
config.vm.provision :shell, :inline => "apt-get -qq update && apt-get -qq -y install ruby1.9.3 build-essential && gem install chef --no-rdoc --no-ri --conservative"
|
2013-02-07 14:09:57 -05:00
|
|
|
|
2013-07-30 22:30:40 -04:00
|
|
|
chef_cookbooks_path = ["chef/cookbooks"]
|
2013-02-07 14:09:57 -05:00
|
|
|
|
2013-07-30 22:30:40 -04:00
|
|
|
# This run uses the updated chef-solo and does normal configuration
|
2013-02-07 14:09:57 -05:00
|
|
|
config.vm.provision :chef_solo do |chef|
|
|
|
|
chef.binary_env = "GEM_HOME=/opt/chef/embedded/lib/ruby/gems/1.9.1/ GEM_PATH= "
|
|
|
|
chef.binary_path = "/opt/chef/bin/"
|
|
|
|
chef.cookbooks_path = chef_cookbooks_path
|
2013-07-30 22:30:40 -04:00
|
|
|
|
2013-02-07 14:09:57 -05:00
|
|
|
chef.add_recipe "recipe[apt]"
|
|
|
|
chef.add_recipe "recipe[build-essential]"
|
2013-02-26 17:12:31 -05:00
|
|
|
chef.add_recipe "recipe[vim]"
|
2013-03-21 18:51:18 -04:00
|
|
|
chef.add_recipe "recipe[java]"
|
2014-05-28 08:59:06 -04:00
|
|
|
chef.add_recipe "recipe[imagemagick]"
|
2013-07-30 22:30:40 -04:00
|
|
|
chef.add_recipe "discourse"
|
2013-02-07 14:09:57 -05:00
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|