ERPNext Vagrant Development workflow

Anyone else using the vagrant box provided?
How did you share the frappe files to the host machine without it getting overwritten?
I’ve tried rsync-ing the frappe folder to the shared vagrant folder but that only works 1 way so editing files would be tedious.

Any tips?

I’m not sure what you mean exactly, but I guess you have issues defining additional shared folders on the guest machine. Provided your project folder is called sandbox and there’s a Vagrantfile in it, you may want to add this line to your Vagrantfile:

config.vm.synced_folder 'frappe-bench', '/home/frappe/frappe-bench'

This will add and sync your guest’s frappe-bench folder inside your sandbox folder on host.

That’s what I did but vagrant overwrites or hides the contents of the frappe-bench folder instead of creating it in the host machine.

Similar to this

Is there a better way of doing this?

Try copying over your files manually then reload vagrant:

scp -r frappe@<vb-image-ip>:/home/frappe/frappe-bench/ ./
vagrant reload

as a workaround suggested by Nathan. I know, feels ugly, but should do the trick.

Yes this is an annoying feature/fault with Vagrant.
Cool link to the tutorial by Nathan. Thanks

Well, that’s actually by design… the idea was making it possible to bring the code you actually working on “into” the virtual machine. Actually you can get around it with symlinks, but I guess that’s way simpler, unless you want to reproduce exactly your production environment locally. In this case the scp way is not the way to go, also because you’ll run in permission issues very soon.

Yes, I work around this by commenting out my vagrant file line:
config.vm.synced_folder ".", "/home/frappe/frappe-bench/"
From my local directory
vagrant up
vagrant ssh
sudo mv /home/frappe/frappe-bench/ /home/frappe/frappe-bench-TMP/
From my local directory I then
vagrant halt
Uncomment config.vm.synced_folder ".", "/home/frappe/frappe-bench/" in vagrant file
vagrant up
vagrant ssh
sudo mv /home/frappe/frappe-bench-TMP/ /home/frappe/frappe-bench/
This works well for me.

mhmh… i think you would still run into permission problems that way if you just move your apps to production, although they will run locally pretty well.