Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.bindfs.default_options not working as expected #12

Closed
MuschPusch opened this issue Apr 29, 2014 · 6 comments
Closed

config.bindfs.default_options not working as expected #12

MuschPusch opened this issue Apr 29, 2014 · 6 comments

Comments

@MuschPusch
Copy link

I added the following lines to my Vagrantfile

  • config.bindfs.default_options
  • :'chmod-ignore'
    
  • :'chown-ignore'
    
  • :'chgrp-ignore'
    

I use bindfs since i have an application which needs to change the permission on the shared folder. When doing a command line:

$ chmod 775 platforms # works

When php -> chmod is triggering the change i get an Operation not permitted

@tboerger
Copy link
Contributor

tboerger commented Oct 8, 2014

How do you use PHP? Maybe PHP is running with the webserver user and is simply not allowed to change the permissions of the file. If you are doing it on the shell it is mostly a different thing.

@MuschPusch
Copy link
Author

Switched away from bindfs, since i don't need it anymore. So let's close this one...

@schoren
Copy link

schoren commented Aug 6, 2015

I'm having the same issue using Nginx and PHP-FPM over an ubuntu guest, Mac host.
Any help?

@gael-ian
Copy link
Owner

gael-ian commented Aug 6, 2015

Hello. Can you post a gist with your Vagrantfile and a sample of your PHP code ?

@gael-ian gael-ian reopened this Aug 6, 2015
@schoren
Copy link

schoren commented Aug 7, 2015

Here's my Vagrantfile.

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Throw an error if required Vagrant plugins are not installed
plugins = { 'vagrant-bindfs' => nil }

plugins.each do |plugin, version|
  unless Vagrant.has_plugin? plugin
    error = "The '#{plugin}' plugin is not installed! Try running:\nvagrant plugin install #{plugin}"
    error += " --plugin-version #{version}" if version
    raise error
  end
end


# You can ask for more memory and cores when creating your Vagrant machine:
# VAGRANT_MEMORY=2048 VAGRANT_CORES=4 vagrant up
MEMORY = ENV['VAGRANT_MEMORY'] || '1024'
CORES = ENV['VAGRANT_CORES'] || '2'

# Determine if we need to forward ports
FORWARD = ENV['GITLAB_VAGRANT_FORWARD'] || '1'

Vagrant.configure("2") do |config|
  config.vm.hostname = "ssp-dev"

  config.vm.box = "ubuntu/trusty64"

  # Assign this VM to a host-only network IP, allowing you to access it
  # via the IP. Host-only networks can talk to the host machine as well as
  # any other machines on the same network, but cannot be accessed (through this
  # network interface) by any external networks.
  config.vm.network :private_network, ip: "192.168.3.4"

  if FORWARD.to_i > 0
    config.vm.network :forwarded_port, guest: 3306, host: 3336
    config.vm.network :forwarded_port, guest: 80, host: 8000
  end

  # Remove the default Vagrant directory sync
  config.vm.synced_folder ".", "/vagrant", disabled: true

  # Sync the 'vagrant' directory on the host to /gitlab on guest
  # Use NFS on Linux/OS X and SMB on Windows
  config.nfs.map_uid = Process.uid
  config.nfs.map_gid = Process.gid

  if Vagrant::Util::Platform.windows?
    config.vm.synced_folder ".", "/vagrant", create: true
    config.vm.synced_folder "../app", "/var/www", create: true
  else
    config.vm.synced_folder ".", "/vagrant-nfs", :create => true, :nfs => true
    config.bindfs.bind_folder "/vagrant-nfs", "/vagrant", :owner => "vagrant", :group => "vagrant", :'create-as-user' => true, :perms => "u=rwx:g=rwx:o=rD", :'create-with-perms' => "u=rwx:g=rwx:o=rD", :'chown-ignore' => true, :'chgrp-ignore' => true, :'chmod-ignore' => true

    config.vm.synced_folder "../app", "/www-nfs", :create => true, :nfs => true
    config.bindfs.bind_folder "/www-nfs", "/var/www", :owner => "vagrant", :group => "www-data", :'create-as-user' => true, :perms => "u=rwx:g=rwx:o=rD", :'create-with-perms' => "u=rwx:g=rwx:o=rD", :'chown-ignore' => true, :'chgrp-ignore' => true, :'chmod-ignore' => true
  end

  config.vm.provider :virtualbox do |v|
    # Use VBoxManage to customize the VM. For example to change memory:
    v.customize ["modifyvm", :id, "--memory", MEMORY.to_i]
    v.customize ["modifyvm", :id, "--cpus", CORES.to_i]

    if CORES.to_i > 1
      v.customize ["modifyvm", :id, "--ioapic", "on"]
    end
  end

  # Provision with shell
  config.vm.provision :shell, path: "bootstrap.sh"
end

The error is not happening within my app code. It's happening within Symfony's cache code. If I run a command (such as cache:clear) it works ok. However, when running from the web server, it fails.

Originally, I set Nginx and PHP-FPM to run with the www-data user. Then, I made www-data group the main group for the user vagrant (the one I use when I ssh). The permissions are set with a 022 umask, so anyone with group www-data would be able to write.

As a workaround, I have changed both Nginx and PHP-FPM to run as vagrant. This works, but it's not an elegant solution.

Thanks!

@gael-ian
Copy link
Owner

After reading the chmod function footnotes in the PHP documentation, I don't think this is a bindfs or vagrant-bindfs problem but a normal behavior of PHP.

mpdude referenced this issue in doctrine/orm Sep 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants