Firewall Sync Options

What is the best way to implement Vagrant NFS "synchronized folders" between a host and a virtual machine?

Finally, I was able to get NFS to work, but it required a few settings on the VM; and I'm not sure how to automate these changes for other users.

In particular, I need to change the UID / GID in / etc / passwd and / etc / group so that they match the user / group identifiers of the exported file system. (for example, the host uses 502: 20, the apache VM user must be configured to use 502: 20)

Without this change, I have all sorts of permissions / property rights that prevent the web application from starting. With a UID / GID match, everything works fine.

I read all the documents I could find, including the Vagrant website.

As a side note: I also tried synchronizing the source folder (painfully slow) and rsync (100% CPU ... unusable)

NFS seems like a winner in performance, but my setup is sketchy.

If that matters, I work with the following:

  • Host: OS X 10.9.2
  • Tramp: 1.5.4
  • Supplier: VMware Fusion
  • Insert: chef / centos-6.5
  • Dev Application: Magento 1.8
+7
vagrant vagrantfile vmware-fusion nfs
source share
2 answers

In Vagrantfile you can assign nfs to the current uid / gid mapping. (See section Host / etc / exports after preparation.)

config.nfs.map_uid = Process.uid config.nfs.map_gid = Process.gid 

With Puppet, you can use these values ​​as a collateral:

  config.vm.provision :puppet, :facter => { "host_uid" => config.nfs.map_uid, "host_gid" => config.nfs.map_gid, } do |puppet| ... 

So, you can use it in puppet space, such as variables, for example.

 user { "www-data": ensure => present, uid => $::host_uid, gid => $::host_gid, } 

I think the chef's custom json option is the equivalent of using it later in the chef's recipes

 Vagrant.configure("2") do |config| config.vm.provision "chef_solo" do |chef| # ... chef.json = { "map" => { "uid" => config.nfs.map_uid, "gid" => config.nfs.map_gid } } end end 
+11
source share

bindfs

GitLab used bindfs before it rejected Vagrant as a development method.

There is a Vagrant plugin for it: https://github.com/gael-ian/vagrant-bindfs

Relevant Vagrantfile lines when the file is still part of the project :

 config.vm.synced_folder ".", "/vagrant", :disabled => true config.vm.synced_folder "./home_git", "/git-nfs", :nfs => true config.bindfs.bind_folder "/git-nfs", "/home/git", :owner => "1111", :group => "1111", :'create-as-user' => true, :perms => "u=rwx:g=rwx:o=rwx", :'create-with-perms' => "u=rwx:g=rwx:o=rwx", :'chown-ignore' => true, :'chgrp-ignore' => true, :'chmod-ignore' => true 
+5
source share

All Articles