mhallin / vagrant-notify-forwarder

A file system event forwarding plugin for Vagrant
MIT License
152 stars 18 forks source link

Isn't working reliability #15

Open madhavajay opened 7 years ago

madhavajay commented 7 years ago

It seems quite unreliable. I can get this to work sometimes with inotify but after a few events it stops. I also tried watchman from Facebook which uses inotify but can't seem to get any events. I don't see any errors on startup it says that its creating the ports etc

My setup is: Host: OSX 10.12 Sierra

Vagrant 1.8.7 Guest: CentOS 7

File Mount Type: NFS

Vagrant plugins: landrush (1.2.0) vagrant-notify-forwarder (0.5.0) vagrant-scp (0.5.7) vagrant-share (1.1.6, system) vagrant-vbguest (0.13.0)

It's a pity because I cannot find any other solution for easily monitoring changes to a mounted dir and acting on it.

Vagrant Startup output:

==> guest1: [landrush] adding machine entry: mydomain.dev => 10.0.7.101
[landrush] Using eth1 (10.0.7.101)
[landrush] Host DNS resolver config looks good.
==> guest1: Rsyncing folder: ~MyUser/dir/ => /vagrant
==> guest1: Exporting NFS shared folders...
==> guest1: Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
==> guest1: Mounting NFS shared folders...
==> guest1: Notify-forwarder: Downloading client
==> guest1: Starting notify-forwarder ...
    guest1: Notify-forwarder: guest listening for file change notifications on 0.0.0.0:29324.
==> guest1: Notify-forwarder: Downloading client
    guest1: Notify-forwarder: host sending file change notifications to 127.0.0.1:29324
    guest1: Notify-forwarder: host forwarding notifications on ~MyUser/dir/ to /vagrant
    guest1: Notify-forwarder: host sending file change notifications to 127.0.0.1:29324
    guest1: Notify-forwarder: host forwarding notifications on ~MyUser/dir/ to /data
==> guest1: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> guest1: flag to force provisioning. Provisioners marked to run always will still run.

Vagrant file

guest_nodes = 1

  (1..guest_nodes).each do |machine_id|
    config.vm.define "guest#{machine_id}" do |guest|
      guest.vm.box = "centos/7"
      guest.vm.box_check_update = false

      guest.landrush.enabled = true
      guest.landrush.guest_redirect_dns = false
      guest.landrush.tld = "mydomain.dev"
      guest.vm.hostname = "guest#{machine_id}.mydomain.dev"
      guest.vm.network :private_network, ip: "10.0.7.#{100+machine_id}"

      guest.vm.synced_folder ".", "/data", type: "nfs"

      guest.vm.provider "virtualbox" do |vb|
        vb.memory = "2048"
        vb.cpus = "1"
        vb.name = "guest#{machine_id}"
      end
    end
  end

Any ideas?

madhavajay commented 7 years ago

Okay, so it seems like whats happening for me is i'm only getting the ATTRIB events when a file is touched or edited or deleted.

On the guest OS I am using lnotifyd and currently hooking into the ATTRIB call with:

onAttrib = prefix..[[rm -rf ^targetPathdir && cp -r ^sourcePathdir ^targetPathdir]],

Which is sub par as you can imagine, since its deleting and copying the entire dir but its the only way to handle a file being renamed or deleted.

Is the problem perhaps on the OS X notify-forwarder side not getting the events properly?

alex-left commented 7 years ago

Seems like after mac os 10.12.5 the plugin don't forwarding changes

stevenmccord commented 7 years ago

I am on oxX 10.12.6 and I get ATTRIB events for changes, adds. But nothing for deletes. Are other seeing that?