Remote Server Backup via Dropbox 

This site runs on a VPS server sitting out in a data center. I try hard to keep the server reasonably backed up, similar to how I keep my desktop backed up, but it’s something I’ve not been nearly as diligent about.

Previously, here was how I kept my VPS backed up:

  1. Paid daily server snapshot (i.e. I could restore my server to exactly what it looked like yesterday)
  2. Database dumps of my important mysql databases that I would remember to copy off to another server every couple of weeks (i.e. not particularly reliable)
  3. A backup of my important web stuff over FTP and git when I remembered to do it (i.e. not particularly reliable)

So, in the grand scheme of things, not very reliable.

All I really wanted was a simple backup where I could easily get the important files and configs off of the server onto my local machine, so that it would get included with my normal, robust, multi-location backup strategy. The normal method to do that would be rsync, but that means running my machine all the time. Not a big deal for my desktop machine, but that’s also not the machine that gets updated and backed up to Amazon Glacier daily.

Really, what I wanted is to use Dropbox on my server, without having to run Dropbox on the server.

It turns out, that’s pretty easy [1].

There are a few different solutions out there [2], but for me, I wanted a bit of control over it. Dropbox’s Ruby API is really, really easy to use. My total script is about 22 lines (I’ll go into that, in the future). Very simply:

So, right there, I’ve now backed up my data daily to Dropbox, which is a big win over what I had before. Even if my computer dies or is turned off for a month, I’m still backing up my data. But, even better, when my various computers are turned on, I’m getting the backed up data synced down to those machines. So, I’m getting multiple copies of my backup data, and that backup data is getting included in the places that those machines are backed up (Time Machine, Glacier, etc.).

I’m not sure why I didn’t think of this before. It took all of about 60 minutes to get the entire thing working, including building the little Dropbox backup app that runs on the server.


  1. If you can write a little bit of code.

     ↩

  2. If you care to Google.

     ↩