0
votes

I'm developing a WordPress site with Vagrant box "vccw-team/xenial64", which can be found at vccw.cc. The website was slow with waiting times that average around 5 seconds, did some googling and many people where pointing at Vagrants synced folder wich is slow in combination with Virtualbox. The solution: nfs. Nfs doesn't exist on Windows so that gave rise to the Vagrant plugin winnfsd.

I installed the plugin and changed the Vagrantfile as such:

  config.vm.network :private_network, ip: "192.168.33.10"

  config.vm.synced_folder _conf['synced_folder'],
      _conf['document_root'], :create => "true", :mount_options => ['dmode=755', 'fmode=644'], type: "nfs"

On vagrant up, I receive this message:

==> vccw.dev: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp,dmode=755,fmode=644 192.168.33.1:/D/_projects/Vagrant/vccw/wordpress /var/www/html

Stdout from the command:



Stderr from the command:

mount.nfs: an incorrect mount option was specified

I guess the portion 192.168.33.1:/D/_projects/Vagrant/vccw/wordpress might be wrong because D/_projects/Vagrant/vccw/wordpress exist on the host and not on the guest (192.168.33.1).

Other people managed to get the plugin working. Does anyone know what I'm doing wrong?

Versions:

  • Vagrant: 2.0.0
  • vagrant-winnfsd: 1.3.1
  • Virtualbox: 5.1.26 r117224 (Qt5.6.2)
1
from doc they say A private dhcp network is required for NFS to work (on Windows hosts, at least) did you try to enable a dhcp network ?Frederic Henri
I tried it but got this message: "NFS requires a host-only network to be created. Please add a host-only network to the machine (with either DHCP or a static IP) for NFS to work".progonkpa
config.vm.network "private_network", type: "dhcp"Frederic Henri

1 Answers

0
votes

I enabled DHCP in Vagrantfile like so:

  config.vm.network :private_network,  ip: "192.168.33.11",  type: "dhcp"

But that resulted in the error:

NFS requires a host-only network to be created. Please add a host-only network to the machine (with either DHCP or a static IP) for NFS to work

Then I read in another question on StackOverflow that one can configure a host-only network by using the code below in the Vagrantfile:

  config.vm.network :private_network,  ip: "192.168.33.11"
  config.vm.network :public_network,  ip: "192.168.44.12"

  config.vm.synced_folder _conf['synced_folder'],
      _conf['document_root'], type: "nfs"

I think 192.168.44.0 255.255.255.0 is now the hosted network, derived from ip: "192.168.44.12". It work's now and my WordPress site is faster with a loading time that averages around 3 seconds. I appreciate the improvement but I'll be hawking for other tweaks.

Extra info, the output of ifconfig in the guest:

vagrant@vccw:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:a8:df:8b
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fea8:df8b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:788 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:277602 (277.6 KB)  TX bytes:97056 (97.0 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:da:65:a0
          inet addr:192.168.33.11  Bcast:192.168.33.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feda:65a0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12461 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7004 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10059912 (10.0 MB)  TX bytes:2671763 (2.6 MB)

enp0s9    Link encap:Ethernet  HWaddr 08:00:27:62:47:ec
          inet addr:192.168.44.12  Bcast:192.168.44.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe62:47ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18654 (18.6 KB)  TX bytes:648 (648.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:1658 (1.6 KB)  TX bytes:1658 (1.6 KB)