Hot Koehls
  • Email
  • Feedburner
  • Linkedin
  • Twitter
  • Home
  • About
  • Archives
  • Contact
  • Software
    • S3imple Backup
    • Twitter Feed Archiver
    • FileTime
    • Flickr API Demo
Search
Home» S3imple Backup

S3imple Backup

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)
  • tar with gzip support
  • The following CLI commands, globally available (i.e. without specifying a path):

    • mysqlhotcopy
    • svnlook
    • svnadmin

Installation

For Experts

  • Download latest version (link above)
  • Place in non-www directory, ideally owned by root
  • Fill in details conf.* files, remove DIST- prefix.
  • Don’t forget db-structure.sql
  • s3imple.php must be executable

For Newbies

  1. Create a unique directory for S3imple, like /s3imple or /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.
  2. Download the latest version (link at top of this page), and extract contents
  3. Find the file named DIST-conf.setup.php, open in your text editor.
  4. Set the defines accordingly; each setting is well-documented in the file.
  5. Save and close. Rename the file to conf.setup.php (remove the “DIST-”).
  6. Find the file named DIST-conf.backup.php, open in your text editor.
  7. Identify the MySQL databases, SVN repositories, and any custom files/folders you wish to backup. The file is well documented for all three scenarios.
  8. Save and close. Rename the file to conf.backup.php (remove the “DIST-”).
  9. Upload all the files contained in the downloaded archive to your server.
  10. 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 apache or www-data for example).

  11. Set permissions to 700

        $ chmod 700 /path/to/s3imple
  12. Execute the contents db-structure.sql on the database you identified in conf.setup.php (define DB_SCHEDULE_DATABASE)
  13. Do a test run! SSH into your server…

        $ cd /path/to/s3imple
        $ ./s3imple.php
      
  14. Processing output will appear on-screen. If you get any errors, adjust accordingly and retest.
  15. Once everything is all set, create a cron job to run nightly (midnight is usually good).

        @midnight /path/to/s3imple/s3imple.php
  16. 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.

Categories

  • For entrepreneurs
  • For everyone
  • For techies

Latest Tweets

  • The PA Report - LucasArts' eulogy reminds us of the inhuman cost of game development http://t.co/vVjHkmr9YD
    April 9, 2013 - 2:46 pm
  • Pictures from a developer's life http://t.co/s75fBPTu4v
    April 5, 2013 - 11:44 am
  • Chuck+Norris http://t.co/awBqZ8gncS
    March 7, 2013 - 10:46 pm
  • Google Hacks http://t.co/ZIU2CHcoem
    March 3, 2013 - 1:08 am

Recent Comments

  • Rohitash on Automating SSH or SFTP in scripts
  • kgiFozzkjk on MySQL founder Michael Widenius concerned about sale to Oracle
  • purusjap on Jeff Atwood still wrong about PHP
  • OTHER FUNCTION on Get HTTP status code of cURL call in PHP
  • CounterSpace on Change timezone to GMT in Debian

Recent Posts

  • Display line numbers in WebSVN file detail view
  • It’s dangerous to go alone
  • Create Self-Signed Wildcard SSL Certificate
  • What comes after the yottabyte?
  • Write code like they do in Hollywood
(c) 2012 Frank Koehl. All Rights Reserved.
  • Contact Us
  • Sitemap