RSS

Category Archives: java

jclouds at Gluecon 2013

It’s time to hit the road, get some hands on keyboards, and really teach developers how to use jclouds. I’ll be giving a workshop titled “Solve the Cross-Cloud Conundrum with jclouds” at Gluecon this year. The session is on May 22 from 10:30 to 11:30 am in Breakout 2.

Gluecon

GlueconWhat is Gluecon? In their own words, “Cloud, Mobile, APIs, Big Data — all of the converging, important trends in technology today share one thing in common: developers. Developers are the vanguard. Developers are building in the cloud, building mobile applications, utilizing and building APIs, and working with big data. At the end of the day, developers are the core.”

I firmly believe that to be true. Developers are the new kingmakers because software is eating the world.

My preference for these kinds of sessions is to get developers doing what they do best. The workshop includes an overview of jclouds, its terminology, and its community then it quickly gets down to development. First, we’ll install jclouds for use on the command line during the workshop. Then we’ll work through an example of using jclouds to start virtual machines in multiple clouds.

Rackspace will be offering free cloud trial accounts to the attendees of this session. It’s our way of helping you get started in the cloud and say thanks for coming out.

Coda

The reason to use jclouds is to control your cloud infrastructure with Java. In this workshop I’ll be showing you exactly how to do that.

 

Contributing OpenStack Support to jclouds

Guava

Update: Folsom instructions

jclouds is a popular cross-cloud toolkit that covers an impressive number of public and private cloud providers. OpenStack is among these providers and the OpenStack ecosystem benefits from good support in jclouds because it allows developers who are comfortable with Java or jclouds to easily adopt OpenStack and it enables hybrid cloud development. Likewise, jclouds benefits from good OpenStack support because OpenStack is a popular Infrastructure as a Service provider and already has deep roots in the open source community.

A number of times on the jclouds-dev mailing list and IRC I’ve seen developers who want to help contribute OpenStack support to jclouds but aren’t entirely sure about how to go about it. There are a number of things you need to get started.

  1. A jclouds development environment
  2. Some background on jclouds development
  3. An OpenStack test environment

jclouds dev env

To setup a jclouds development environment start at their Developer Resources page. From there the most relevant page is Contributing to the jclouds Code Base. If you’re an Eclipse user, you’ll want to check out Using Eclipse. Learning about Testing in jclouds is essential and the Additional References and Guides for Advanced Users also contains a wealth of design and implementation documentation. You might also want to browse through the jclouds-dev mailing list.

jclouds dev background

The foundation of jclouds is built upon Google’s general purpose library Guava and their lightweight dependency injection framework Guice. You don’t necessarily have to know these to start contributing but being aware of it and having the reference documentation on hand will be helpful. To talk to OpenStack’s RESTful web services jclouds uses the Java API for RESTful Web Services (JAX-RS).

OpenStack

For those unfamiliar with setting up an OpenStack dev/test env this can be a daunting task. There are a number of ways to do it and often it boils down to a developer’s preference on how they want to deploy it…so I’ll share my personal preference. :)

