Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle data such as Mysql, web sites sources with Vagrant?

Tags:

vagrant

puppet

How to handle data such as Mysql, web sites sources with Vagrant ?

As a programmer, I like being able to easily set up environments for develop. So I created a vagrant box and provisioned it with puppet but I'm asking to myself, what about the data in the box ? What happen if I need to destroy the box and recreate it? All my data will be erased !

I had some problems with a crashed VM and I don't want to redo the same mistake, I want to have the control of my data.

How do you do ? Do you use shared folders to put your live data ? Where do you keep your data, in or out the box ?

like image 791
JulienD Avatar asked Oct 07 '22 18:10

JulienD


1 Answers

In the current version of Vagrant (1.0.3), you have two main options:

  1. Use shared folders. You can put your MySQL data directory into a shared folder so that the data comes back onto your host machine. The con of this is that shared folders are actually quite slow compared to the native VM filesystem in VirtualBox, and you can run into weird permission issues as well.
  2. Setup a task (rake, make, etc.) to copy your MySQL data to your shared folder on demand. Then, before you decide to destroy your VM, you can run the task to export your data to your shared folder, then you can reimport the data when you bring your VM back up.
like image 171
Mitchell Avatar answered Oct 12 '22 10:10

Mitchell