2013-02-07 14:13:24 +08:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
2013-02-26 01:34:50 +08:00
|
|
|
# See https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md
|
2013-02-06 03:16:51 +08:00
|
|
|
#
|
2013-03-18 14:45:51 +08:00
|
|
|
Vagrant.configure("2") do |config|
|
2013-03-20 01:39:16 +08:00
|
|
|
config.vm.box = 'discourse-0.8.4'
|
|
|
|
config.vm.box_url = 'http://www.discourse.org/vms/discourse-0.8.4.box'
|
2013-02-07 14:13:24 +08: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 14:45:51 +08:00
|
|
|
config.vm.network :private_network, ip: "192.168.10.200"
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-02-07 14:13:24 +08: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 14:45:51 +08:00
|
|
|
config.vm.provider :virtualbox do |v|
|
|
|
|
# This setting gives the VM 1024MB of MEMORIES instead of the default 384.
|
|
|
|
v.customize ["modifyvm", :id, "--memory", 1024]
|
2013-02-07 14:13:24 +08:00
|
|
|
|
2013-03-18 14:45:51 +08: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 14:13:24 +08:00
|
|
|
|
2013-03-18 14:45:51 +08:00
|
|
|
config.vm.network :forwarded_port, guest: 3000, host: 4000
|
|
|
|
config.vm.network :forwarded_port, guest: 1080, host: 4080 # Mailcatcher
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2013-02-27 06:12:31 +08:00
|
|
|
nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
|
2013-03-18 14:45:51 +08:00
|
|
|
config.vm.synced_folder ".", "/vagrant", :nfs => nfs_setting
|
2013-02-08 03:09:57 +08:00
|
|
|
|
|
|
|
chef_cookbooks_path = ["chef/cookbooks"]
|
|
|
|
|
|
|
|
# The first chef run just upgrades the chef installation using omnibus
|
|
|
|
config.vm.provision :chef_solo do |chef|
|
|
|
|
chef.binary_env = "GEM_HOME=/opt/vagrant_ruby/lib/ruby/gems/1.8/ GEM_PATH= "
|
|
|
|
chef.binary_path = "/opt/vagrant_ruby/bin/"
|
|
|
|
chef.cookbooks_path = chef_cookbooks_path
|
|
|
|
chef.add_recipe "recipe[omnibus_updater]"
|
2013-02-13 00:18:59 +08:00
|
|
|
chef.add_recipe "discourse"
|
2013-02-08 03:09:57 +08:00
|
|
|
chef.json = { :omnibus_updater => { 'version_search' => false }}
|
|
|
|
end
|
|
|
|
|
|
|
|
# The second chef run uses the updated chef-solo and does normal configuration
|
|
|
|
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
|
|
|
|
chef.add_recipe "recipe[apt]"
|
|
|
|
chef.add_recipe "recipe[build-essential]"
|
2013-02-27 06:12:31 +08:00
|
|
|
chef.add_recipe "recipe[vim]"
|
2013-03-22 06:51:18 +08:00
|
|
|
chef.add_recipe "recipe[java]"
|
2013-02-08 03:09:57 +08:00
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|