Setup HyperDex on AWS in 10 Minutes with Juju

Juju is a new way to automate cloud infrastructure using easy-to-use commands as well as a web GUI. It enables you to easily deploy your applications to a variety of cloud-like management architectures, including EC2, OpenStack, Azure, and your local Ubuntu installation. Central to Juju's distributed systems magic is the notion of a Charm---an application-specific asset that defines how to keep services running.

Using Juju, we can easily setup and administer an AWS environment for HyperDex. Juju makes this process so easy that we can literally go from nothing to a ready-to-test HyperDex cluster in just 10-minutes.

Installing Juju

To start with, you'll need to install Juju. On Ubuntu, this is just two commands:

$ sudo add-apt-repository ppa:juju/stable
$ sudo apt-get update && sudo apt-get install juju-core

Installing on OS X is similarly easy:

$ brew install juju

Now that you've got Juju installed, let's point our Juju install at our AWS account. You'll need your AWSAccessKeyID and AWSSecretKey that you can get from your AWS management console. Run the following command to generate the config:

$ juju generate-config
$ nano ~/.juju/environments.yaml

Look for the block labelled amazon: and change the access-key: and secret-key: blocks and set them to your key id and secret key respectively. If you run into difficulty, the Juju docs can help with troubleshooting this step.

Now that we have a working Juju environment, let's use it to deploy HyperDex.

Deploying HyperDex with Juju

Deploying HyperDex on Juju is a three step process that fetches the HyperDex Charm, bootstraps Juju onto EC2, and finally deploys HyperDex itself. First, let's fetch the HyperDex Charm:

$ mkdir precise
$ git clone precise/hyperdex

We now now have the local Charm ready to go with Juju. Let's bootstrap Juju onto EC2:

$ juju bootstrap

This process could take a few minutes, as it initializes a new EC2 instance to manage your Juju environment. When it completes, you can then deploy HyperDex with:

$ juju deploy --repository=`pwd` local:precise/hyperdex

Like the previous step, this will launch a new EC2 instance, and will deploy a single-node HyperDex cluster on it. This command runs in the background. To track its progress, you can use juju debug-log to see the output as the Charm installs and deploys HyperDex. When you see the following lines in the log, your cluster is ready to go:

2014-05-22 13:32:41 INFO start * Starting HyperDex coordinator hyperdex-coordinator
2014-05-22 13:32:42 INFO start * Starting HyperDex daemon hyperdex-daemon

Now that you have a HyperDex cluster ready to go, it's a great time to use it to step through the HyperDex QuickStart Tutorial. You can skip the parts of the tutorial related to setting up a cluster---it's already done for you by Juju. Login to your machine and get started with the tutorial like so:

$ juju ssh hyperdex/0
$ hostname
$ python
>>> import hyperdex.admin
>>> a = hyperdex.admin.Admin('ip-172-31-27-22', 1982)

The only difference between this and the tutorial is that we're using the hostname of the machine as the coordinator address, not the address Wherever you see in the tutorial, replace it with the output of the hostname command.

Cleaning Up

Your HyperDex instance on EC2 will continue to run even after you shut down your local computer. Once you go through the tutorial, you may clean it up with one simple command:

$ juju destroy-environment amazon
WARNING! this command will destroy the "amazon" environment (type: ec2)
This includes all machines, services, data and other resources.

Continue [y/N]? y

This will shutdown HyperDex and release all associated EC2 resources.

Going Forward

Our Juju Charm is still quite new, and doesn't support many of the features of Juju (yet). If you would like to use this Charm in production, we recommend contacting the HyperDex team first, so that we can help make sure the Charm meets your needs. Here are some things that Juju supports that we would love to have the HyperDex Charm support as well:

  • Attach Amazon EBS volumes to store HyperDex data, instead of using the EC2 ephemeral storage. This will enable you to manage production clusters with Juju.
  • Support the add-unit command of Juju. Scale up HyperDex with a single command.
  • Add support for automatic discovery of HyperDex using Juju's relations.

Keep an eye on this blog, and on our GitHub repo for the HyperDex Charm to watch for these feature and more.

Further Reading

  • Juju Homepage: the best place to start for all things Juju. Go here to discover more about Juju and learn how to write your own Charms
  • OpenStack Summit Keynote: Learn more about the OpenStack ecosystem in this Keynote delivered by Mark Shuttleworth.
  • HyperDex Tutorial: Get started with HyperDex quickly, and learn about what it has to offer.
Share on Linkedin
Share on Reddit
comments powered by Disqus