Permalink
Browse files

Support for vagrantconfig{_local}.yaml inspired by Mozillians

  • Loading branch information...
1 parent ce1acfd commit 6bff9edddf0c80de2dd8c426cdc719ee40edcb33 @lmorchard lmorchard committed Dec 8, 2011
Showing with 64 additions and 28 deletions.
  1. +33 −28 Vagrantfile
  2. +12 −0 vagrantconfig.yaml
  3. +19 −0 vagrantconfig_local.yaml-dist
View
@@ -1,45 +1,50 @@
-#
-# Vagrant setup for Kuma
-#
-Vagrant::Config.run do |config|
-
- # This should get you a mostly ready-baked base box
- config.vm.box = "kuma"
- config.vm.box_url = "http://people.mozilla.com/~lorchard/vm/kuma.box"
- config.package.name = "kuma.box"
+require "yaml"
+
+# Load up our vagrant config files -- vagrantconfig.yaml first
+_config = YAML.load(File.open(File.join(File.dirname(__FILE__),
+ "vagrantconfig.yaml"), File::RDONLY).read)
+
+# Local-specific/not-git-managed config -- vagrantconfig_local.yaml
+begin
+ _config.merge!(YAML.load(File.open(File.join(File.dirname(__FILE__),
+ "vagrantconfig_local.yaml"), File::RDONLY).read))
+rescue Errno::ENOENT # No vagrantconfig_local.yaml found -- that's OK; just
+ # use the defaults.
+end
- # Here's a box built with a not-too-old import included
- # config.vm.box = "kuma-with-data"
- # config.vm.box_url = "http://people.mozilla.com/~lorchard/vm/kuma-with-data.box"
- # config.package.name = "kuma-with-data.box"
+CONF = _config
+MOUNT_POINT = "/vagrant"
- # To rebuild from mostly scratch, use this CentOS 5.6 (32 bit) image:
- # config.vm.box = "centos-56-32"
- # config.vm.box_url = "http://people.mozilla.com/~lorchard/vm/centos-56-32.box"
+Vagrant::Config.run do |config|
- # Plain old VirtualBox shared folder in use here:
- config.vm.share_folder("v-root", "/vagrant", ".")
+ config.vm.box = CONF['box']
+ config.vm.box_url = CONF['box_url']
+ config.package.name = CONF['package_name']
- # On OS X and Linux you can use an NFS mount; virtualbox shared folders are slow.
- # see also: http://vagrantup.com/docs/nfs.html
- # config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
+ # nfs needs to be explicitly enabled to run.
+ if CONF['nfs'] == false or RUBY_PLATFORM =~ /mswin(32|64)/
+ config.vm.share_folder("v-root", MOUNT_POINT, ".")
+ else
+ config.vm.share_folder("v-root", MOUNT_POINT, ".", :nfs => true)
+ end
# This thing can be a little hungry for memory
config.vm.customize do |vm|
- vm.memory_size = 768
+ vm.memory_size = CONF['memory_size']
+ end
+
+ # uncomment to enable VM GUI console, mainly for troubleshooting
+ if CONF['gui'] == true
+ config.vm.boot_mode = :gui
end
+ config.vm.network(CONF['ip_address'])
+
# Increase vagrant's patience during hang-y CentOS bootup
# see: https://github.com/jedi4ever/veewee/issues/14
config.ssh.max_tries = 50
config.ssh.timeout = 300
- # uncomment to enable VM GUI console, mainly for troubleshooting
- #config.vm.boot_mode = :gui
-
- # Add to /etc/hosts: 192.168.10.55 developer-dev.mozilla.org
- config.vm.network("192.168.10.55")
-
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "dev-vagrant.pp"
View
@@ -0,0 +1,12 @@
+# Default config for Vagrant
+#
+# Don't change this; use vagrantconfig_local.yaml to override these settings
+# instead.
+
+nfs: false
+gui: false
+ip_address: 192.168.10.55
+memory_size: 768
+box: "kuma"
+box_url: "http://people.mozilla.com/~lorchard/vm/kuma.box"
+package_name: "kuma.box"
@@ -0,0 +1,19 @@
+# Local configuration for Vagrant
+
+# On OS X and Linux you can use an NFS mount; virtualbox shared folders are slow.
+# see also: http://vagrantup.com/docs/nfs.html
+nfs: true
+gui: true
+
+# Add to /etc/hosts: 192.168.10.55 developer-dev.mozilla.org
+ip_address: 192.168.10.55
+
+# This can get you a base box with MDN data already imported
+# box: "kuma-with-data"
+# box_url: "http://people.mozilla.com/~lorchard/vm/kuma-with-data.box"
+# package_name: "kuma-with-data.box"
+
+# Here be dragons: Use this base box to rebuild from scratch atop an almost
+# bare OS.
+# box: "centos-56-32"
+# box_url: "http://people.mozilla.com/~lorchard/vm/centos-56-32.box"

0 comments on commit 6bff9ed

Please sign in to comment.