On my windows 7 I use:
I have an ubuntu vagrant box with some PHP software (piwik) which on a specific CLI command does some processing which involves files. I've measured how long it takes for the command to complete on various types of sharing from guest (ubuntu) to host (win7):
config.vm.network "private_network", type: "dhcp"
and config.vm.synced_folder "piwik", "/web-pub/piwik", :nfs => true, :mount_options => ['actimeo=2']
)./tmp
, which is not shared.I confirm proportionally similar numbers on different tasks (e.g drush cc all
on a vanilla drupal 7 installation).
Do you know how can I make shared folders be faster than 5 seconds? I'd like to avoid rsync based solutions.
Vagrant file sharing is slow if you have thousands of files and vagrant mounts home directory by default so try disabling the default share:
config.vm.synced_folder ".", "/vagrant", disabled: true
You may try enabling FS Cache. I didn't see much difference enabled or not but left enabled anyway... Install cachefilesd
in the guest and add fsc
to the mount options:
config.vm.synced_folder "src/", "/mnt/project", type: "nfs",
mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
And you'll probably have permission issues with NFS, you can use bindfs plugin for that:
config.bindfs.bind_folder "/mnt/project", "/var/www/drupal",
owner: "www-data", group: "www-data"
Here's the final Vagrantfile
we use for drupal8 development:
["vagrant-bindfs", "vagrant-vbguest"].each do |plugin|
unless Vagrant.has_plugin?(plugin)
raise plugin + ' plugin is not installed. Hint: vagrant plugin install ' + plugin
end
end
Vagrant.configure("2") do |config|
config.vm.box = "geerlingguy/ubuntu1604"
# Shared folders
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder "src/", "/mnt/drupal", type: "nfs",
mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
config.bindfs.bind_folder "/mnt/drupal", "/opt/drupal",
owner: "www-data", group: "www-data"
config.vm.network "private_network", ip: "192.168.33.20"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With