Sunday, July 5, 2009

Ant, SCP and EC2

I've have had to deal with a strange set of circumstances

1. No ant-jsh.jar in my deployment

I got the error

BUILD FAILED

Deploy.ant.xml:57: Problem: failed to create task or type scp

Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found.

This looks like one of Ant's optional components.

Action: Check that the appropriate optional JAR exists in

-/usr/share/ant/lib

-/Users/alvinrichards/.ant/lib

-a directory added on the command line with the -lib argument


Do not panic, this is a common problem.

The commonest cause is a missing JAR.


This is not a bug; it is a configuration problem

Turns out that the default deployment of Ant (1.7) did not contain this jar on Mac OS-x 10.5. So I had to do two things

  1. Download the binary distribution of Ant 1.7, unpack the jar and copy ant-jsch.jar to /usr/share/ant/lib
  2. Download the implementation of the SSH java code from JCraft and copy it to /usr/share/ant/lib


2. I still can't SCP to EC2

So I know I can scp -i to this EC2 host, but the following Ant task fails

<scp localfile="dba.war"

todir="root@xxxx:/usr/java/apache-tomcat-6.0.14/webapps/"

keyfile="xxxx-Amazon-LAMP-image-keypair">

with

BUILD FAILED

/Volumes/Develop/Develop/Projects/HarpoonDeployMK9a/Deploy.ant.xml:57: neither password nor passphrase for user root has been given. Can't authenticate.

Turns out that you need the following in the SCP task for it to work with EC2

trust="yes"

passphrase="xxx"

The passphrase that worked happened to be my password for my AWS account...

Friday, July 3, 2009

End of life... Oh Amazon stop making me do work!

So, like many early adopters I have the pain of being an early adopter. The most recent is the delightful email I got from Amazon.

Dear Amazon SQS Customer,

This is a friendly reminder about the upcoming deprecation and end-of-life for the Amazon SQS 2006/2007 WSDL.

Talk about a "Dear John" letter. In the end it was not much work, just needed to download the latest version of Typica 1.5.2a and then change
import com.xerox.amazonws.sqs.Message;
import com.xerox.amazonws.sqs.MessageQueue;
import com.xerox.amazonws.sqs.QueueService;
import com.xerox.amazonws.sqs.SQSException;
to
import com.xerox.amazonws.sqs2.Message;
import com.xerox.amazonws.sqs2.MessageQueue;
import com.xerox.amazonws.sqs2.QueueService;
import com.xerox.amazonws.sqs2.SQSException;

The only problem so far is that the old version of Typica (0.8) included in the jar ch.inventec.Base64Coder.class which is need to run. I resorted to including the old Typica jar on the class path after a fruitless search for this class elsewhere.

So I'm no back running with the new WSDL and a happier Jeff Bezos.

Now I just have to rip out the code that did on demand scaling and load balancing...

Sunday, March 8, 2009

VMWare Fusion Shared Printer Fun (or three hours to print a single page)

So, this should be simple right? I have my main Mac (some 8 core mainframe thing) where I run multiple development environments and a whole host of virtual machines running various Oracle version on lots of flavors of Windows, Linix and Solaris. I have a second machine where the shared printer is connected that I wanted to print to. Yes, I could have simply moved the printer, but where is the fun in that?

So I need to print from Windows. Well this is easy right... Errr wrong. The culprit was VMware's lack of documentation and working examples. Even the web did not prove useful.

So this is what I did, your mileage may vary

  1. Ensure that your Mac can print to the shared machine. Simply try printing a page from Safari. If that does not work, then Google way to fix a "regular" printing problem.
  2. Set the Network mode on the VM to "Bridged"
  3. Reboot the VM
  4. Install the right Printer Drivers (mine was an Epson RX500)
  5. Install Apple's "Bonjour for Windows"
  6. Follow the install directions for Bonjour for Windows, accepting all the defaults
  7. ... and if you are lucky if works
I then found a video, looks like somebody at VMWare put together but its not linked from their main site. Oh, and can I have my three hours back please?

Sunday, March 1, 2009

Write it down stupid!

So I have just paid the price, lets say conservatively at 2.5 hours. The simple solution would have been to write everything down. But you never know when. As is always obvious, "when" should not been 14 months *after* you have last done something but that 20:20 hindsight for you.

The challenge? Reboot the system. Why? Well after 14 months it needed a minor refresh for Google Analytics. I guess that I have at least proved that I built something reliable! All of this took a zero downtime from the users perspective, other than a need to log in again.

So after I figured out (again) how to start and stop on instances on EC2, kick started with the right parameters and remembered all the DNS tricks I got it up and running again.

Oh, and I then took 20 minutes to write it all up with the rest of the documentation on Google Docs...