What is juju ?

Juju is a next generation service orchestration framework. It allows software to be instantly deployed, integrated and scaled on any cloud or server. In a simple language JUJU is an open source service orchestration management tool developed by canonical, the company behind Ubuntu. It has been linked to APT for the cloud. With Juju, different authors are able to create service formulas, called charms, independently, and make those services coordinate their communication and configuration through a simple protocol.

Ok, what is a Charm now?

The “magic” behind Juju are called Charms. Charms can be written in any programming language that can be executed from the command line. A Charm is a collection of YAML configuration files and a selection of “hooks”. A hook is a naming convention for the script files which are used to install software, start/stop a service, manage relationships with other charms, upgrade charms, scale charms, configure charms, etc. Charms can have many properties. So a charm is written by keeping a specific software in mind and then creating the related configuration and script (hook) files.

Installing juju on Ubuntu local environment.

In order to use Juju you need to install the juju framework on a platform of your choice. We are going to use the local platform that is our local ubuntu 12.04.

sudo apt-add-repository ppa:juju/stable
sudo apt-get update
sudo apt-get install juju-local linux-image-generic-lts-raring linux-headers-generic-lts-raring

Configure juju for local environment

juju generate-config
juju switch local

once the environment is set to local you are all set to use juju and charm.

Start using juju:

In order to start using juju you need to bootstrap the environment. A bootstrap is the process of starting up a computer. It also refers to the program that initializes the operating system during start-up. On a local install Juju usec LXC containers, which creates a chrooted environment once bootstrapped.

To bootstrap we run the following command.

sudo juju bootstrap

Now when the environment is bootstrapped you can deploy the charms on it.

Deploying a charm

to deploy a charm

juju deploy <charm-name>

once a charm is deployed it is installed in the chrooted environment that is created by the LXC container, each application gets an ip and go through different phases like Pending, Installed, Configuration changed, Started, Stopped,Relation Joined,Relation broken etc. through its entire life-cycle

To check status of the deployed charm

juju status

To add relation

juju add-relation <charm1> charm2>

To destroy a relation

juju destroy-relation <charm1> charm2>

To destroy a charm unit

juju destroy-unit <charm/instance_no>

To destroy a charm service

juju destroy-service <charm>

To destroy a machine on which charm is deployed

juju destroy-machine <machine/machine_no>

This was a short intro to the Ubuntu Juju cloud platform, I will post the next article on how to write a charm for your application.

Leave a Comment

Your email address will not be published. Required fields are marked *