All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Tutorial: Basic website and database backups with Duplicity
This tutorial will show you how you can back up your website and database with Duplicity. Duplicity is a very useful tool to make remote unassisted backups. The backups can be incremental, encrypted, and over a variety of transports.
There are a few steps involved in the process of setting this up, and also a few preconditions:
- The tutorial works best with a VPS, were you have full root access to the filesystem and database
- The tutorial is targeted at debian/ubuntu, but with adaption of commands will work under CentOS/RHEL.
- You need an off-site location to store the backups (other vps for example)
Basic web application backup
First I'll try to educate you a little bit with some theory.
This tutorial works for all web applications, since they almost all share the same common structure:
- source code (.php files, .js files (node), .rb files (rails) etc.)
- database (MySQL, PostgreSQL, MongoDB etc.)
- configuration (apache config, nginx config, mysql config, application config)
We are going to back up files. Two of the three things above are already files, and the database will be exported to a file. The database will be exported so that it can be imported again using native tools (mysqldump, mongodump etc.), since just copying the database folders and files will almost always result in a corrupted database.
Duplicity has a few advantages to other backup tools and scripts:
- Incremental backups (Saving size)
- A lot of storage options (ssh, rsync, ftp, amazon S3, IMAP, google drive and more.)
- Encryption built in
- Easy to set up and maintain.
I myself have the following set up for almost all of my web application backups:
- Shell script to export the databases
- Duplicity backing up the files to a "storage" VPS
- The storage vps is just a server with a lot of HDD space doing nothing else.
- Some apps back up daily, some hourly and some weekly.
Comments
Thanks for the helpful guide
Awesome guide. Been looking for an alternate backup solution.
Loving the guides you write, great community spirit
Maybe you can change this to the tutorials section
404?
Great stuff @Raymii, changed the section to tutorials.
Also sent a PM.
The link loads fine for me.
@Raymii
your website does not load for me, and that's since quite some time ago.
http://ompldr.org/vaGkzYw/2013-02-17T220925Z-raymii.png
Basically despite over 9000 IPs on the hostname, all your IPv6 is down.
Do you ever test it yourself?
^ the above took ~5 minutes until all the timeouts expired.
@Raymii
Had a draft going for this myself, mind if I copy yours instead? Full credit towards you ofcourse.
@Raymii Dude, you rocks! Thanks!
Thank you! I'm working to improve my backup settings, this helped a lot!
Or you can use CodeGuard.
For those interested in using encryption with your backups. I send my backups to S3.
http://www.kubicle.com/automate-encrypted-backups-using-amazon-s3-duplicity/
That was sweet and simple.. quite helpful as I have good idea about duplicity now.
your website does not load for me, and that's since quite some time ago.
http://ompldr.org/vaGkzYw/2013-02-17T220925Z-raymii.png
Basically despite over 9000 IPs on the hostname, all your IPv6 is down.
Do you ever test it yourself?
@rm_
IPv6 indeed has an issue. I've recently upgraded all the servers to Debian Wheezy, before than I can confirm it worked. I've disabled IPv6 until I find out what the issue is. Thanks for reporting it.
@Mikho
Sure go ahead. Quoting my website's disclaimer/license:
(https://raymii.org/s/static/Disclaimer.html)
Hi,
Is there any centos/cpanel server version of this? thx
Change
apt-get install
toyum install
and you have a centos version.@Raymii Thank you for that instructive and simplified tutorial. Glad to have learn something.
Cheers!