What is Juju?

Quoted from Ubuntu:

"Juju is a state-of-the-art, open source, universal model for service oriented architecture and service oriented deployments. Juju allows you to deploy, configure, manage, maintain, and scale cloud services quickly and efficiently on public clouds, as well as on physical servers, OpenStack, and containers. You can use Juju from the command line or through its beautiful GUI."[^1]

Getting Started:

When Deploying your Applications, Juju allows you to deploy to multiple environments, like AWS, Openstack, DigitalOcean etc.

For this tutorial I will be showing you how to setup and configure Juju for LXC using the Local environment option on Ubuntu 16.

Before you continue, make sure you have your LXC Environment Setup.

Installing Packages:

$ sudo add-apt-repository ppa:juju/stable
$ sudo apt-get update
$ sudo apt-get install juju-local
``` <p>

**Configuration:**

```language-bash
$ juju generate-config
$ juju switch local
``` <p>

The local provider can use lxc-clone to create the containers used as machines, this is controlled by the lxc-clone option in `~/.juju/environments.yaml` configuration file, like the following.

```language-yaml
local:
    type: local
    lxc-clone: true
``` <p>

**Bootstrap:**

The bootstrap instance almost acts as a controller instance. When calling it, it contacts the cloud provider, downloads a instance with Juju which will communicate with other services that we will be using later.

```language-bash
$ juju bootstrap
``` <p>

Now, for this tutorial I will be showing you how easy and quick it is to setup Wordpress.

Wordpress consists of a Apache/Nginx and MySQL.

**Deploy:**

```language-bash
$ juju deploy wordpress
$ juju deploy mysql
``` <p>

After this has been done, wait for your environment to complete its tasks.

**Adding Relation between Wordpress and MySQL:**

```language-bash
$ juju add-relation wordpress mysql
``` <p>

**Grant Public Access:**

```language-bash
$ juju expose wordpress
``` <p>

**Getting Deployment Status:**

To gather information regarding the status, run the following:

```language-bash
$ juju status
``` <p>

The output should look more or less like the following:

```language-yaml
services:
  mysql:
    charm: cs:precise/mysql-18
    exposed: false
    relations:
      db:
      - wordpress
    units:
      mysql/0:
...
        public-address: 10.0.3.110
  wordpress:
    charm: cs:precise/wordpress-12
    exposed: true
    relations:
      db:
      - mysql
      loadbalancer:
      - wordpress
    units:
      wordpress/0:
...
        public-address: 10.0.3.115
``` <p>

**Deployed with Juju!**

From your status output, you will find `agent-state`, once the value is `started`, your Wordpress website has been deployed with Juju and it should be up and running and you will be able to access your Wordpress site by visiting the public-address of your Wordpress instance.


**Accessing your Instances:**

You can ssh to your instances with the ubuntu username, alternatively you can also access them by using:

```language-bash
$ juju ssh 10.0.3.115
``` <p>


**Terminating your Environment:**

```language-bash
$ juju terminate-environment local
``` <p>

**Juju Commands:**

List of Juju commands can be found [here](https://jujucharms.com/docs/1.24/commands)

**Juju Charms Store:**

They really make it easy for you to deploy lots of different services by using Charms. Charms are like a set of instructions.

Deploying MongoDB is as easy as:

```language-bash
$ juju deploy cs:trusty/mongodb-36
``` <p>

Loads more can be found at the [Charms Store](https://jujucharms.com/)

I trust this getting started guide with Juju was helpful, for more information on Juju, have a look at their Documentation:

[Juju Documentation](https://jujucharms.com/docs/stable/getting-started)
[^1]: https://jujucharms.com/docs/stable/about-juju