xforty / vagrant-drupal

Template repo for a new drupal project built on top of a vagrant vm.
Other
46 stars 11 forks source link

Automate mysql backup to avoid data loss #22

Open pearcec opened 12 years ago

pearcec commented 12 years ago

Add this package somewhere. We should make it do a backup every X minutes that is configurable. By default it does daily, we should do hourly. We should also trigger a backup prior to a shutdown.

dkingofpa commented 12 years ago

The backup would be output to the /vagrant/backups folder so it ends up on the host. Only need one backup file...keep overwriting it? Do we need to worry about backup size or how long the backup takes?

The vagrant triggered backup doesn't need to happen on shutdown, it only needs to be when the vm is destroyed. I believe that will need to be a rake task. Does that rake task just get added to the vagrant environment? I wonder how important this really is once we have regular backups occurring?

pearcec commented 12 years ago

If your box gets destroyed there is no backup, right? I would suspect the rake task (chef task?) would get executed in the vagrant environment.

What do you mean regular backups?

dkingofpa commented 12 years ago

To get notified that the vm is being destroyed, it would be a rake task that loads the vagrant environment and performs whatever you want on the vm. Chef isn't involved.

With "regular backups", I just meant the automated backups that are run every X minutes.

Maybe we could add an option for vagrant destroy named --no-backup if the backups take too long or we just don't need them?

pearcec commented 12 years ago

The original fear is vagrant does something wrong and divorces you from your running instance. But seems to me I could still attach to the instance via Virtual Box through some fancy VNC setup right? So I wonder if this is truly necessary. As far as regular backups that could be handled with automysqlbackup right? it is a package.

----- Original Message ----- From: "David King" reply@reply.github.com To: "Christian Pearce" pearcec@xforty.com Sent: Monday, May 21, 2012 11:52:03 AM GMT -05:00 US/Canada Eastern Subject: Re: [vagrant-drupal] Automate mysql backup to avoid data loss (#22)

To get notified that the vm is being destroyed, it would be a rake task that loads the vagrant environment and performs whatever you want on the vm. Chef isn't involved.

With "regular backups", I just meant the automated backups that are run every X minutes.

Maybe we could add an option for vagrant destroy named --no-backup if the backups take too long or we just don't need them?


Reply to this email directly or view it on GitHub: https://github.com/xforty/vagrant-drupal/issues/22#issuecomment-5826109

xforty technologies Christian Pearce 888-231-9331 x1119 http://xforty.com

dkingofpa commented 12 years ago

Right, if vagrant has an issue, no destroy notice is going to be sent. So in that case, there are two options:

  1. Rely on the automatic backups.
  2. Document in the wiki how to run a db backup on a vm whose vagrant environment has locked up.

For automatic backups, how small an interval should we do? You mentioned once a day by default, but these aren't servers that are always running. If the interval isn't small enough, it may be worth doing the rake task on vagrant destroy.

Sure, we can look at adding automysqlbackup. Here is one person's attempt at an automysqlbackup cookbook (not that we should use it though). https://github.com/thickpaddy/cookbooks/tree/master/automysqlbackup

pearcec commented 12 years ago

Either way it would be a rescue. More of an advanced option. I say document both. As far as interval, it should be configurable. Right now it runs daily out of cron. Unfortunately it doesn't look like automysqlbackup supports a concept beyond daily. When I ran it a second time it just cleaned out the prior run for that day. We could just run it hourly. So you would always have a backup, but it would only ever be about an hour old. So if you wanted to go back two hours you couldn't. Seems like this is better than nothing. I am not sure anacron would help. The script it self checks to see if it is the DOW or DOM when running the rotation.

Seems like we have two issues in this thread.

  1. Recovering from a failed vagrant
  2. Keeping backups running frequently

----- Original Message ----- From: "David King" reply@reply.github.com To: "Christian Pearce" pearcec@xforty.com Sent: Monday, May 21, 2012 12:57:18 PM GMT -05:00 US/Canada Eastern Subject: Re: [vagrant-drupal] Automate mysql backup to avoid data loss (#22)

Right, if vagrant has an issue, no destroy notice is going to be sent. So in that case, there are two options:

  1. Rely on the automatic backups.
  2. Document in the wiki how to run a db backup on a vm whose vagrant environment has locked up.

For automatic backups, how small an interval should we do? You mentioned once a day by default, but these aren't servers that are always running. If the interval isn't small enough, it may be worth doing the rake task on vagrant destroy.

Sure, we can look at adding automysqlbackup. Here is one person's attempt at an automysqlbackup cookbook (not that we should use it though). https://github.com/thickpaddy/cookbooks/tree/master/automysqlbackup


Reply to this email directly or view it on GitHub: https://github.com/xforty/vagrant-drupal/issues/22#issuecomment-5827731

xforty technologies Christian Pearce 888-231-9331 x1119 http://xforty.com