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

11–20 of 94 posts

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

#11
I run a couple of virtualmin web servers which do virtualmin based backups (backs up each website with all its files/email/db's/zones etc into a single file, very much like how cPanel does its account backups), and those are rsynced (cron job) to my home server than runs two mirrored 1tb disks. A simple bash script keeps a few days of backups, plus a weekly backup that I keep two copies of. Overall pretty simple, and it's free since I'm not paying for cloud storage.

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

#12
We have cheap reliable storage servers at https://mnx.io/pricing -- $15/TB. Couple our storage server with R1soft CDP (r1soft.com), Attic, Rsync, or Innobackupex, etc..

You can also use https://r1softstorage.com/ and receive storage + R1soft license (block based incremental backups) -- or just purchase the $5/month license from them and use storage where you want.

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

#13
For a static site put it in version control and keep as copy of your full site and deployment code.

For a database driven dynamic site or a site with content uploads you can also use your version control via cron job to upload that content. Have the database journal out the tables you need to backup before syncing to your DVCS host over choice.

If you're looking for a backup service to manage multiple servers with reporting, encryption, dedupelication, etc. I'd love your feedback on our server product: https://www.jungledisk.com/products/server (starts at $5 per month).

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

#14

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.

Agree, s3cmd is simple and effective. I have written bash scripts to regularly take db dump and put it on S3. Same can be done for folders.

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

#15
post #9

What type of site is it?

Important question. If it's a Wordpress site, then all you need to back up is the theme and your MySQL db. If it's a static site then just use rsync or sync to a git service.

And your /wp-contents/uploads/ folder...probably worth backing up everything in /wp-contents/ since some plugins create additional directories.

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

#17
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...

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

#18

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 host many sites for clients, and use the same approach. Our VPS host offers Plesk (which we use) and it creates a backup every day (basically ZIPs up non-system directories and runs mysqldump / pg_dumps on the databases)... then I wrote a simple bash script which sends the zipped backup to an S3 bucket using s3cmd.

It took a little time to set up, but it is conceptually simple, very inexpensive (especially if you set up S3 to automatically send older files to Glacier, and/or remove old backups every now and then)... and I like that the backups are off-site and stored by a different company than the web hosts.

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

#19

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...

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

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

#20

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…

Yep. Here is an example that I use to upload it to dropbox.

I don't delete and/or gzip my oldest uploads though.

    #!/bin/sh

    DATE=$(date +%d-%m-%Y@%H:%M:%S.%3N)
    DB_USER="qux"
    DB_PASS="foo"
    DB_NAME="bar"
    DROPBOX_TOKEN="baz"

    /usr/bin/mysqldump -u${DB_USER} -p${DB_PASS} ${DB_NAME} > /tmp/${DATE}.sql
    /usr/bin/curl -H "Authorization: Bearer ${DROPBOX_TOKEN}" https://api-content.dropbox.com/1/files_put/backup/ -T /tmp/${DATE}.sql
Post reply on HN