Roots Discourse

Best way to clone a "base template" vm for starting point for new projects

sage9

#1

I’ve created a base template vm (that will continue to evolve) out of the roots-example-project.com repo. This will be a starting point for me (& soon, my team members) to clone every time a new project is started.

I’d like to be able to clone the vm with a new name, and I’m wondering what the *easiest way is to do this, as I’d like the spin-up process for me & my team to be as simple as humanly possible.

Currently, if I try to simply copy the entire project directory that includes /site and /trellis, and run vagrant up from this new directory – it recognizes it to be the same vm that has simply been moved to a new location.

“This machine used to live in . . . but it’s now at . . .”

Any suggestions?

For now, it seems like the best option for me to have a separate vm for every project, since I’ll be starting new projects here on my dev machine, and soon my team members will also be starting new projects from the base template as well. I’d like each project to be as separate and “container-like” as possible.

Thanks!

edit:
In what file is the vm name determined?

Still no luck after adding
config.vm.define :testproject do |t|
end
to the vagrantfile.

It attempts to build a new vm, but then I get the message,
A VirtualBox machine with the name 'roots-example-project.test' already exists.
Please use another name or delete the machine with the existing
name, and try again.

So, it seems that the config is pulling a default vm name from somwhere else, but I can’t seem to pinpoint it.


#2

Update:
I’ve found that by deleting the .vagrant directory and changing the domains in wordpress_sites.yml, I can now boot up a fresh VM with vagrant up.

This should suffice, as I can name the template vm something like “template” and have my team members simply rename the VM in Virtualbox once its created.

Does anyone have any other advice pertaining to best practices?