Multiple projects one vagrant machine

Hi

I’m wanting to change how our office works with php storm. Currently we use a remote virtual machine for us all and we all have our own virtual hosts for each project. It’s quite tedious and can be annoying and slow when working outside the office.

I want to switch to vagrant so I can setup a project for all my developers who can simply pull the vagrant config from git with the project and run it all from there.

My problem is that we do a lot of different projects and I don’t want to have tons and tons of virtual machines running all the time, I would much prefer one vagrant machine that each project can map to a specific virtual host on one ip so we can just add host names to our machines.

Can someone help me out with what to do. So far all I can see is articles on launching a vagrant machine for each project rather than mapping different projects to different virtual hosts on the same vagrant machine.

I understand this means I can’t submit a vagrant config to each project but I can provide a single config all my developers can update form a different git repo when new projects are added as virtual hosts.

1 comment
Comment actions Permalink

That should be relatively easy, but you and other developers will have to keep all projects in the same folder, just to avoid configured separate Vagrant synced folders for each project.

  1. Create a new Vagrant instance at ~/PhpstormProjects
  2. Open a project located in ~/PhpstormProjects/SomeProjectName
  3. At Settings | Tools | Vagrant, set Instance folder to ~/PhpstormProjects
  4. You can add a Vagrant PHP interpreter now that uses this Vagrant VM. You can even make it IDE-wide (uncheck Visible only for this project)
  5. Repeat 2-3 (4) for new projects
  6. Optionally, you can configure Vagrant Instance folder in File | Other Settings | Settings for New Projects
0

Please sign in to leave a comment.