Matt Komarnicki
Matt Komarnicki

Reputation: 5422

Laravel Homestead - one per project or one for all?

I'm using Vagrant Homestead for my regular work with Laravel projects. Let's assume that I'm talking just about Homestead (no other vagrant boxes.). I have both .vagrant.d and Homestead directories in my ~ directory. Cool.

I know that I can deal with more than one Laravel project in Homestead by simply adding more sites and folders to my YAML file, editing my /etc/hosts and finally inside Homestead I can run vagrant up / vagrant ssh etc.

Question is more about how do prefer to organise your projects (if you have more than one). Is it better to:

1) add more sites and folders to one Homestead

or

2) is it better to create something like Boxes directory inside my home and then clone as many Homesteads as possible by naming them like

So one virtual machine per project or not?

Upvotes: 3

Views: 625

Answers (1)

whoacowboy
whoacowboy

Reputation: 7447

I personally use one VM for all my projects unless there is a compelling reason to have multiple VMs, see my setup below.

I like my VM to match my server configuration. If the server configuration is different for production I will set up an new VM that matches.

Also, I tend to give individual clients their own VMs on any decent sized project.

In general it is a pain to manage multiple VMs, so why give yourself the headache unless it is warranted.

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Projects
      to: /home/vagrant/Projects  
      type: "nfs"

sites:
    - map: app1.app
      to: /home/vagrant/Projects/app1/public

    - map: app2.app
      to: /home/vagrant/Projects/app2/public

    - map: app2.app
      to: /home/vagrant/Projects/app3/public 

databases:
    - app1
    - app2
    - app3

Upvotes: 1

Related Questions