---
Whether I shall turn out to be the hero... sorry, wrong story. This is a tale about my own experiences writing a charm for Juju. I kept lots of notes along the way because I wanted to be able to improve the documentation. But some of the points along the way may be interesting to someone.
Juju, for those who don't know, is a service orchestration tool. With the aid of "charms" (which are essentially a special little bundle of scripts) it can easily deploy and scale services to common cloud providers (AWS, Azure, HPCloud...) or your own personal cloud (OpenStack, or even your local machine with the aid of containers). So, if you want to run anything from a mediawiki site to OpenStack itself, you can do it with Juju.
The only proviso is, there needs to be a charm for the service you want to use. There are quite a few charms already available, if you take a look at the http://manage.jujucharms.com/charms page, you will see there is a fair list of useful things. You can even play with installing services with Juju with the GUI demo at https://jujucharms.com/
Choosing a charm
Anyhow, before we get carried away with that, how do you choose a charm to write? Well, if you have a service in mind which doesn't already have a charm, you are all set. In my case I wanted to choose something that would be useful to me and other people, and involve a bit more complexity than simply porting another webapp.So, I took a look at the "Charms wanted" list. These are filed as bugs in launchpad against the Juju charms project, so you just need to visit https://bugs.launchpad.net/charms/+bugs?field.searchtext=charm+needed
and choose something. If you have a service in mind, it is useful to check here first in case someone is already working on it.
I chose to write a charm for Sheepdog. This is a clustered storage service which works particularly well with images for KVM. As well as being quite useful, it is certainly a more complicated service in terms of the things the charm will need to do. (you can read more about Sheepdog here: http://sheepdog.github.io/sheepdog/)
After "claiming" the charm in launchpad, I set to work.
First steps
There are plenty of parts to writing a charm, but there is no point in getting ahead of ourselves. I had a good idea how sheepdog worked, but having never actually deployed it, the obvious first step was to install it and try it out.As I would actually need to install it on several machines, I decided to make use of QEMU/KVM myself to create some instances I could use to install it. I downloaded the latest Ubuntu Server image (trusty) and then installed virt-manager (because it makes dealing with qemu that bit nicer).
Once I had created a vanilla install, I cloned the image - it is always useful to keep a vanilla version in case you need to start again.
After reading through the sheepdog documentation (which isn't extensive to be honest) I realised that the simplest setup for sheepdog would be to configure it for use against corosync. Corosync is a service which handles the communication between nodes in a cluster. As luck would have it, there are packages for both corosync and sheepdog in Ubuntu. I installed both, started their daemons, and nothing worked. I wasn't really expecting it to, but I decided to save delving into the configuration options for another day.
Current scores: progress+2, sanity -1, cups of coffee drunk 5
