From f23fea375cad94dd1ae2d21f6eefd6bb0453951f Mon Sep 17 00:00:00 2001 From: James Rogers Date: Fri, 11 Aug 2017 15:51:05 +0100 Subject: [PATCH] [rsync] Enable rsync --- .vagrantplugins | 1 + Vagrantfile | 15 ++++++++++++++- config.rb-dist | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.vagrantplugins b/.vagrantplugins index 6e0378f..ddc5a01 100644 --- a/.vagrantplugins +++ b/.vagrantplugins @@ -7,6 +7,7 @@ required_plugins = { 'vagrant-useradd' => '0.0.1', 'vagrant-bindfs' => '1.0.8', 'vagrant-persistent-storage' => '0.0.33', + 'vagrant-gatling-rsync' => '~>0.9.0', } needs_restart = false diff --git a/Vagrantfile b/Vagrantfile index 752dd85..60979d0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -8,6 +8,7 @@ packaging_mode = false forward_ssh_agent = false vm_name = "precip" use_packaged_precip = false +rsync = false # Determine if this is our first boot or not. # If there's a better way to figure this out we now have a single place to change. @@ -78,7 +79,19 @@ Vagrant.configure(2) do |config| config.ssh.forward_agent = forward_ssh_agent # Synced Folders - if Vagrant::Util::Platform.windows? + if rsync + # For large codebases, rsync is *far* more performant than NFS. + config.vm.synced_folder drupal_basepath, "/srv/www", type: "rsync", rsync__exclude: [".git/", "*.sql", "db/", "**/sites/*/files"], owner: "vagrant", group: "www-data" + # Vagrant's own rsync plugin is absurdly slow to sync, so use Gatling instead: + # https://github.com/smerrill/vagrant-gatling-rsync + # Configure the window for gatling to coalesce writes. + if Vagrant.has_plugin?("vagrant-gatling-rsync") + config.gatling.latency = 1 + config.gatling.time_format = "%H:%M:%S" + # Automatically sync when machines with rsync folders come up. + config.gatling.rsync_on_startup = true + end + elsif Vagrant::Util::Platform.windows? # Windows gets vboxsf, because it can't do nfs + bindfs config.vm.synced_folder drupal_basepath, "/srv/www", owner: "www-data", group: "www-data" else diff --git a/config.rb-dist b/config.rb-dist index c9fe8a8..6ad2474 100644 --- a/config.rb-dist +++ b/config.rb-dist @@ -101,6 +101,10 @@ # # vm_name = "not-precip" +# Use rsync instead of NFS for site files. This can improve performance on larger sites. +# +# rsync = true + # We offer a partially pre-built version of the Precip Base Box, which ships with # all keys and base packages pre-installed, so all that's left is installing PHP, # Apache, MySQL, and Configuring everything. This can help on restrictive networks