Live data from Hacker News

Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

news.ycombinator.com

51–60 of 94 posts

Re: Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

#51

Whatever strategy you use, make sure you test the process of recreating the server from a backup to make sure you will actually be able to recover. You'll also have an idea how long it will take, and you can create scripts to automate the entire flow so you don't have to figure it all out while you're frantic. I use tarsnap, as many others in this thread have shared. I also have the Digital Ocean backups option enabl…

Is there any reason to not trust DigitalOcean's back up system?

[deleted]

Re: Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

#52
post #42

Earlier quoted context omitted.

I imagine DO has some contingency plan to prevent both your server and the backup being down at the same time.

Unless bug in their system, hack attack or human error deletes all droplets from your account. And yes, I have heard of stories like that from other hosting companies where a human error caused the account to be deleted and data removed.

DO does that too: https://news.ycombinator.com/item?id=11036554

Re: Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

#54

Earlier quoted context omitted.

It's always good to have your backup off-site. If something happens to DigitalOcean servers, your backups will be gone too.

I imagine DO has some contingency plan to prevent both your server and the backup being down at the same time.

That's nice in theory, but it's better to not to have all your eggs in one basket.

Re: Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

#55
post #21

Earlier quoted context omitted.

Careful! If someone hacks your server, they now get your Dropbox account. One alternative is to put these backups into S3 using pre-signed requests rather than Dropbox. An S3 pre-signed request gives permission only to upload files, perhaps only to a certain location in a certain bucket. It's a bit harder to set up, but the shell script will look almost the same.

You can actually set up app folders in Dropbox so that a particular API key effectively chroots you to that folder. The attacker would only get the backups.

Which is literally the worst scenario. An attacker owns your box and now your backups.

Re: Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

#56
Bash script to dump all DBs local and tar up any config files.

Then the script sends it to s3 using aws s3 sync. If versioning is enabled you get versioning applied for free and can ship your actual data and webdocs type stuff up extremely fast and it's browsable via the console or tools. Set a retention policy how you desire. Industry's best durability, nearly the cheapest too.

Re: Ask HN: How do you back up your site hosted on a VPS such as Digital Ocean?

#59
post #39

Write a little program in your favorite shell or scripting language that * rsyncs the directories containing the files you want to back up * mysqldumps/pg_dumps your databases * zips/gzips everything up into a dated archive file * deletes the oldest backup (the one with X days ago's date) Put this program on a VPS at a different provider, on a spare computer in your house, or both. Create a cron job that runs it ever…

Or put this program on the same VPS but instead of doing the gzipping and versioning yourself, incorporate Tarsnap[1] into the script. With Tarsnap you can also create a read/write-only key so that if someone hacks your server, a real threat mentioned downthread, they won't be able to delete your backups. And whatever you do, check that you can actually recover from these backups every once in a while. [1] https://ww…

My only con against tarsnap is that it can take a long time to do a restore, even for a smallish (30G) backup. Last time I tested at least, I was looking at over three hours. The dev is aware of the issue and may have improved upon it in the meantime.

That is the _only_ reason I have for looking at something else.

Post reply on HN