Reputation: 2148
I'm using vagrant to run a wordpress dev environment on my local machine, have setup nfs as the default file-sharing mechanism (I'm on a mac). Overall performance is really good except for one thing: sync latency.
I have set up grunt watchers on the guest to recompile css / javascript as well as livereload the page on every file change. However when I save a file on the host: it takes between 1 and 10 second before syncing on the guest.
I'd like to be able to hit save on the host, and see changes being reflected on the guest immediately, which would then trigger the grunt watcher to do all the things I need it to do.
Is there a way to achieve this? Hack to force sync some files with grunt maybe? I've tried rsync and it seemed even worse latency wise.
Thanks
Upvotes: 8
Views: 3836
Reputation: 2148
Found the answer here https://github.com/mitchellh/vagrant/issues/4204#issuecomment-49856008
Just add mount options to the nfs share in Vagrantfile, this will make nfs sharing sync almost instantly on every save (<500ms).
config.vm.synced_folder "www/", "/srv/www/", :type => "nfs", mount_options:['nolock,vers=3,udp,noatime,actimeo=1']
Upvotes: 18