Sunday, July 20, 2008

JBoss Drools CLASSPATH Error; The Eclipse JDT Core jar is not in the classpath

JBoss Rules v4.0.7 is compatible with Eclipse v3.3 or higher. However there is a simple workaround. Run the following commands:

export ECLIPSE_PLUGINS=/home/medined/Desktop/eclipse-3.4/plugins
ln -s 
  $ECLIPSE_PLUGINS/org.eclipse.jdt.core_3.4.0.v_874.jar 
  $ECLIPSE_PLUGINS/org.drools.eclipse_4.0.7/lib

Sunday, July 13, 2008

Getting "Client.InvalidKeyPair.NotFound" Error With Selenium Grid

When running the cap grid:boot command, I received the following error:

Client.InvalidKeyPair.NotFound: The key pair '/home/medined/.ec2/affy.pem' does not exist
It turned out that the EC2_KEYPAIR_NAME system variable was set incorrectly. You can find the correct value using the ec2-describe-keypairs command. Here is an example of its use:

$ ec2-describe-keypairs
KEYPAIR affy c3:e7:5f:09:50:66:f5:2b:3d:2b:ac:1d:09:52:9d:34:29:85:1b:76

So the correct value for me is affy, not the filename.

Saturday, July 12, 2008

Using Capistrano to Bundle Amazon EC2 Images

I've found the following bit of Capistrano script to be useful when tinkering with EC2 images. I can make a change and then bundle the image with just one command: cap admin:bundle

The most difficult part of this script was finding out how to upload files to the remote instance using scp. The rest is fairly straightforward. I am only posting this script because I haven't seen this functionality posted anywhere else.

# capfile for Amazon EC2 Bundling. Normally, a yaml file would be
# hold configuration parameters. I am using environment 
# variables because they are also used by the EC2
# programs - why have the information in two places?

# This script assumes that you are only bundling one
# instance at a time.

# EC2 Instance Hostname to be bundled.
ec2_hostname = ENV['BUNDLE_EC2_HOSTNAME']

# S3 Bucket Name (where the bundle is uploaded)
s3_bucket_name = ENV['BUNDLE_S3_BUCKET_NAME']

# If you are using ElasticFox (and if not, why not?) that
# you created in the KeyPairs tab. Specify the full
# path to the file.
ssh_keypair_file = ENV['BUNDLE_SSH_PRIVATE_KEY_FILESPEC']

# Amazon Web Services Info
amazon_account_id    = ENV['AMAZON_ACCOUNT_ID']
amazon_access_key_id   = ENV['AMAZON_ACCESS_KEY_ID']
amazon_secret_access_key = ENV['AMAZON_SECRET_ACCESS_KEY']

# Amazon EC2 Info
cert_filespec     = ENV['EC2_CERT']
private_key_filespec   = ENV['EC2_PRIVATE_KEY']

# We are only dealing with one EC2 instance.
role :libs, "#{ec2_hostname}"

# I like working with ElasticFox which seems to only
# support using the root user.
set :user, "root"

ssh_options[:keys] = ssh_keypair_file

namespace :admin do

 task :bundle do

  # Copy the certificate and private key to the remote computer.
  upload("#{private_key_filespec}", "/mnt", :via => :scp) 
  upload("#{cert_filespec}", "/mnt", :via => :scp)

  # Extract just the filename from the filespec.
  private_key_filename_start = private_key_filespec.rindex('/') + 1
  private_key_filename_end = private_key_filespec.length
  private_key_filename = private_key_filespec[private_key_filename_start, private_key_filename_end]

  # Extract just the filename from the filespec.
  cert_filename_start = cert_filespec.rindex('/') + 1
  cert_filename_end = cert_filespec.length
  cert_filename = cert_filespec[cert_filename_start, cert_filename_end]

  # Remove any old image.
  run "rm --force /mnt/image /mnt/image.*"

  # Create the EC2 Bundle
  #run "ec2-bundle-vol -d /mnt -c /mnt/#{cert_filename} -k /mnt/#{private_key_filename} -u #{amazon_account_id} -r i386"

  # Upload the EC2 Bundle to S3
  run "ec2-upload-bundle -b #{s3_bucket_name} -m /mnt/image.manifest.xml -a #{amazon_access_key_id} -s #{amazon_secret_access_key}"

  exec "ec2-register #{s3_bucket_name}/image.manifest.xml"

 end

 task :update do
  run "apt-get update"
  run "apt-get upgrade -y"
 end

