From 3c19097b815975c735e8d632f5a4ced946b296e0 Mon Sep 17 00:00:00 2001 From: Ilya Rogov Date: Sat, 26 Jul 2014 13:35:27 +0400 Subject: [PATCH] added environment variables --- README.md | 8 ++++++++ Vagrantfile | 23 +++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd94a15..23bf50f 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,14 @@ Clone this repository Place your website in the `public` folder +## Environment variables + +```bash +VM_MEMORY=512 +VM_CORES=1 +VM_ARCH=32 +``` + ## Usage Start the VM diff --git a/Vagrantfile b/Vagrantfile index dd2e317..60c8146 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,6 +1,13 @@ # -*- mode: ruby -*- # vi: set ft=ruby : +# Environment variables +################################# + +MEMORY = ENV['VM_MEMORY'] || '512' +CORES = ENV['VM_CORES'] || '1' +ARCH = ENV['VM_ARCH'] || '32' + # General project settings ################################# @@ -26,12 +33,24 @@ Vagrant.configure("2") do |config| config.omnibus.chef_version = :latest # Define VM box to use - config.vm.box = "precise32" - config.vm.box_url = "http://files.vagrantup.com/precise32.box" + config.vm.box = "precise#{ARCH}" + config.vm.box_url = "http://files.vagrantup.com/precise#{ARCH}.box" # Set share folder config.vm.synced_folder "./" , "/var/www/" + project_name + "/", :mount_options => ["dmode=777", "fmode=666"] + # Provider-specific configuration so you can fine-tune VirtualBox for Vagrant. + # These expose provider-specific options. + config.vm.provider :virtualbox do |vm| + # Use VBoxManage to customize the VM. For example to change memory: + vm.customize ["modifyvm", :id, "--memory", MEMORY.to_i] + vm.customize ["modifyvm", :id, "--cpus", CORES.to_i] + + if CORES.to_i > 1 + vm.customize ["modifyvm", :id, "--ioapic", "on"] + end + end + # Use hostonly network with a static IP Address and enable # hostmanager so we can have a custom domain for the server # by modifying the host machines hosts file