user1694651
user1694651

Reputation: 21

Vagrant within VCS

For a given project I currently have two repositories within Git - a codebase repository and a provisioning repository which contains a Vagrantfile, provisioning script and any required resources and templates.

The concept is that I can clone the provisioning repository and run a "vagrant up" to create a VM for that particular project. Part of the provisioning involves setting up a shared folder (configured to be a web-root within the guest OS), cloning the codebase repository into that folder and changing a few settings. The result is a project that is immediately accessible and ready for development.

While this system seems to work, I'm a little concerned about the resulting file structure on the host, e.g.

... Etc. By cloning my provisioning repository and then subsequently cloning the codebase repository into a shared folder I've created a bit of a problem. I've added the 'share' folder to the .gitignore file in my provisioning repository but I'm not sure if I'll run into any problems (I've already noticed a couple of issues within my IDE).

The only solutions I can think of are to export the provisioning repository rather than clone it (this creates difficulties if I need to change it) or to point the shared folder away from the provisioning location. Neither of these are ideal so I hope I'm missing something.

Has anyone attempted something like this before, and if so can you suggest a safer, more elegant solution?

Upvotes: 2

Views: 241

Answers (1)

Cryptographic_ICE
Cryptographic_ICE

Reputation: 619

You can use git submodules to solve your issue:

http://git-scm.com/book/en/Git-Tools-Submodules

However I use a simpler solution that you suggested which is to locate the provisioning code inside the app directory. I found managing 2 git repos to be a little more confusing then I wanted. Most of my provisioning code will only work for a specific application so it made sense to keep the provisioning and app code in the same repo.

Upvotes: 0

Related Questions