end
Zemanta Pixie

Thursday, July 10, 2008

Using SCP with Capistrano

It took me several hours to find out how to send a file to my remote computer via scp using Capistrano. It's actually quite easy. There is a method called upload which has a via option. Here is an example of its use:

upload("products.txt", "/home/medined", :via => :scp)

If you need to change the files name, you can also specify it in the second parameter. For example,

upload("products.txt", "/home/medined/products_new.txt", :via => :scp)
Zemanta Pixie

Wednesday, July 09, 2008

Capistrano, ElasticFox & EC2

What a nice combination of tools! I just installed Capistrano and created a capfile. From then on, I could run commands across all my virtual istances in one shot. This setup took just minutes. The only change that I made to my existing instances was to add a capistrano userid. My capfile looks like this:

role :files, 
  "capistrano@ec2-75-101-225-105.compute-1.amazonaws.com", 
  "capistrano@ec2-67-202-59-118.compute-1.amazonaws.com"

namespace :files do
  desc "Show free disk space"
  task :show_free_space, :roles => :files do
    run "df -h /"
  end
end

The best thing of all? No XML configuration!

Monday, July 07, 2008

ElasticFox: How to SSH to Amazon EC2 Image Without Entering a Password

1. Download and install the ElasticFox plugin.
2. Enter your credentials.
3. Enter your account information.
4. Select the KeyPairs tab.
5. Click Create a New Pair.
6. Save to a file; for example ~/.ec2/affy.pem.
7. Select the AMIs and Instances tab.
8. Click Launch Instance(s).
9. In the dialog box, select the keypair that you created in step 5.
10. When the AMI is running, you should be able to connect to it without a password prompt.

Sunday, July 06, 2008

Captain Kirk Teaches SCRUM and Agile Development

Episode One: Change the Playing Field

"The odds are against us and the situation is grim." - Star Trek: Generations

STARDATE 11234.2

Students, Starfleet has asked to me say a few words about SCRUM while I'm visiting your base. Fortunately, my meeting with the Ambassadors isn't until 0930 so I have just enough time to talk and then answer a few questions.

Some years ago, I was in a situation that by most accounts (especially Bones') would be considered bleak. Our software team was handed a Klingon application to calculate the expansion rate of exploding warheads. Our Quality Assurance staff was located in the beta quadrant. While my Klingon interpreter and product owner (Kveld of house K'mpok) was in the brig for attempting to kill Scottie. I needed to act, and fast! But what were my options?

Yes, I could have outsourced the work to the Romulons. But they are the enemy! Let's get serious. Other suggestions?

Ok, that's another approach. We could bring everyone together onto a single starbase to form a co-located team. That suggestion is a classic. And workable except for the inter-species issues. My product owner, the klingon in the brig, is also responsible for other projects. He can't be co-located for all of them, can he? Additionally, co-location means additional costs in the form of housing, food, time away from family. In this situation, co-location is not possible.

Hmm. Good idea. Use the holodeck as a virtual meeting room. I like that and that is the approach that we took. Along with some others as well.

Since the team is so dispersed the issue of time was quite important. The team agreed to a daily standup (a scrum, some like to say) but at what time? The meeting time changed every three months. Thus, no one location was impacted more than another - all were inconvenienced equally.

Scottie agreed to import a case of Ra'taj for Kveld and to refrain from further mentioning his mother's similarity to a Gagh.

The approach that I take to every situation is:

What is the operant set of relationships and rules? And how can they be changed to resolve the issue?
Once you know how the forces arrayed against you are deployed, you can find the levers needed to tip the scale in your direction.

Any questions?


Thank you.

Dup dor a'az Mubster (live long and prosper)