1

Lets say i have a rails app locally on my machine and i use vagrant with that app.

I have worked on that vagrant and made a box from it.

Now i give the box to some others.

Do the others need to have the source code of the rails app locally on their machines or they can just use the vagrant box that i gave without having the source code locally ?

nik7
  • 3,018
  • 6
  • 25
  • 36

2 Answers2

3

We use Vagrant for VDE (virtual development environment) in next scheme(maybe it will be useful for you too):

  1. we keep our sources under git (can be svn/csv/etc);
  2. we keep Vagrantfile in root folder of git repository;
  3. in Vagrantfile we add:

    config.vm.box_url = "http://<url for our box>"
    
    nfs = !Kernel.is_windows?
    
    config.vm.share_folder "v-root", "/tmp/vde", ".", :nfs => nfs
    

we store our box on S3 its easy, but as easiest way can be dropbox.

so for share your sources you need just share repository. in Readme.md you can describe few step to launch vde

with share_folder All your sources will be available from vde(inner instance) from folder /tmp/vde

iMysak
  • 2,170
  • 1
  • 22
  • 35
1

Generally the source code to your Rails app is shared from your own filesystem to the virtual machine you're running with Vagrant; it is not stored on the virtual machine's drive. The application is never actually stored permanently on the box. Thus, sending it to someone else will not allow them to run the app, as the app doesn't exist on the VM.

For more info, see "Accessing the Project Files" on the Vagrant SSH Documentation:

Accessing the Project Files

Vagrant bridges your application with the virtual environment by using a VirtualBox shared folder. The shared folder location on the virtual machine defaults to /vagrant, but can be changed. This can be verified by listing the files within that folder in the SSH session:

vagrant@vagrantbase:~$ ls /vagrant
index.html Vagrantfile

The VM has both read and write access to the shared folder.

Remember: Any changes are mirrored across both systems.

Community
  • 1
  • 1
Michelle Tilley
  • 157,729
  • 40
  • 374
  • 311
  • @SergioTulentsev I assumed nik is talking about development, not deployment, which is [really what Vagrant is for](http://stackoverflow.com/questions/13390483/vagrant-in-production). – Michelle Tilley Feb 02 '13 at 19:08
  • I didn't mean to say I use it in production. It is very useful to test deployment, among other things. And so I am deploying all code changes (instead of sharing a folder). [Dev-prod parity](http://12factor.net/dev-prod-parity) gets closer. – Sergio Tulentsev Feb 02 '13 at 19:11