Vagrant 2 way folder synchronization

I installed a Vagrant window that launches my web server to host my Symfony2 application. Everything works fine except for folder synchronization.

I tried 2 things:

  • config.vm.synced_folder LOCALFOLDER, HOSTFOLDER
  • config.vm.synced_folder LOCALFOLDER, HOSTFOLDER, type = "rsync"

Option 1 . The first parameter works, I really don't know how the file is divided, but it works. Files are copied in both directions, but the application is SUPER slow. Symfony creates cache files, which can be a problem, but I don’t know how to fix this problem and see what happens.

Option 2: Synchronization is performed in only one way (from my local computer to a stray block), which covers most of the case and works quickly. The problem is that when I use the symfony command line in a stray field to generate some files, they are not copied to my local machine.

My question is: What is the best way to sync two ways? With option 1, how can I (as it may be due to a problem) exclude some files from synchronization. With Option 2, how can I make sure that the changes on the remote computer are copied to my local computer?

Thank!

+4
source share
3 answers

, Vagrant "" , :

+3

( VirtualBox, ), , , , :

  • Linux Mac OS X, NFS.
  • Windows, SMB.

Rsync , , , .

+5

Vagrant mounts your project root directory as a /vargrantfolder inside the box as a 2-way resource.

You can run your command to synchronize the required files. Any I / O will be cursed slowly (as you mentioned), however you will get your files. For other things, use your sync folder with one move.

-1
source

Source: https://habr.com/ru/post/1546348/


All Articles