Tag Archive for 'Website'

Amazon Linked Me!

Amazon Linked Me!

Hot damn!

Amazon S3, S3Sync, Backups, and You!

With EC2 and S3 Amazon has made available some seriously powerful and flexible tools for server and file hosting. Ec2 allows you to roll whatever flavor OS you want and get it up and running–think of it as virtual dedicated hosting–which while being incredibly cool has one major downside: if your server instance fails you loose your data as it will revert to the most current instance when you get it back online. In other words, a hiccup on EC2 could turn into a blistering nightmare.

This is where S3 comes in handy for storing anything that might change after you create and instance and launch it such as databases, files uploaded or created, and even logs. One of the first projects I hopped into was dumping the MySQL databases, compressing them and tossing them up on S3, a tedious process that can be automated with cron and s3sync (a ruby based tool that approximates rsync, kinda sorta).

Daily cron job to create new bucket

cd /root/s3sync/
DAYNOW=$(date +%j)
ruby s3cmd.rb createbucket WTF_db_$DAYNOW

Daily cron job to delete old bucket

cd /root/s3sync/
DAYTHEN=$(date +%j --date='2 days ago')
ruby s3cmd.rb deletebucket WTF_db_$DAYTHEN

Hourly job to back up the database
# get into the directory
cd /root/s3sync/


# set the environment
export AWS_ACCESS_KEY_ID=XXXX
export AWS_SECRET_ACCESS_KEY=XXXX/XXXX
export SSL_CERT_DIR=/root/s3sync/certs


# set date variables
DAYNOW=$(date +%j)
TIMENOW=$(date +%H%M)

# dump database
mysqldump WTF > /tmp/WTF-$DAYNOW-$TIMENOW.sql

# tar SQL dump
tar -czvf /tmp/backups/WTF-$STAMPD-$STAMPT.tar.gz /tmp/WTF-$DAYNOW-$TIMENOW.sql

# copy tar to S3
ruby s3sync.rb -r --ssl /tmp/backups/ MahBukit:WTF_db_$DAYNOW

# clean up after yourself
rm /tmp/*.sql
rm /tmp/backups/*.gz

Now one of the frustrations I have with this set up is while I am dropping the buckets from 48 hours prior it isn’t actually deleting the files off S3, a bit of a pain in the ass that I need to find some sort of resolution for in the near future. If anyone has an answer to this problem I would love to hear it! For now, I’m cheating by using S3Fox to purge those pesky backups.

WP 2.2 + K2 = Headache

Seeing as I haven’t been using FTP enough I decided to jump on the 2.2 release this morning only to find that it completely borked my install of K2.  After much forum searching and plugin in tweaking that would result in utter breakage I decided to suck it up and try the nightly build of K2.  Seems like things are back to normal.  Well, relatively speaking.

Pardon Our Appearance

The move went somewhat smoothly, with the database backup needing a minor tweak as I am running MySQL 5.0 at home and 1and1 is running 4.0.whatever. The biggest headache has been migrating all the old uploads and themes which for whatever reason was causing piles of permissions errors. Because of that odd snag I’ve decided to start with a fresh coat of CSS which explains the fugly. Bear with me while I try and get things looking nice again. :-D

Little More Housecleaning

Spent a little time to tidy up the main menus, removing content that I haven’t touched in a while and adding a photo album thanks to the fine folks over at Tan Tan Noodles. Setting up the photo album wasn’t too arduous, just needed to make sure that I had php5-curl installed and then tweaked the view.php file to add the k2 specific div tags.  The interface is real nice and it’s dead simple to use.

Now to stop procrastinating and go hang the valences in the baby’s room…

CSS Reboot

Well, my own version of it, anyways. Spent the weekend learning Inkscape and generating several banners before setting on this one which blends several colors from Gabriella’s room (painting on the mind) and makes use of a re-mixed assassin. Quite pleased with everything, if I don’t say. ;-)





Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States