My OpenStack test env consists of VirtualBox running an Ubuntu 12.04 Server (Precise Pangolin) virtual machine with devstack. This guide assumes you’re comfortable installing Ubuntu on VirtualBox and know your way around the command line and git.

  1. Download and install VirtualBox
  2. The networking can be a bit tricky and I’ve already addressed this in the ServerFault question What is the correct network configuration for a devStack VM (virtualbox)?
  3. Download the 64-bit PC (AMD64) server install CD of Ubuntu 12.04 and create a VirtualBox VM with it
  4. Once it’s ready to go you should be able to login to it from your terminal
    1. ssh myusername@172.16.0.1
  5. Once logged in, take a break, and have a look at the instructions for devstack
  6. If you want a release branch of OpenStack (e.g. Essex, Folsom, etc.), you need to do things a little differently
    1. Essex:
    2. git clone https://github.com/openstack-dev/devstack.git -b stable/essex devstack/
    3. Folsom:
    4. git clone https://github.com/openstack-dev/devstack.git -b stable/folsom devstack/
    5. In the devstack/ directory create a localrc file that only uses release branches only
      1. Essex example
      2. Folsom example
  7. If you want the latest and greatest master branch of OpenStack, in the devstack/ directory, create a localrc file like this
  8. In both cases
    1. Change to your devstack directory
    2. Run stack.sh
    3. When it completes, configure Keystone to return the VM’s “public” IP
      1. Essex:
      2. sed -i "s#publicURL = http://10.0.2.15#publicURL = http://172.16.0.1#g" /etc/keystone/default_catalog.templates
      3. Folsom:
      4. mysql -uroot -pdevstack keystone
      5. update endpoint set extra = replace(extra, '"publicurl": "
        http://10.0.2.15
        ', '"publicurl": "
        http://172.16.0.1
        ') where instr(extra, '"publicurl": "
        http://10.0.2.15
        ') > 0;
    4. Kill the existing screen session (that contains all of the OpenStack services)
      1. screen -X -S stack quit
    5. Restart screen (with all of the OpenStack services)
      1. screen -c stack-screenrc
  9. Outside of the VM, back on your local machine, you should now be able to follow the instructions in my post jclouds and OpenStack to verify that everything is working as expected
  10. Once you’ve verified it’s working, then port the jclouds and OpenStack example into your jclouds dev env and go from there

Coda

Clearly it’s non-trivial to get a full development/test environment like this up and running. However, the benefits are a healthier OpenStack ecosystem that’s inclusive of the many Java developers around the world.

This post was written on Mac OS X 10.7.4, Java 1.6.0, jclouds 1.5.1, and OpenStack Essex/master.

 
Leave a comment

Posted by on October 3, 2012 in devstack, java, jclouds, openstack

 

OpenStack and jclouds Releases Within Days of Each Other…Coincidence?

milestoneTwo open source projects that I’m proud to be a part of have just had major releases within days of each other.

There’s OpenStack, which powers the Rackspace open cloud, with its eagerly anticipated Folsom release. This release sees the introduction of the Network Service (Quantum) and Block Storage Service (Cinder) among many other additions and improvements. For an overview of all of the components and projects it’s tough to beat Ken Pepple’s OpenStack Folsom Architecture post. I made it onto the contributor list this time around for fixing a minor bug and it’s an honor to be on that list with so many great developers. To get an idea of the scope of contributions to OpenStack just spend some time Looking at the Numbers.

Then there’s jclouds, the Java cross-cloud toolkit with its release of their 1.5 branch. I’ve made a fair number of contributions to this project by improving the support for OpenStack and Rackspace. During that time I’ve become part of their community and  have seen first hand the passion and commitment they have toward releasing a high quality toolkit. The jclouds user base is growing rapidly and it’s easy for me to see why.

To top it all off I get to present jclouds directly to the OpenStack community in a workshop titled Control the Clouds: Developer Experience with jclouds at the OpenStack Summit in San Diego. The workshop is on Thursday, October 18 at 3:20 pm. We’re going to be writing some writing some Java code to fire up some servers. If you’re attending the Summit, please join us!

Coda

So is it a coincidence that OpenStack and jclouds had major releases with days of each other? Yes, definitely, absolutely it was. But for me it was more like serendipity. These two great projects have truly come into their own and these releases are well deserved milestones on the road ahead.

 
Leave a comment

Posted by on September 28, 2012 in java, jclouds, openstack, rackspace

 

jclouds @ the OpenStack Summit

San Diego

I’m attending the OpenStack Summit from Oct. 15-18 in San Diego. I’ve submitted a session titled Control the Clouds: Developer Experience with jclouds. Sessions are voted in so, if you’re inclined, please vote for my session. You’ll need to do a Find in Page for “jclouds” on the voting page. The deadline for voting is Sept. 13 and here’s a description of the session.

In this session, you will learn how to write code that can control any cloud with jclouds.

Developers tend towards cross-platform solutions. Many popular languages and toolkits can run on many operating systems and devices. HTML and the web browser are the prime example of this trend. The benefits are clear, it gives developers the most bang for their buck when it comes to learning new skills and reaching the widest audience.

The cloud has emerged as the next major platform. So where do developers turn for cross-cloud toolkits?

For Java, the answer is jclouds. jclouds is an open source cross-cloud toolkit that works with both public and private clouds, enabling hybrid cloud workloads. The list of supported clouds includes AWS, Azure, vCloud, HP Cloud, OpenStack, and the Rackspace Open Cloud. There is a great community behind this toolkit working together to provide a better experience for developers in the cloud. Their goal is to simplify the control of many different clouds while still giving you the freedom to use cloud-specific features. The result is a toolkit that allows developers to write better code, in a shorter period of time, that works with any cloud.

In this session, I will demonstrate these qualities of jclouds. If you’re so inclined, you’ll be able to follow along with the demostration and write your own code that works with any cloud (hotel wifi permitting ;)

Prerequisites if you choose to follow along:
* JDK 1.6
* Cloud accounts such as:
trystack.org
hpcloud.com
rackspace.com/cloud/public/

If you’re going to be at the Summit as well and you’d like to meet up, just let me know in the comments!

 
Leave a comment

Posted by on September 8, 2012 in java, jclouds, openstack, rackspace

 

Logging in jclouds

TL;DR For basic header and wire logging in jclouds:

  1. Download logback
  2. Put the JARs on your classpath
  3. Put this logback.xml on your classpath
  4. Use the SLF4JLoggingModule()
  5. Run

I’m still learning jclouds and one thing that helps me out a lot is if I can get some insight into what’s going on under the hood. Specifically, since what we’re really doing is talking to an HTTP API, I like to be able to see what’s going over the wire. Fortunately jclouds allows for some pretty fine grained logging out-of-the-box and it’s relatively easy to configure too…once you know where everything goes. ;)

