I got sick of backup software with tons of configuration options, but sucked at actually backing up. So I wrote one that just works.
Download S3imple
MD5: 5541486c5810227bc6af8896f300f045
Revision 16
Updated 2011/11/22
What is it?
S3imple Backup is a PHP script designed to copy and compress data into a tar gzip archive, and then store said archive in an Amazon S3 bucket. It was designed with a typical webserver environment in mind, with minimal prerequisites. It natively handles MySQL databases and Subversion repositories, and includes a handler to easily backup any custom file or directory. It requires no special libraries to communicate with Amazon S3.
Why should you use it?
I currently secure and maintain eight independent webservers, and have tried every backup arrangement you can imagine. They all ended up being overkill, cumbersome, worthless, or some combination thereof. I couldn’t find anything suited to your typical standalone web server configuration, so I just wrote my own. If you’ve toyed with backup programs like AMANDA/Bacula, or homebrew junk using rsync/SSH/FTP, you’ll love S3imple.
System Requirements
- A Linux OS (not tested on Windows, cygwin, or Mac)
- PHP with CLI access and cURL (tested 5.3.2, anything above 5.0 should work)
- MySQL (tested 5.1, any recent version should work)
tarwithgzipsupport-
The following CLI commands, globally available (i.e. without specifying a path):
mysqlhotcopysvnlooksvnadmin
Installation
For Experts
- Download latest version (link above)
- Place in non-www directory, ideally owned by root
- Fill in details
conf.*files, removeDIST-prefix. - Don’t forget
db-structure.sql s3imple.phpmust be executable
For Newbies
- Create a unique directory for S3imple, like
/s3impleor/home/s3imple. You will only need SSH/FTP access to this directory, it should NOT be web-accessible! Make sure that the partition where your directory is located has ample space, as S3imple makes local copies of all your data at the start of the backup process. - Download the latest version (link at top of this page), and extract contents
- Find the file named
DIST-conf.setup.php, open in your text editor. - Set the defines accordingly; each setting is well-documented in the file.
- Save and close. Rename the file to
conf.setup.php(remove the “DIST-”). - Find the file named
DIST-conf.backup.php, open in your text editor. - Identify the MySQL databases, SVN repositories, and any custom files/folders you wish to backup. The file is well documented for all three scenarios.
- Save and close. Rename the file to
conf.backup.php(remove the “DIST-”). - Upload all the files contained in the downloaded archive to your server.
-
If you have root access, I recommend that you set ownership of all files to root.
$ chown root:root /path/to/s3imple
If you do not have root access, at least set to a user other than the one that runs your webserver (e.g. don’t use
apacheorwww-datafor example). -
Set permissions to 700
$ chmod 700 /path/to/s3imple
- Execute the contents
db-structure.sqlon the database you identified inconf.setup.php(defineDB_SCHEDULE_DATABASE) -
Do a test run! SSH into your server…
$ cd /path/to/s3imple $ ./s3imple.php - Processing output will appear on-screen. If you get any errors, adjust accordingly and retest.
-
Once everything is all set, create a cron job to run nightly (midnight is usually good).
@midnight /path/to/s3imple/s3imple.php
- You’re done! Log into the Amazon S3 Console every now and then and check the filenames to be sure new backups are being generated (backups end with a date stamp, format
yyyymmdd.tar.gz).
Frequently Asked Questions (FAQ)
Does S3imple encrypt/compress data before sending it to Amazon?
The Amazon S3 PHP class uses SSL connections to communicate with Amazon S3 by default.
S3imple does not perform any additional encryption or compression, though you are welcome to add your own.
How do you pronounce “S3imple”?
Just like the word “simple.”
Will S3imple support Windows or Mac?
No, get a real web server.
Will S3imple support [insert complex client/server network layout]?
No.
Will S3imple support custom backup destinations, i.e. somewhere other than Amazon S3?
S3imple keeps local copies from the last backup run. You can find them in subdirectories beneath your S3imple install. You could grab the latest backups from there and do whatever you’d like.
However based on experience, you can’t do better than S3 when it comes to securing your precious, precious data.
A standard S3 bucket has a Service Level Agreement that guarantees “99.999999999% durability.” I did not add any of those 9′s for emphasis, that’s direct from their literature. Having the SLA is the equivalent of Amazon saying to you, “We will take care of your stuff, or it’s our ass.” Have a look at the S3 Security Overview for more detail. It’s also insanely cheap compared to other backup solutions.
Problems? Questions?
Use the comment section below to post general support questions. If you have a bug or security report, use the contact form to drop me a line directly.
Credits
- My wife, Jennifer, for being utterly awesome.
- S3 connections are powered by Amazon S3 PHP class, a great script by Donovan Schönknecht.