discourse/Vagrantfile

49 lines
1.8 KiB
Plaintext
Raw Normal View History

# -*- 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
#
Vagrant.configure("2") do |config|
config.vm.box = 'discourse-16.04'
2016-06-02 13:13:18 -04:00
config.vm.box_url = "https://www.dropbox.com/s/2132770g1e05c6d/discourse.box?dl=1"
# Make this VM reachable on the host network as well, so that other
# VM's running other browsers can access our dev server.
config.vm.network :private_network, ip: "192.168.10.200"
2013-02-05 14:16:51 -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
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.
v.customize ["modifyvm", :id, "--memory", [ENV['DISCOURSE_VM_MEM'].to_i, 1024].max]
# 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"]
# 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
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
nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root"
2013-02-05 14:16:51 -05:00
end