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

31–40 of 94 posts

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

#31

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…

A slightly nicer solution that still has the same spirit as your approach is to use BackupPC: http://backuppc.sourceforge.net/info.html

I've used it for many, many years. Setup is a bit of a pain, especially if it's your first time, but it's a totally reliable backup system and gives you something much better than just a pile of zip archives.

All of our servers get BackupPC'd (rsync-over-ssh, pulled) twice a day to an in-house server that's totally unreachable from the internet. I get emails from BackupPC when something goes wrong, which is pretty much never. Backups aren't a thing I have to worry about much anymore.

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

#32

I use AWS S3 for this as the storage prices are so cheap, at $0.03 per GB. I recommend using a utility called s3cmd, which is a similar to rsync, in that you can backup directories. I just have this setup with a batch of cron jobs which dump my databases and then sync the directories to s3 weekly.

I use duply (a simpler CLI front-end to duplicity) for doing encrypted incremental backups to S3.

The only annoying thing is that duplicity uses an old version of the boto s3 library that errors out if your signatures tar file is greater than 5gb unless you add `DUPL_PARAMS="$DUPL_PARAMS --s3-use-multiprocessing "` to your duply `conf` file. Took me days to figure that out.

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

#36

DigitalOcean has a droplet backup solution priced at 20% of the monthly cost of your droplet. Doesn't get much easier than that, if you can afford it. For a small droplet ($10/month) that's a full backup of everything for a buck a month. https://www.digitalocean.com/community/tutorials/understandi...

Is 20% of $10 a $1.00?That said, if you have a small application, I would pay DO to pack it up. They have global servers & imaging/snapshots. Your app would prob be good if you can get away with that kind of hosting.

I do believe you can take images and snapshots and download them, so using the api, a user could prob rig up a script to make it refundant if it was mission critical

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

#38
post #3

www.tarsnap.com - it's pay as you go, encrypted and super simple to use and script using cron

^ this.

Github takes care of code and config.

AWS S3 takes care of uploaded static files.

But Tarsnap takes care of my database backups.

The only thing to be aware of is that restore times can be very slow.

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

#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://www.tarsnap.com/

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

#40

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…

This. It's like you've read my code. Also worth considering encrypting backups so your users don't get screwed when your secondary VPS gets hacked.
Post reply on HN