GIT SSH keys with Hudson on Ubuntu’s Tomcat

I’ve recently covered how to configure git with Hudson on Ubuntu’s Tomcat and it has worked quite well. After taking the plunge and subscribing to have private repositories on github I ran into an issue of not being able to clone the private repository since it was… well, private.

Here is the message I was seeing:

ERROR: Error cloning remote repo 'origin' : Could not clone https://username@github.com/username/repository.git
ERROR: Cause: Error performing git clone -o origin https://username@github.com/username/repository.git /srv/hudson/jobs/repository/workspace
Trying next repository
ERROR: Could not clone from a repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:587)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:535)
at hudson.FilePath.act(FilePath.java:753)
at hudson.FilePath.act(FilePath.java:735)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:535)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1038)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
at hudson.model.Run.run(Run.java:1257)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:129)

To solve the problem we need to create an ssh key for the tomcat user so that it can access the repository.

cd /usr/share/tomcat6
sudo mkdir .ssh
cd .ssh/
sudo touch known_hosts
sudo ssh-keygen -t rsa -C "tomcat@forthedeveloper.com"

When creating the key pair save the key to /usr/share/tomcat6/.ssh/id_rsa.

I don’t know how to tell tomcat the passphrase for a ssh key, so I just left the passphrase blank.

Once the key has been created we need to add the github site to the known_hosts file. If you have already setup your normal account for working with github and have xclip installed you can run the following to copy the github ssh host information:

ssh-keygen -F github.com | xclip -sel clip

Edit the /usr/share/tomcat6/.ssh/known_hosts file and paste in the copied host information.

To finish things up:

sudo chown -R tomcat6:tomcat6 /usr/share/tomcat6/.ssh/
sudo /etc/init.d/tomcat6 restart

You can copy the new ssh key for tomcat to your clipboard if you have xclip installed with:

cat /usr/share/tomcat6/.ssh/id_rsa.pub | xclip -sel clip

If you are only using hudson for one repository you can just add the public key to the one repository in the repository admin (ex: https://github.com/username/repository/edit) under the ‘Deploy Keys’ area. Otherwise you can add it to your account’s ‘SSH Public Keys’ to allow the tomcat server access to all of your repositories.

Now when you run hudson against your private github repository it should have the proper access.

GIT Configuration with Hudson on Ubuntu’s Tomcat

During my recent migration from using SVN to using GIT for my open source projects I was reconfiguring my Hudson CI server and started seeing this message:


Caused by: hudson.plugins.git.GitException: Command returned status code 128:
*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

Google AJAX Library CDN Versioning

It’s amazing what you find when you read the documentation. Since I always forget the address for Google’s CDN hosting of jQuery I have to search for it each time. This time when I found the address I was looking around a bit and found out this interesting tidbit that I didn’t know before about Google’s CDN for their AJAX libraries.

Specifying a version of “1.8.2″ will select the obvious version. This is because a fully specified version was used. Specifying a version of “1.8″ would select version 1.8.4 since this is the highest versioned release in the 1.8 branch. For much the same reason, a request for “1″ will end up loading version 1.9.1.

Google AJAX Libraries API Developer’s Guide

Railo Express with Multiple Local Hosts

This is how you can configure Railo Express to use Jetty virtual hosts and local host file entries to point to a single Railo Express installation. This was extremely useful while developing applications that power multiple domains.

Local Host Entries on OS X Snow Leopard

Today I wanted to setup local host entries on my MacBook. Searching around I found several articles about editing the /private/etc/hosts file to add local domains entries pointing back to my computer. I don’t know if it is something that changed with Leopard or Snow Leopard but it just wasn’t working for me. Even restarting the computer was a no go.

ColdFusion 9 Ternary Operator Fail

One of the things that I was really excited for in ColdFusion 9 was the support for the ternary operator. As Ben said:

To me, the ternary operator is what the IIF() method call always wanted to be.

Unfortuately I was testing some CFML code, written and working on Railo, on a ColdFusion 9 server and had this error pop up:

Unable to find an operator implementation for coldfusion.compiler.ASToperator

Turns out the the ternary operator works great… unless you are using it in a default value for an argument. Fail.

ColdFusion Development using VirtualBox and Ubuntu 9.10

Here is how I setup a VirtualBox Virtual Machine (VM) running Ubuntu 9.10 Server edition for ColdFusion development on my MacBook Pro.

Upgrade Jetty in Railo Express

There was a bug in Jetty that was causing MXUnit ant tests to not work because it was double encoding the cookies. The bug was fixed in Jetty but Railo had not released a new Express version with the fix.

Automate WordPress Upgrade on Grid Server

Many of the domains and sub-domains on my Media Temple Grid Service contain installations of WordPress. Since I don’t want to be bothered by a normal upgrades here is how I install WordPress in a way that allows for simple upgrades.

This is not a completely automated solution, there is more that you could do to improve the process, but it should save a lot of the time normally spent updating WordPress.

AIR Update Checking Using Mate

While working on an AIR project hosted on Google Code I wanted to setup automatic updates. I wanted the entire project to be self contained and not require any supporting websites. After a little coding I can now use Mate and dispatch an event to check for updates.