diff --git a/README.md b/README.md index 77f2f1e..7680a82 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,21 @@ from within your `Vagrantfile`: Vagrant.configure("2") do |config| config.vm.box = 'your-box' if Vagrant.has_plugin?("vagrant-cachier") + # Enable cache buckets auto detection config.cache.auto_detect = true - # If you are using VirtualBox, you might want to enable NFS for shared folders - # config.cache.enable_nfs = true - # You can pass extra mount options, for example: - # config.cache.sync_opts = {:create = true} + + # 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 end ``` @@ -43,6 +53,7 @@ http://fgrehm.viewdocs.io/vagrant-cachier. * [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc) * [VMware providers](http://www.vagrantup.com/vmware) with NFS enabled (See [GH-24](https://github.com/fgrehm/vagrant-cachier/issues/24) for more info) +* [vagrant-libvirt](https://github.com/pradels/vagrant-libvirt) ## Contributing diff --git a/docs/index.md b/docs/index.md index 913eb05..394541f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -24,9 +24,24 @@ from within your `Vagrantfile`: Vagrant.configure("2") do |config| config.vm.box = 'your-box' if Vagrant.has_plugin?("vagrant-cachier") + # Enable cache buckets auto detection config.cache.auto_detect = true - # If you are using VirtualBox, you might want to enable NFS for shared folders - # config.cache.enable_nfs = true + + # You can pass in extra mount options for your cache buckets + # from http://docs.vagrantup.com/v2/synced-folders/basic_usage.html + config.cache.synced_folder_opts = { create: true } + + # 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'] + } end end ``` @@ -40,6 +55,7 @@ For more information please check out the links on the menu above. * [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc) * [VMware providers](http://www.vagrantup.com/vmware) with NFS enabled (See [GH-24](https://github.com/fgrehm/vagrant-cachier/issues/24) for more info) +* [vagrant-libvirt](https://github.com/pradels/vagrant-libvirt) ## Contributing diff --git a/docs/usage.md b/docs/usage.md index d0538a0..41a27a7 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -4,9 +4,9 @@ This is the easiest way to get started with plugin. By adding the code below to your `Vagrantfile` you can enable automatic detection of supported cache _buckets_. -It is a good practise to wrap plugin specific configuration with `has_plugin?` checks -so the user's Vagrantfiles do not break if plugin is uninstalled or Vagrantfile shared -with people not having the plugin installed. +It is a good practice to wrap plugin specific configuration with `has_plugin?` checks +so the user's Vagrantfiles do not break if vagrant-cachier is uninstalled or +the Vagrantfile is shared with people that do not have the plugin installed. ```ruby Vagrant.configure("2") do |config| @@ -17,7 +17,7 @@ Vagrant.configure("2") do |config| end ``` -This will make vagrant-cachier do its best to find out what is supported on the +This will make `vagrant-cachier` do its best to find out what is supported on the guest machine and will set buckets accordingly. ## Enable buckets as needed @@ -35,6 +35,28 @@ end _Please refer to the "Available Buckets" menu above to find out which buckets are supported._ +## Custom cache buckets synced folders options + +For fine grained control over the cache bucket synced folder options you can use +the `synced_folder_opts` config. That's useful if, for example, you are using +VirtualBox and want to enable NFS for improved performance: + +```ruby +Vagrant.configure("2") do |config| + 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'] + } +end +``` + +Please referer to http://docs.vagrantup.com/v2/synced-folders/basic_usage.html for +more information about the supported parameters. + ## Cache scope By default downloaded packages will get stored on a folder scoped to base boxes