Basic/Newbie vagrant questions

28 views
Skip to first unread message

Nicolas Blanco Mattos

unread,
Sep 17, 2018, 1:32:51 PM9/17/18
to Vagrant
Hi everyone!

I have some newbie questions in the best way of using several vagrant boxes, destroying them, and then spinning them up again.

I am a web developer and I use scotchbox for my local enviroment. I create a new box downloading scotchbox and creating a new local domain for the IP the project uses, BUT when I'm done with the project: what is the best way to free resources without loosing data and not keeping garbage that I won't use anymore?

Is it ok to make a copy of the database, destroy the box, move the project files and database to a dropbox folder for storage (for example), and if some day I need to work on this project again just do a 'vagrant up', reimport the database, and copy files back again?

Another way would be to move the entire project folder (with the .vagrant) to the dropbox folder for storage without destroying anytihing and when needed again just copy it back... but I assume that I am not releasing the resources that the vritual machine is using, as I am not destroying it and also some kind of problems could be caused... Am I right? What are your workflows in this topic?

Thanks!!

JP Toto

unread,
Sep 17, 2018, 3:14:42 PM9/17/18
to vagra...@googlegroups.com
Nicolas,

What you could do (and probably should do) is use a different base folder for each project and in each one would contain a different Vagrantfile file. Then for each project you can tweak your Vagrant file for provisioning specific to your project. To bring up that project, you'd "vagrant up" inside that root folder where the Vagrantfile is. To turn it off you'd "vagrant halt" from the same place.

When you "vagrant halt" from the root project folder containing the Vagrantfile, it will shut down the virtual machine in whatever hypervisor you're using (let's assume VirtualBox). Once a machine is halted, it's not using any resources except some disk space to store the VM file, the location of which is governed by VirtualBox.

With that workflow there is no need to destroy any of your Vagrant boxes or old projects. Since you're setting some domain/IP config locally you may need to tweak that depending on which project you're working on but even that can be mitigated. Assign a different static private IP to each project VM within the Vagrantfile and then you can rely on that for network hostnames in your /etc/hosts file (or however you're doing that).

If you're starting with scotchbox from Vagrant, it will only be downloaded to your Vagrant cache once and then Vagrant will just use that base image to provision your project VMs so you won't be wasting any disk space keeping older projects around.

Hope that helps. Good luck!

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/8a15276a-be46-4d4e-921c-bb050ccf9a3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
JP Toto   |   james....@gmail.com   |   http://jptoto.jp   |   @jptoto

Nicolas Blanco Mattos

unread,
Sep 18, 2018, 2:35:00 AM9/18/18
to Vagrant
"If you're starting with scotchbox from Vagrant, it will only be downloaded to your Vagrant cache once and then Vagrant will just use that base image to provision your project VMs so you won't be wasting any disk space keeping older projects around." Thanks! This is was what I was really looking for. I didn't know if keeping older projects without destroying the virtual machine was wasting any disk space. So thanks again, I'll do as you said ;)
Reply all
Reply to author
Forward
0 new messages