jclouds itself uses SLF4J Logging in its examples so let’s try that. I’m building off of my previous post Getting started with jclouds so the directory structure is the same as that. Here’s the Java app I’m using to try this out. You can see the use of SLF4J Logging from line 43 where I add the SLF4JLoggingModule to a list of modules to be injected into the ComputeServiceContext.

Now we compile and run it.

Clearly I’m missing something. Googling the error quickly reveals that “Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.”

I’ve noticed that the jclouds source code contains logback.xml a bunch of times (for example this one) so I’ll use logback too. From the logback download page I grab the latest tar.gz. Once unzipped I copy the logback-core-x.x.x.jar and the logback-classic-x.x.x.jar into my lib directory. I also realize that I’ll need to configure the logback for myself as well. Working from the example I trim it down to the absolute minimum of what I need.

Then I place the logback.xml file in my top level directory and give it another go.

Success! Let’s see what we’ve got.

Lines starting with “>>” are requests.

Lines starting with “<<” are responses.

The JSON at the beginning of a request or the end of a response is the body of the request/response.

Here’s basically what jclouds does when listing servers (aka “Nodes” in jclouds terminology).

  1. Authenticate to get a token
  2. List all servers in detail in the “ORD” zone
  3. List all servers in detail in the “DFW” zone
  4. List all images in detail in the “ORD” zone
  5. List all images in detail in the “DFW” zone
  6. List all flavors in detail in the “ORD” zone
  7. List all flavors in detail in the “DFW” zone
  8. Mash all of the relevant details together into ComputeMetadata objects and return the results

That’s a lot of requests just to list servers. I think I understand the tradeoff from jclouds perspective though. Either you can return a really useful list of servers with all the possible info you might need or you can force the user to fetch that detail as they need it. From a usability perspective it’s better just to grab it all at once.

One thing I see missing from the request headers is the User-Agent header. Unfortunately it doesn’t get logged as this header is added to the request in JavaUrlHttpCommandExecutorService.java after the headers have been logged. Oh well, we can see everything else we need to.

This post was written on Mac OS X 10.8, Java 1.6.0, jclouds 1.5.0-beta.10. If you’re on a different OS and run into problems, please feel free to comment.

 
Leave a comment

Posted by on August 18, 2012 in java, jclouds, openstack

 

LinkedIn Profile

I finally got around to updating my profile on LinkedIn. If you are interested in retaining my services as a Java/Python Software Developer and Senior IT Consultant please see
http://www.linkedin.com/in/EverettToews
.

 
Leave a comment

Posted by on July 26, 2009 in java, linkedin, python

 

Administration console in Websphere Portal Server v5.1

When using Websphere Portal Server v5.1 Test Environment in Rational Application Developer as configured out of the box you will get the error message “This portlet is unavailable.” when you open the Administration console of WPS.


To get the Administration console working you need to follow these steps.

  1. Open the Servers View in RAD
  2. Right click on WebSphere Portal v5.1 Test Environment > Open
  3. Switch to the Portal Tab
  4. Check Enable base portlets for portal administration and customization
  5. Save your changes, restart your server and go back to the Administration console


 
Leave a comment

Posted by on August 19, 2008 in java

 
 
Follow

Get every new post delivered to your Inbox.