From d72a8cef447acaa51cfa2ef95bce8fe184a66dc7 Mon Sep 17 00:00:00 2001 From: Randy Terbush Date: Sun, 11 Jan 2015 13:13:52 -0700 Subject: [PATCH] Add support for parallels provider and use NFS for shared filesystem. --- Vagrantfile | 57 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index eba6bb1..ae6c68e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -11,8 +11,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Every Vagrant virtual environment requires a box to build off of. config.vm.box = "ubuntu/trusty64" + # Using Ubuntu Server 14.04 (Trusty Tahr), supported by R + # if we are running parallels provider, use the following box + config.vm.provider "parallels" do |v, override| + override.vm.box = "parallels/ubuntu-14.04" + end + # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. @@ -25,7 +31,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Create a private network, which allows host-only access to the machine # using a specific IP. - config.vm.network "private_network", ip: "66.66.66.10" + config.vm.network "private_network", ip: "192.168.33.12" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on @@ -36,20 +42,32 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Default value: false # config.ssh.forward_agent = true - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - config.vm.synced_folder "./project/", "/www-shiny/", create: true - # The shiny:shiny user is created after provisioning using uid=999 and - # guid=999. Mounting "/www-shiny-writeable/" using the expected uid and guid - # as is done below allows us to mount the shared folder with shiny:shiny - # permissions before the shiny user is created. This method allows the Shiny - # server to write to the app folder below, but not the one above (whose user - # is vagrant). - config.vm.synced_folder "./writeable-project/", "/www-shiny-writeable/", - create: true, mount_options:["uid=999,gid=999"] - # Share the project folder to your Shiny web server folder + # config.vm.synced_folder "../data", "/vagrant_data" + hostos = RbConfig::CONFIG["host_os"].downcase + case hostos + when 'linux-gnu' + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder './project/', '/www-shiny/', :nfs => true, + :mount_options => ['rw', 'vers=3', 'tcp', 'nordirplus', 'nolock', 'local_lock=none'], + :create => true + # The shiny:shiny user is created after provisioning using uid=999 and + # guid=999. Mounting "/www-shiny-writeable/" using the expected uid and guid + # as is done below allows us to mount the shared folder with shiny:shiny + # permissions before the shiny user is created. This method allows the Shiny + # server to write to the app folder below, but not the one above (whose user + # is vagrant). + config.vm.synced_folder './writeable-project/', '/www-shiny-writeable/', + :nfs => true, :mount_options => ['rw', 'vers=3', 'tcp', 'nordirplus', + 'nolock', 'local_lock=none'], :create => true + # Share the project folder to your Shiny web server folder + else + config.vm.synced_folder './project/', '/www-shiny/', :nfs => true, :create => true + config.vm.synced_folder './writeable-project/', '/www-shiny-writeable/', :nfs => true, + :create => true + end # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. @@ -63,6 +81,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vb.customize ["modifyvm", :id, "--memory", "1536"] end # + config.vm.provider "parallels" do |vb| + # # Don't boot with headless mode + # vb.gui = true + # + # # Use VBoxManage to customize the VM. For example to change memory: + vb.update_guest_tools = true + vb.memory = 1536 + end + # # View the documentation for the provider you're using for more # information on available options.