Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Windows and vagrant-cachier #736

Closed
morsok opened this issue Jun 14, 2016 · 6 comments
Closed

Windows and vagrant-cachier #736

morsok opened this issue Jun 14, 2016 · 6 comments

Comments

@morsok
Copy link

morsok commented Jun 14, 2016

Hello,

If you have vagrant-cachier, the Vagrantfile totally ignores the synced folder type and tries to use NFS.

However it will not work since you are on windows !

I think there is two solutions here, either use the provided type (by config.yml) if possible, or ignore the vagrant-cachier configuration if the provided type is not 'nfs'

I had to delete the vagrant-cachier plugin as a workaround on the windows hosts to make the vm work.

@geerlingguy
Copy link
Owner

Hmm... I hadn't thought about that when adding the config. I'm testing a fix now that will simply use the same sync type as the default folder—e.g. vagrant_synced_folder_default_type. So if you have cachier on Windows, you can change that setting to ``or tosmb.

@geerlingguy
Copy link
Owner

Though for compatibility, we could just drop the entire config.cache.synced_folder_opts setting...

See: https://github.com/fgrehm/vagrant-cachier/blob/master/docs/usage.md#custom-cache-buckets-synced-folders-options

@geerlingguy
Copy link
Owner

I'm going to drop the config for now—trying to change the mount_options in addition to the default type based on whether it's set to 'nfs' or '' is making the code a little uglier, and the performance benefit for this particular directory (the apt/composer/etc. cache) is minimal at best. Plus, if you really want to eke out a tiny bit better performance, you can still add in the config.cache.synced_folder_opts in a Vagrantfile.local.

Testing, then will push this up.

@geerlingguy
Copy link
Owner

@morsok - Can you see if the latest master version of Drupal VM works for you?

@morsok
Copy link
Author

morsok commented Jun 15, 2016

Yeah I agree that the performance isn't really significant here.

Thank you for your diligence !

I'll try to bother my team mate to test the master on his windows machine (I don't know if I can get a license key to test it myself ? any idea ?)

@salecharohit
Copy link

salecharohit commented Jan 2, 2020

i used this plugin https://github.com/winnfsd/vagrant-winnfsd and now cachier works like a charm on Windows 10 WSL
Here is the required portion of my vagrantfile

  required_plugins = %w(vagrant-disksize vagrant-hostmanager vagrant-vbguest vagrant-clean vagrant-cachier)
  plugin_installed = false
  required_plugins.each do |plugin|
    unless Vagrant.has_plugin?(plugin)
      system "vagrant plugin install #{plugin}"
      if Vagrant::Util::Platform.windows?
        system "vagrant plugin install vagrant-winnfsd"  
      end
      plugin_installed = true
    end
  end

  # If new plugins installed, restart Vagrant process
  if plugin_installed === true
    exec "vagrant #{ARGV.join' '}"
  end

  config.vm.box = 'ubuntu/bionic64'
  if Vagrant.has_plugin?("vagrant-cachier")
    # Configure cached packages to be shared between instances of the same base box.
    # More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
    config.cache.scope = :box
    # OPTIONAL: If you are using VirtualBox, you might want to use that to enable
    # NFS for shared folders. This is also very useful for vagrant-libvirt if you
    # want bi-directional sync
    config.cache.synced_folder_opts = {
      type: :nfs,
      # The nolock option can be useful for an NFSv3 client that wants to avoid the
      # NLM sideband protocol. Without this option, apt-get might hang if it tries
      # to lock files needed for /var/cache/* operations. All of this can be avoided
      # by using NFSv4 everywhere. Please note that the tcp option is not the default.
      mount_options: ['rw', 'vers=3', 'tcp', 'nolock']
    }
    # For more information please check http://docs.vagrantup.com/v2/synced-folders/basic_usage.html
  end
  config.vm.synced_folder ".", "/vagrant", type: "nfs"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants