09. September 2011

Super sexy mysql backups

Note from the future - 4th March 2014

This is a super dumb way to do this. Your git repo will eventually get completely out of hand. jgit will barf all over everything. Things will generally be terrible. Probably use tarsnap instead.

End note.

This will give you backups of all your mysql data, nicely versioned with git, securely stored in S3.

There are plenty of guides out there on how git, and S3 work. There are less on how jgit works, but there are still some around. This is just the bare bones to get you up and running as quickly as possible. If anything is unclear, hit me in the comments.

Download jgit.sh (http://www.eclipse.org/jgit/download/) <del>enable partner repository</del> <del> sudo apt-get update</del> <del> sudo apt-get install sun-java6-jre</del>

edit:: jgit seems to work fine with the openjdk, and AWS has a kernel bug where installing the sun package on a t1.micro instance causes the machine to freak out. Only occurs in some availability zones. Had some fun figuring that out!

sudo apt-get install openjdk-6-jre-headless

vim ~/.jgit accesskey: ACCESSKEY secretkey: SECRETKEY

mkdir s3backup cd s3backup git init mysqldump DBNAME -u USERNAME -r dump.sql —skip-comments git add dump.sql git commit dump.sql -m "Initial commit" git remote add s3 amazon-s3://.jgit@BUCKETNAME/SOMEPROJECTNAME.git ~/jgit.sh push s3

Cron script contents:

!/bin/bash

d="date" cd /home/ubuntu/s3backup mysqldump DBNAME -u USERNAME -r dump.sql —skip-comments git commit cpanel.sql -m "$d" git gc ~/jgit.sh push s3

To get data back:

~/jgit.sh clone amazon-s3://.jgit@BUCKETNAME/PROJECTNAME.git git log git reset —hard THEHASHIDOFYOURDATABASEBEFOREYOUMESSEDITUP

25. May 2011

Install NodeJS on a default Amazon EC2 instance

There are a few guides to this floating around, but Amazon must have changed a few things about their default micro instances as all the ones I found are out of date. Even the instructions built into AWS about how to connect to your instance are out of date!

I assume you've got your instance set up in AWS, if not, go do that and then come back. There's plenty of info out there.

Ssh into your instance. AWS tells you to use this command: <pre>ssh -i test.pem [email protected]</pre> However, logging in as root won't work. You need: <pre>ssh -i ./test.pem [email protected]</pre> Now you need to install a few prerequisites. <pre>sudo yum install gcc-c++ openssl-devel make</pre> Now grab Node. This version is current as at 25-May-2011. Check http://nodejs.org/#download for changes <pre>wget http://nodejs.org/dist/node-v0.4.8.tar.gz</pre> Untar it <pre>tar -xvvf node-v0.4.8.tar.gz</pre> Change into the correct directory: <pre>cd node-v0.4.8</pre> Configure it: <pre>./configure</pre> Make it (on a micro instance, this will take exactly forever): <pre>make</pre> Install it <pre>sudo make install</pre> Job done!

11. August 2009

Tomboy and KDE, making it happen

I run Kubuntu Jaunty with KDE4 on my netbook. BasKet wasn't doing it for me so I tried to get Tomboy happening. Problem was, it would abort with a SIGSEGV and complain about errors in mono any time I tried to run it. I couldn't find anything out there that suggested a workaround, so I set about building a newer version than was in the repos from source. Couldn't get that happening, but in my travels I installed the package gnome-doc-utils and BAM, it worked.

So, if you're having issues with Tomboy refusing to start under KDE4, have a crack at:

sudo apt-get install gnome-doc-utils

Let me know in comments if it does the trick.