One of the things about working on Cloudify is that I use a bunch of different linux distributions at the same time. We have Cloudify users running RHEL, Suse, CentOS, Fedora, and a whole bunch of others. (Cloudify works on DamnSmallLinux too!)
With this kind of work, you want to be able to test your changes as quickly as possible. That’s what the Cloudify-iTests project is for – a suite of integration tests using just about every feature Cloudify has to offer. More often then not I’ll use the IDE to run a couple of tests, but this can be a pain to set up on a remote machine.
In this post I’ll show you how to quickly (ok, not that quickly) run an integration test on a remote machine of your choice using the console.
I’ll be using Ubuntu for this example, but that mostly matters just for installing some basic tools.
Here are the tools we will need:
- Java – We’ll need Oracle JDK 6 to compile. (Cloudify can run on any JDK, Including OpenJDK7, but we compile with Oracle JDK 6)
- git – Distributed source code control.
- maven – Java build tool.
- ant – another Java build tool. Useful for automating simple tasks.
First, let’s set up our work directory
Now let’s install java. Since this tends to be tricky using package managers, let’s just install this one manually.
On a 32-bit system:
On a 64-bit system:
Not sure if you are on 32 or 64 bit? That happens more then you think on the cloud, with image descriptions not always as accurate as they should be. Just run
If the output has ‘x64’ anywhere, it’s 64 bit.
To install java locally
chmod +x ./java.bin
and follow the onscreen instructions.
Now to set up the Java environment:
Now we’ll use apt to install the rest of the tools:
sudo apt-get -y install git ant maven
Ok, the tools are all set, let’s grab a copy of Cloudify and untar it. A download link to the latest milestone build is available at the early access page.
tar xvfz cloudify.tar.gz
And set up the Cloudify Home environment variable
Right, let’s go ahead and grab the cloudify sources:
And build the cloudify components from the sources:
This will take a while the first time you run it – the maven build system is plugin based, and plugins are downloaded the first time they are needed – and there are a lot of them. The good news is that you only have to do this once, next time will be much quicker.
Now that you’ve built the components, let’s copy them into the cloudify home directory:
ant -f copy_jars_local.xml
Now you have the absolute latest and greatest (and occasionally slightly buggiest) code in your cloudify home directory.
Let’s see how to run a simple integration test. A typical local cloud integration test bootstraps a local cloud, runs some CLI command against the local cloud, including installing services and applications, and then uninstall everything and tears down the localcloud. We’ll just run the travel application sample – all of the services in the travel applications use Java, so it generally works everywhere Cloudify does.
mvn -Dtest=org.cloudifysource.quality.iTests.test.cli.cloudify.recipes.examples.ProductExamplesTest#installTravel test
Again, maven will download a few (a lot, actually) new plugins, but this will only happen once.
That’s is. You now have a Cloudify working environment.
Now go make an image from the system you are using so the next guy can use it too. Welcome to the cloud 🙂