Deploying Cloud Foundry in a Single Click with Juju Charms

by Aliaksandr PrysmakouAugust 6, 2014
Juju Charms is a service orchestration tool, which first release consists of Go router, NATS, Cloud Controller, UAA, DEA, etc.

Up until recently, BOSH has been pretty much the only tool chain for deployment of Cloud Foundry. We love BOSH for its visionary approach towards managing life cycle of clustered systems, flexibility, and a distro-agnostic approach to Linux. Yet, it could be quite difficult to deploy BOSH or with BOSH. Yes, despite all its beauty, BOSH has a learning curve, and you certainly need to know its key concepts and internals to be productive. Bottom line, it takes quite a few manual steps to bring all Cloud Foundry components into a single working deployment using BOSH.

To grow the Cloud Foundry community, Altoros, Canonical, and Pivotal joined their efforts to deliver an alternative deployment tool, which would reduce complexity of Cloud Foundry deployment and decrease the number of steps. This solution is based on Juju, a service orchestration tool by Canonical.

In this article, we are going to show you how to deploy the Cloud Foundry PaaS using Juju Charms for Cloud Foundry, a joint project of Altoros, Canonical, and Pivotal.

 

What is Juju and Juju Charms?

Juju is an open-source tool, which automates configuration, deployment, management, scaling, and maintenance of services. You can push your services to all of the main IaaS solutions: AWS, OpenStack, Azure, etc. by typing a single command in the console or clicking a single button in the GUI. The charms can set relations between services and make necessary adjustments automatically. So, with Juju you can deploy such a complex bundle of services as OpenStack in a single click.

Basically, Juju Charms contain configuration settings of an application. They define how services are deployed, connected to each other, and scaled. In this article, we will describe how to provision, run, scale, and destroy CF services using Juju Charms.

You can write Juju Charms in pretty much any programming language. For the Cloud Foundry bundle of charms, we chose Python, since it has a good library, Charm Helpers, which simplifies service definition, working with templates, etc. In the course of the project, we added lots of enhancements to this library.

The first release of Charms consists of the following components:

  • Go router
  • NATS
  • Cloud Controller
  • UAA
  • DEA
  • HM9000
  • etcd
  • MySQL and MySQL service broker

Cloud Foundry deployment using the Juju GUI

A Juju environment should be configured to use your credentials, endpoints, etc. Learn how to do it in the official documentation.

To deploy a single CF component using Juju Charms, you should run the command below.

$juju deploy cf-cloud-controller

Although you can deploy the Cloud Foundry components separately, to make a service work, you should set relations between the services. To avoid doing this manually, you should better use Juju Deployer to simplify deployment.

 

Automating Cloud Foundry installation with Juju Deployer

To reduce manual work needed to deploy Cloud Foundry, we gathered all Cloud Foundry charms into a single Cloud Foundry bundle file. It will help you to deploy all the components, establish relations, and expose services by running a single command in the console or making a single mouse click in the GUI. If you would like to use the bundle, you need to install a Juju Deployer Package.

To deploy the entire Cloud Foundry platform, run the command below.

$juju deployer -BWc bundle.yaml base

This command performs all the necessary installation operations, such as getting charms for the services, preparing a bootstrap machine (a VM is used to manage Juju), provisioning VMs for services, starting services, and adding relations between them. All these tasks are triggered by a single command. The only thing you will have to do is to specify a configuration file. It took about half an hour on my Ubuntu host to deploy the entire Cloud Foundry PaaS. We recorded the deployment process, so you can watch this video to get more details on installation.

Now, if we use BOSH, there are a few more steps we have to perform manually:

  1. install Ruby
  2. install BOSH gems
  3. prepare BOSH manifest file
  4. bootstrap MicroBOSH
  5. download cf-release
  6. upload a stemcell
  7. configure cf-release

This video demonstrates how to push applications to Cloud Foundry using Juju.

Scaling services

With Juju, scaling is also simplified to a single command. For example, to add resources by increasing the number of running Droplet Execution Agents by three, just run the following command.

$juju add-unit -n 3 cf-dea

It will add three more units to the deployment. To reduce resource utilization, execute the command below.

$juju remove-unit cf-dea

It stops one virtual machine (or a container, if it is a local host).

Destroying services

To destroy the deployment completely and release all resources, run the following command.

$juju destroy-environment local --force

The video below demonstrates how it is done with Juju.

If you would like to delete services one by one, use the following command.

$juju destroy-service cf-uaa

Keep in mind that Juju is not an absolute solution and has some limitations. For example, it is impossible to deploy Juju to a VirtualBox VM. The DEA charm cannot run inside the LXC container, so we should use KVM instead. To run a KVM, a host should support nested virtualization, which VirtualBox does not. So, to deploy Cloud Foundry on a local machine inside a VM, you should use VMware Workstation or any other desktop hypervisor that supports nested virtualization.

Another drawback of Juju is that it does not support Cloud Foundry revisions. We are working on introducing this feature in the near future. For development purposes, we used Cloud Foundry version r153.

 

Thinking of Shifting to the Cloud? Cloud Foundry Consulting

Juju: current state and future plans

Juju Charms simplified the whole Cloud Foundry deployment process to a single command and at the same time preserved the variety of deployment options. You can choose a local host, any public or private IaaS as a target deployment option. Juju Charms for Cloud Foundry complete Canonical’s set of tools provided for IaaS (MaaS, Juju, Charms for OpenStack) and PaaS deployment. Although lots has already been done, a great job is ahead. Currently, we are working on changing the whole concept of getting CF components to come up with quick CF updates. Soon, we are going to extend the range of service brokers, so users could quickly add such services as Hadoop, PostgreSQL, Cassandra, etc. to the Cloud Foundry PaaS deployed with Juju.

Should you try the Juju bundle of charms for Cloud Foundry (we certainly recommend it!), perhaps you can share your feedback!

What was your experience like? Did it work for you? What kind of capabilities would you like to add to the bundle?

 

Further reading

Interested in how to manage secure Cloud Foundry deployments distributed across multiple data centers?
  •  
  •  
  •