jmit's "wrappz" charms

Jorge O. Castro jorge at
Wed Feb 29 14:54:17 UTC 2012

I noticed James Mitchell modifying some charms on Launchpad and
pushing them up to his branch and I asked him what was up and it
looked interesting so I'm sending this back to the list with his
permission. I think it's a good example of how people can reuse charms
for their internal deployments.


No problem - thanks for the contact.
I actually uploaded to Launchpad after m_3 (I thinks) in IRC mentioned
that my use case sounded interesting.
You also commented on my question on askubuntu about specifying instance
sizes for juju services.

Juju is my first stab at using EC2, since firing up a instance and
installing with the ec2 commandline tools looked like a drag. Juju
really makes it all very easy...

Basically I'm testing deployments of some production websites onto EC2.
The sites currently sit on single servers hosting apache+mysql - so they
can't be scaled...
Using juju and ec2 I can practice a proper 3 tier deployment and scale
the apache servers (and mysql databases) to match demand.

I already have a pretty automated deployment, so I just had to translate
that into juju.

The 3 key parts after the server is running are

1. install the website code
I cheat on this, and just do a bzr checkout of the code.
However the code is on a private server, and the ec2 instance needs a
valid private RSA key in order to use bzr+ssh to get the code - at the
moment I have the key in the config dir, but I should perhaps move it to

2. pre-populate the database with "static" site data
First I have a script that creates empty database tables, then I grab a
recent database dump from s3 and use that to populate the tables

3. copy across the site imagery
These product images match the initial data, and again come from s3
*but* it was taking too long to transfer the 2gb file from s3 and unzip
it in the instance... so I decided I needed to use an EBS volume that
already has the images loaded.
Since it has the images, it can also have a checkout of the repository
(and my step 1 above notices this and does a bzr update).

So that is when I started needing to attach and EBS volume from inside
the instance. This is nice because I can then snapshot that volume for
backup without taking all the juju infrastructure as well.
It also makes sense for me to use the same technique to mount an ebs
volume for the mysql data.

After all this it works and I have a scalable site (hurrah!).

The drawback is the amount of private keys and such that needs to be
added to the charms (and which I have not put in Launchpad :)

I wonder whether the ability to mount ebs volumes might be useful enough
to add to the juju infrastructure? Perhaps in zookeeper? (is that the
right bit?) Maybe S3 transfers?
It seems to me that the AWS key codes and X.509 certificates to make it
work should be available to charms from the juju environments.yaml
... ok I see that the access and secret keys are already there; perhaps
I should ask how I should access them... :)

Sorry, that is a bit too long - I hope there is something in there for
* juju is very cool
* I have managed to deploy my site using juju
* I would love to be able to put more aws credentials into the
environments file, so I can attach and mount (and create and snapshot)
ebs volumes easily
* Being able to define an instance size for a service will be nice when
it is ready


More information about the Juju mailing list