Reputation: 395
I have an NFS share on my Vagrant VM. It works but it can't write files (Symfony2 app, needs to write to app/cache/prod/sessions).
If I use "non-NFS" shares it works, but is dog slow!
From within the guest VM, /var/www/fh-admin
is owned by user 501 group root, which I assume is a user on my host OS (OSX)?
Here is my Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'precise64'
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
#config.vm.network :private_network, ip: '192.168.33.12'
config.vm.network :private_network, ip: "101.0.0.101", :netmask => "255.255.0.0"
config.vm.boot_timeout = 60
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provision :ansible do |ansible|
ansible.limit = 'all'
ansible.sudo = true
ansible.playbook = '../fh-ansible/fh.yml'
ansible.inventory_path = 'inventory.ini'
ansible.verbose = "v"
end
config.vm.synced_folder '.', '/var/www/fh-admin', :nfs => { :mount_options => ["dmode=777","fmode=666"] }
config.vm.synced_folder '/var/www/surveyor-cordova/assets/www', '/var/www/fhapp', :nfs => { :mount_options => ["dmode=777","fmode=666"] }
config.vm.provider :vmware do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.provider "vmware_fusion" do |v|
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
end
end
Upvotes: 1
Views: 3429
Reputation: 2193
One option would be to not store session data within the NFS share. There's details on how to move it on this blog post by Benjamin Eberlei: http://www.whitewashing.de/2013/08/19/speedup_symfony2_on_vagrant_boxes.html. I think you can also specify the Symfony2 session dir independently though config if you don't want to go down that involved route.
Upvotes: 3
Reputation: 2178
Adapt this to your requirements:
config.vm.synced_folder "./", "/var/www/fh-admin", id: "unique-id", type: nil,
group: 'www-data', owner: 'www-data', mount_options: ["dmode=775", "fmode=764"]
This assumes the group/user www-data
exists within the box you are using.
This will work for non-NFS, and as far as I am aware NFS does not accept those extra flags (per mitchellh)
Upvotes: 1