nik7
nik7

Reputation: 3058

Does Vagrant need the source code locally?

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 ?

Upvotes: 1

Views: 674

Answers (2)

iMysak
iMysak

Reputation: 2228

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

Upvotes: 3

Michelle Tilley
Michelle Tilley

Reputation: 159105

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.

Upvotes: 1

Related Questions